Reputation: 358
<?php
include("db.php");
$name=$_REQUEST['name'];
$mail=$_REQUEST['email'];
$yname=$_REQUEST['yname'];
$result=mysql_query("SELECT * FROM information WHERE uname = '$name' ");
if (mysql_num_rows($result) == 0) {
$query=mysql_query("INSERT into noresult (Serial,searchname,yourname,email)
VALUES ('',$name','$yname','$mail')");
if ($query){
header('Location:nullresult.php');
}
else{
echo "Query failure";
}
}
?>
This returns 'Query Failure'. It was working sometime back with table name 'seeker'. Then I dropped it and created a new table 'noresult' as the previous one was a bit messed up. Suddenly the query fails.
Note: seeker and noresult have same columns.
Upvotes: 0
Views: 1375
Reputation: 566
Try this updated query-
$query=mysql_query("INSERT into noresult (Serial,searchname,yourname,email)
VALUES ('','".$name."','".$yname."','".$mail."')");
also check all column name from table noresult.
Upvotes: 0
Reputation: 3813
You're missing a single quote in your query:
$query=mysql_query("INSERT into noresult (Serial,searchname,yourname,email)
VALUES ('','$name','$yname','$mail')");
there----^
Upvotes: 2