skippa Posted April 22, 2009 Share Posted April 22, 2009 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/thebestj/public_html/poker.php on line 1097 heres line 1097 return mysql_fetch_array(mysql_query("SELECT p.*, u.poker, u.money FROM poker p left join users u on (u.username='{$_SESSION['username']}') WHERE p.id=u.poker")); whats wrong with it. Quote Link to comment https://forums.phpfreaks.com/topic/155258-solved-can-someone-help-me-with-one-line-of-php-please/ Share on other sites More sharing options...
Maq Posted April 22, 2009 Share Posted April 22, 2009 Add this in and see what it outputs: return mysql_fetch_array(mysql_query("SELECT p.*, u.poker, u.money FROM poker p left join users u on (u.username='{$_SESSION['username']}') WHERE p.id=u.poker") or die(mysql_error())); Quote Link to comment https://forums.phpfreaks.com/topic/155258-solved-can-someone-help-me-with-one-line-of-php-please/#findComment-816848 Share on other sites More sharing options...
Mchl Posted April 22, 2009 Share Posted April 22, 2009 Most likely the query fails. Change this one line into three $sql = "SELECT p.*, u.poker, u.money FROM poker p left join users u on (u.username='{$_SESSION['username']}') WHERE p.id=u.poker"; $result = mysql_query($sql) or die(mysql_error()." $sql"); return mysql_fetch_array($result); this should display what causes the error Quote Link to comment https://forums.phpfreaks.com/topic/155258-solved-can-someone-help-me-with-one-line-of-php-please/#findComment-816851 Share on other sites More sharing options...
skippa Posted April 22, 2009 Author Share Posted April 22, 2009 nope, still an error somewhere on that line. Quote Link to comment https://forums.phpfreaks.com/topic/155258-solved-can-someone-help-me-with-one-line-of-php-please/#findComment-816852 Share on other sites More sharing options...
Maq Posted April 22, 2009 Share Posted April 22, 2009 nope, still an error somewhere on that line. Yeah, what is it? The "or die(mysql_error())" should kill the script and output a more "descriptive" error message. Quote Link to comment https://forums.phpfreaks.com/topic/155258-solved-can-someone-help-me-with-one-line-of-php-please/#findComment-816853 Share on other sites More sharing options...
skippa Posted April 22, 2009 Author Share Posted April 22, 2009 Unknown column 'u.poker' in 'field list' SELECT p.*, u.poker, u.money FROM poker p left join users u on (u.username='Chris') WHERE p.id=u.poker Thats The Problem. Has Anyone Got Msn Where I Can Have A Chat To And They Can Have A Good Look At The Script.? Quote Link to comment https://forums.phpfreaks.com/topic/155258-solved-can-someone-help-me-with-one-line-of-php-please/#findComment-816855 Share on other sites More sharing options...
Mchl Posted April 22, 2009 Share Posted April 22, 2009 Well? Is there a field called 'poker' in 'users' table? Quote Link to comment https://forums.phpfreaks.com/topic/155258-solved-can-someone-help-me-with-one-line-of-php-please/#findComment-816859 Share on other sites More sharing options...
skippa Posted April 22, 2009 Author Share Posted April 22, 2009 nahh there aint, how can i add one? Quote Link to comment https://forums.phpfreaks.com/topic/155258-solved-can-someone-help-me-with-one-line-of-php-please/#findComment-816860 Share on other sites More sharing options...
Maq Posted April 22, 2009 Share Posted April 22, 2009 You can easily create one through such web apps like, "PHPMyAdmin". Or, you can do it the old fashioned way: ALTER TABLE users ADD poker VARCHAR(60); Quote Link to comment https://forums.phpfreaks.com/topic/155258-solved-can-someone-help-me-with-one-line-of-php-please/#findComment-816865 Share on other sites More sharing options...
skippa Posted April 22, 2009 Author Share Posted April 22, 2009 Yeah im in PhpMyAdmin now, and in the database. how do i add one through there. Quote Link to comment https://forums.phpfreaks.com/topic/155258-solved-can-someone-help-me-with-one-line-of-php-please/#findComment-816868 Share on other sites More sharing options...
Maq Posted April 22, 2009 Share Posted April 22, 2009 I think it's, DB >> table_name >> OPERATION tab, then add your table. Quote Link to comment https://forums.phpfreaks.com/topic/155258-solved-can-someone-help-me-with-one-line-of-php-please/#findComment-816869 Share on other sites More sharing options...
skippa Posted April 22, 2009 Author Share Posted April 22, 2009 ok. added poker. but the page on the site has gone completly blank. Quote Link to comment https://forums.phpfreaks.com/topic/155258-solved-can-someone-help-me-with-one-line-of-php-please/#findComment-816874 Share on other sites More sharing options...
Mchl Posted April 22, 2009 Share Posted April 22, 2009 Well... we helped you with this one line, haven't we? Please visit this link http://www.phpfreaks.com/tutorial/debugging-a-beginners-guide/page1 Quote Link to comment https://forums.phpfreaks.com/topic/155258-solved-can-someone-help-me-with-one-line-of-php-please/#findComment-816876 Share on other sites More sharing options...
skippa Posted April 22, 2009 Author Share Posted April 22, 2009 yeah, you have, thanks everyone. Quote Link to comment https://forums.phpfreaks.com/topic/155258-solved-can-someone-help-me-with-one-line-of-php-please/#findComment-816877 Share on other sites More sharing options...
Maq Posted April 22, 2009 Share Posted April 22, 2009 ok. added poker. but the page on the site has gone completly blank. Probably cause there's nothing in the 'poker' column yet. Quote Link to comment https://forums.phpfreaks.com/topic/155258-solved-can-someone-help-me-with-one-line-of-php-please/#findComment-816881 Share on other sites More sharing options...
skippa Posted April 22, 2009 Author Share Posted April 22, 2009 yeah says null fo every user in database, it shouldnt say null should it.. Quote Link to comment https://forums.phpfreaks.com/topic/155258-solved-can-someone-help-me-with-one-line-of-php-please/#findComment-816890 Share on other sites More sharing options...
Maq Posted April 22, 2009 Share Posted April 22, 2009 yeah says null fo every user in database, it shouldnt say null should it.. Well if you just created it how is it supposed to have data in it? Quote Link to comment https://forums.phpfreaks.com/topic/155258-solved-can-someone-help-me-with-one-line-of-php-please/#findComment-816893 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.