Ahmed3kri Posted July 20, 2013 Share Posted July 20, 2013 Hello, I'm a beginner php developer so I might sound stupid x.x I'm working on a website on my local computer using xampp and the website is fine. But then when I tried runing the website online using a webhost (000webhost) I got two errors. the errors: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/assasasas/public_html/index.php on line 15 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/sasaasas/public_html/index.php on line 21 the code where the errors are: <?php if(isset($_GET['page'])) $page = intval($_GET['page']); else $page=1; $max=9; $from=($max*$page)-$max; $db_games_t_t = mysql_num_rows(mysql_query("SELECT * FROM games ORDER BY id DESC")); //line 15 $db_games_q = mysql_query("SELECT * FROM games ORDER BY id DESC LIMIT $from,$max"); $db_games_t = mysql_num_rows($db_games_q); $pages = ceil($db_games_t_t/$max); $count=0; while($r = mysql_fetch_array($db_games_q)) { //line 21 $count++; ?> Link to comment https://forums.phpfreaks.com/topic/280356-supplied-argument-problem-in-phpmysql/ Share on other sites More sharing options...
AbraCadaver Posted July 20, 2013 Share Posted July 20, 2013 Well, if that is all of the code, then you haven't connect to the db server and you haven't selected a db. Link to comment https://forums.phpfreaks.com/topic/280356-supplied-argument-problem-in-phpmysql/#findComment-1441535 Share on other sites More sharing options...
Ahmed3kri Posted July 20, 2013 Author Share Posted July 20, 2013 how do I connect it to the dn server and select the db? I have db_connect.php in my files. and the website works fine in xampp but not in the webhosting Link to comment https://forums.phpfreaks.com/topic/280356-supplied-argument-problem-in-phpmysql/#findComment-1441536 Share on other sites More sharing options...
AbraCadaver Posted July 20, 2013 Share Posted July 20, 2013 how do I connect it to the dn server and select the db? I have db_connect.php in my files. and the website works fine in xampp but not in the webhosting Well, you don't show connection or an include or anything in your code. mysql_query("SELECT * FROM games ORDER BY id DESC") or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/280356-supplied-argument-problem-in-phpmysql/#findComment-1441537 Share on other sites More sharing options...
Ahmed3kri Posted July 21, 2013 Author Share Posted July 21, 2013 Well, you don't show connection or an include or anything in your code. mysql_query("SELECT * FROM games ORDER BY id DESC") or die(mysql_error()); great, both errors went off but now there is No database selected Link to comment https://forums.phpfreaks.com/topic/280356-supplied-argument-problem-in-phpmysql/#findComment-1441540 Share on other sites More sharing options...
Ahmed3kri Posted July 21, 2013 Author Share Posted July 21, 2013 Thnx AbraCadaververy much, I fixed it. It was a problem in .htacess Link to comment https://forums.phpfreaks.com/topic/280356-supplied-argument-problem-in-phpmysql/#findComment-1441541 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.