0
$mainuser=$_POST['mainuser'];


$likeduser=$_POST['likeduser'];

$workcode=$_POST['workcode'];


$sqlQ="select * from shablike where 'mainuser'='$mainuser' and  'workcode'='$workcode'  ";
$result=mysql_Query($sqlQ);


if($result){
print "again";

  }

else {
$sqlQ1="insert into shablike (workcode,mainuser,likeduser)     VALUES('$workcode','$mainuser','$likeduser')";
$result1=mysql_Query($sqlQ1);
if($result1)
{print "ok";}

 }

mysql_close($con);

?>

this is my simple code but it dosnt work.i want to select row where mainuser=$ mainuser and workcode=$workcode

plz help me thank for all

  • [Why shouldn't I use mysql_* functions in PHP?](https://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php) – FirstOne Nov 27 '17 at 23:46
  • You're open to [SQL Injections](http://bobby-tables.com/). Please, visit [How can I prevent SQL injection in PHP?](https://stackoverflow.com/questions/60174/how-can-i-prevent-sql-injection-in-php) – FirstOne Nov 27 '17 at 23:47

0 Answers0