$row = mysql_fetch_assoc("SELECT count(*) as c FROM bivalues WHERE myvalue = '$zchar'")
if ($row['c'] > 0) { echo 'result 2 - found it' }else{ echo 'NOT found' } hope it helps
Pete
Douglas D Hull wrote:
I am trying to find data, or if not found set a variable to "Err". myvalue being a variable in my database and $zchar being my value to find.
The following result is never 1 even if no values were found, so the result is always 2. If the finding value does exist in my database this does find the correct value: if (!$result = mysql_query("SELECT * FROM bivalues WHERE myvalue = '$zchar'")) { echo 'result 1 - not found'; $myresut = "Err"; } else { {echo 'result 2 - found it' }
The following result is never 2 even if the value actually exist in my database, so the result is always 1: if (!$result = mysql_query("SELECT * FROM bivalues WHERE myvalue = $zchar")) { echo 'result 1 - not found'; $myresult = "Err"; } else { {echo 'result 2 - found it' }
Thanks for any help, Doug
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php