slanderman Posted October 20, 2009 Share Posted October 20, 2009 I'm trying to get this query from my webform to work. I noticed that the code I borrowed doesnt define / set $sql...how do I set this to make the query work? When i try to query the database, I keep getting "Error: Query was empty" <?php $con = mysql_connect(......); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("slanderman", $con); $result = mysql("slanderman","SELECT * FROM performer WHERE (firstname LIKE '%"+$Search + "%' OR lastname LIKE '%"+$Search + "%' OR email LIKE '%"+$Search + "%') ORDER BY firstname,lastname,email"); if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } mysql_close($con); ?> Quote Link to comment https://forums.phpfreaks.com/topic/178375-solved-defining-sql/ Share on other sites More sharing options...
fenway Posted October 20, 2009 Share Posted October 20, 2009 Maybe you should see what the first parameter represents. Quote Link to comment https://forums.phpfreaks.com/topic/178375-solved-defining-sql/#findComment-940639 Share on other sites More sharing options...
slanderman Posted October 20, 2009 Author Share Posted October 20, 2009 i'm completely new to all of this, not sure what you're referring to...what is the parameter? Quote Link to comment https://forums.phpfreaks.com/topic/178375-solved-defining-sql/#findComment-940643 Share on other sites More sharing options...
Mchl Posted October 20, 2009 Share Posted October 20, 2009 Parameters are data you pass (give) to a function in parentheses. See mysql_query to see what parameters mysql_query expects to get. And as to what mysql() function is... where did you get it from? Quote Link to comment https://forums.phpfreaks.com/topic/178375-solved-defining-sql/#findComment-940654 Share on other sites More sharing options...
slanderman Posted October 21, 2009 Author Share Posted October 21, 2009 I got this solved. thanks Quote Link to comment https://forums.phpfreaks.com/topic/178375-solved-defining-sql/#findComment-941128 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.