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
Code: Select all
<?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']}";
?>
Code: Select all
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
Code: Select all
<?
$dbuser = "root";
$dbhost = "localhost";
$dbpass = "art";
$dbname = "my";
@mysql_connect($dbhost,$dbuser,$dbpass);
@mysql_select_db($dbname);
?>