glennn.php Posted September 9, 2008 Share Posted September 9, 2008 i'm using several variables in a query: $result = mysql_query("SELECT fice FROM characteristics WHERE offering IN ($offering_sql) AND ".$public_private_sql." AND ".$twofour_sql.""); but where the last condition in the query is a variable, i'm getting errors no matter how i close it: AND ".$twofour_sql.""); AND ".$twofour_sql"); etc... can someone kindly show me how to close this? thanks so much. GN Quote Link to comment https://forums.phpfreaks.com/topic/123453-solved-ending-a-query-with-the-correct-syntax-problem/ Share on other sites More sharing options...
Minase Posted September 9, 2008 Share Posted September 9, 2008 give the content of the 2 variables and what error you recive Quote Link to comment https://forums.phpfreaks.com/topic/123453-solved-ending-a-query-with-the-correct-syntax-problem/#findComment-637605 Share on other sites More sharing options...
revraz Posted September 9, 2008 Share Posted September 9, 2008 $result = mysql_query("SELECT fice FROM characteristics WHERE offering IN ('$offering_sql') AND '$public_private_sql' AND '$twofour_sql'"); Quote Link to comment https://forums.phpfreaks.com/topic/123453-solved-ending-a-query-with-the-correct-syntax-problem/#findComment-637607 Share on other sites More sharing options...
Psycho Posted September 9, 2008 Share Posted September 9, 2008 You should create your queries as string variables so you can echo them to the page when they fail for debugging purposes! And put an on die() handler on there to see what the error is. $query = "SELECT fice FROM characteristics WHERE offering IN ($offering_sql) AND $public_private_sql AND $twofour_sql"; $result = mysql_query($query) or die("Error:<br />".mysql_error()."<br />Query:<br />$query"); Quote Link to comment https://forums.phpfreaks.com/topic/123453-solved-ending-a-query-with-the-correct-syntax-problem/#findComment-637609 Share on other sites More sharing options...
glennn.php Posted September 9, 2008 Author Share Posted September 9, 2008 thanks all of you - i'm still sorting through all these conditions (there are about 10) while configure them. but your help is appreciated and solved the problem. Quote Link to comment https://forums.phpfreaks.com/topic/123453-solved-ending-a-query-with-the-correct-syntax-problem/#findComment-637626 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.