RON_ron Posted September 14, 2012 Share Posted September 14, 2012 Can someone help to fix this piece of code... Does not work? $checkStudent = "Malakai"; $query = "SELECT * FROM gifts_db LEFT OUTER JOIN grade_db ON gifts_db.student = grade_db.Student WHERE gifts_db.student = ".$checkStudent; $results = mysql_query($query); while($line = mysql_fetch_array($results)) { //// } Link to comment https://forums.phpfreaks.com/topic/268351-join-where/ Share on other sites More sharing options...
trq Posted September 14, 2012 Share Posted September 14, 2012 Your going to need to form a proper question before you can expect help. Link to comment https://forums.phpfreaks.com/topic/268351-join-where/#findComment-1377793 Share on other sites More sharing options...
RON_ron Posted September 14, 2012 Author Share Posted September 14, 2012 oops.... I get an error. Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in ...... line: while($line = mysql_fetch_array($results)) { Link to comment https://forums.phpfreaks.com/topic/268351-join-where/#findComment-1377795 Share on other sites More sharing options...
RON_ron Posted September 14, 2012 Author Share Posted September 14, 2012 can anyone help? Link to comment https://forums.phpfreaks.com/topic/268351-join-where/#findComment-1377799 Share on other sites More sharing options...
jazzman1 Posted September 14, 2012 Share Posted September 14, 2012 Use 'or die(mysql_error())' at the end of your mysql_query() call. Link to comment https://forums.phpfreaks.com/topic/268351-join-where/#findComment-1377835 Share on other sites More sharing options...
shlumph Posted September 14, 2012 Share Posted September 14, 2012 Malakai isn't in quotes. That's one problem. Without knowing your DB structure, and the error you're getting, it's hard to tell what else could be wrong. Link to comment https://forums.phpfreaks.com/topic/268351-join-where/#findComment-1377900 Share on other sites More sharing options...
Christian F. Posted September 15, 2012 Share Posted September 15, 2012 I strongly recommend that you read this article. Link to comment https://forums.phpfreaks.com/topic/268351-join-where/#findComment-1378113 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.