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);
?>

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.