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++;
?>
Edited by Ahmed3kri
Link to comment
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());
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.