Ahmed3kri Posted July 20, 2013 Share Posted July 20, 2013 (edited) 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++; ?> Edited July 20, 2013 by Ahmed3kri Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted July 20, 2013 Share Posted July 20, 2013 (edited) Well, if that is all of the code, then you haven't connect to the db server and you haven't selected a db. Edited July 20, 2013 by AbraCadaver Quote Link to comment 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 Quote Link to comment 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()); Quote Link to comment 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 Quote Link to comment 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 Quote Link to comment 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.