The following will always be true:
$q="select * from /mfc/ WHERE Name='$mName'";
if(mysql_query($q)) {
...
}
Although it's in the manual I managed to waste an hour or two sorting it out.
The idea, of course, was to make sure that a name did not already exist before it was saved. mysql_query(), however, returns a resource that gives access to the result, not the result itself. After the query is made, it is then necessary to retrieve the results. The following worked fine:
$q="select * from /mfc/ WHERE Name='$mName'";
$q=mysql_fetch_row(mysql_query($q));
if($q) {
...
}
|