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
https://forums.phpfreaks.com/topic/264620-mysql_fetch_row-help-plz/
Share on other sites

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.