i want to go inside the if statment if i have both things in one row.
so if i have image_id = $image_id_g and user_id=$user_id_s on same row. i wan tto go inside the if statment.
but this is not working. i thinkg this query is testing two things sepeartly. i want to check if two things are true in same row. not different rows.

if(!$tester = mysql_query("SELECT * FROM image WHERE  image_id = '$image_id_g' AND user_id = '$user_id_s'"))

Recommended Answers

All 2 Replies

Member Avatar

Seems ok to me

What you're doing is checking if the mysql query is being executed correctly. $tester will be set to true if the query could be executed, or to false if it could not. You should rather use something like: $results = mysql_fetch_assoc($tester); And then check if $results has any records. If it has, results could be found for the query that was just executed. If not, no results were found.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.