Jump to content

I've created 2 php file but getting mysql_fetch_array() error


egturnkey

Recommended Posts

Hello Friends ,

 

I've made a simple 2 php files but when i do run it, it gives error as following

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\eshtrak\z.php on line 7

 

( i think there an error in WHERE catID='".$_GET['catID']."' AND productID=".$_GET['productID'] )

 

Here is the php code

 

<?php
include_once('config.php'); // connect 2 DB

$productSQL = "SELECT * FROM product WHERE catID='".$_GET['catID']."' AND productID=".$_GET['productID'];
$productresult = mysql_query($productSQL);
$productrow = mysql_fetch_array($productresult);


echo "{$productrow['name']}";

?>

 

and if you need to review the database table is as following

 

CREATE TABLE `product` (
  `productID` int(11) NOT NULL auto_increment,
  `catID` int(11) NOT NULL,
  `name` varchar(255) NOT NULL default '',
  `demo` varchar(255) NOT NULL default '',
  `description` text NOT NULL,
  `keywords` text NOT NULL,
  `compatibilities` text NOT NULL,
  `downloadURL` varchar(255) NOT NULL default '',
  `status` int(1) NOT NULL default '0',
  `type` int(1) NOT NULL default '0',
  `price` float(10,2) NOT NULL,
  `userID` int(11) NOT NULL default '0',
  `creation_date` bigint(14) NOT NULL,
  PRIMARY KEY  (`productID`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=20 ;

 

 

also if you want to review the config.php

 

<?
$dbuser = "root";
$dbhost = "localhost";
$dbpass = "art";
$dbname = "my";
@mysql_connect($dbhost,$dbuser,$dbpass);
@mysql_select_db($dbname);
?>

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.