That actually isn't the issue. I tried _assoc and it still doesn't work. The main problem is if there is no match with the database. I'm checking a submitted email address to see if it matches any email addresses in the database. If there is not a match, I want to return different results than if a match is found.
The problem is, if no match is found, I get the text "Resource id #3" as the returned query result rather than just a blank query. When I try to do any fetch_array or _fetch_assoc, the line fails. It cannot resolve with "Resource id #3" as the result.
Here is what I have:
Code: Select all
$query_select = mysql_query("SELECT * FROM newsletter WHERE email=('$email')") or die("Query failed.");
$query_array = mysql_fetch_assoc($query_select) or die("Array failed.");
if(empty($query_array['id'])) {...
Because $query_select is set to "Resource id #3" if no match is found for email in line 1, the mysql_fetch_assoc on line 2 won't work at all, even in trying to return null.
I've even tried to run an if/else statement with:
Code: Select all
if($query_select =="Resource id #3") {...
but it doesn't work.