ongsoowee Posted April 29, 2004 Share Posted April 29, 2004 I try to write a query inside Dreamweaver but it kept returning me empty results. However I am sure this query should return me a result (It was successful when I replace the two variable '$result_1' and '$pattern_id' with the actual value.) Is it possible to use query with variables? Where did I go wrong? $sql_2= mysql_query("SELECT body_id FROM body WHERE pattern_id = '$pattern_id' AND bodyColorset_id = '$result_1'"); $num_rows = mysql_num_rows($sql_2); if($num_rows == 0){ echo "error in body set......"; } else{ while($row=mysql_fetch_array($sql_2)){ $result_2 = $row["body_id"]; }#END OF WHILE LOOP }#END OF IF_ELSE LOOP Thank you for your attention. Quote Link to comment https://forums.phpfreaks.com/topic/1819-query-with-variable/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.