Jump to content

mysql_fetch_row() help plz


Davie33

Recommended Posts

Hi am having a problem with this error i am seeing and dont know why.

This is my error...Warning: mysql_fetch_row() expects parameter 1 to be resource, null given in C:\wamp\www\ydiycomputers\inc\includes.php on line 8

 

<?php
if (isset($_GET['page'])) {
   $pageno = ($_GET['page']);
} else {
   $pageno = 1;
} 
$query = "SELECT count(id) FROM items WHERE category = 'id'";
$query_data = mysql_fetch_row($result);
$numrows = $query_data[0]; 
$rows_per_page = 5;
$lastpage = CEIL($numrows/$rows_per_page);
$pageno = (int)$pageno;
IF ($pageno < 1) {
   $pageno = 1;
} ELSEIF ($pageno > $lastpage) {
   $pageno = $lastpage;
}
$limit = 'LIMIT ' .($pageno - 1) * $rows_per_page .',' .$rows_per_page;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="<?php ECHO $urlpath;?>template/style/style.css" />
<link rel="stylesheet" type="text/css" href="<?php ECHO $urlpath;?>template/style/home.css" />
<link rel="stylesheet" type="text/css" href="<?php ECHO $urlpath;?>template/style/cats.css" />
<?php
SWITCH($_GET['act']){
CASE 'cats':
$query = mysql_query("SELECT * FROM `cats` WHERE id = 'id'");
$row = mysql_fetch_array($query);
?>
<title><?php ECHO $sitedomain;?> - <?php ECHO $row['catname']; ?></title>
<?php BREAK; DEFAULT:?>
<title><?php ECHO $sitedomain;?> - <?php ECHO $slogan;?></title>
<?php BREAK; } ?>
</head>

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.