zubat
01-07-2012, 08:13 AM
Hello,
i got some problem with my code there i wanna check if a variable exsist and if it does it should do a function and if not it should just send back an echo that the variable din't exisist.
$search = "SELECT code FROM pw WHERE code='".$code."'";
$result = mysql_query($search) or die ('SQL Error: '. mysql_error());
if (mysql_num_rows($result) > 0)
{
//Do the function
}
else
{
echo "Code was wrong";
}
i get error on the $search row and i don't know, the database is named "eric" the table is "pw" and the codes row name is "code" and the name on the $_POST code they send in on the form page is code also.
//Zubat
i got some problem with my code there i wanna check if a variable exsist and if it does it should do a function and if not it should just send back an echo that the variable din't exisist.
$search = "SELECT code FROM pw WHERE code='".$code."'";
$result = mysql_query($search) or die ('SQL Error: '. mysql_error());
if (mysql_num_rows($result) > 0)
{
//Do the function
}
else
{
echo "Code was wrong";
}
i get error on the $search row and i don't know, the database is named "eric" the table is "pw" and the codes row name is "code" and the name on the $_POST code they send in on the form page is code also.
//Zubat