Jump to content

supplied argument problem in php/mysql


Ahmed3kri

Recommended Posts

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

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());

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.