| | |
need help!!
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Feb 2008
Posts: 15
Reputation:
Solved Threads: 0
what is the problem with this code?
<body bgcolor="#FFFF00">
<div align="center">
<table width="284" border="4" cellspacing="2" cellpadding="2">
<tr>
<td width="92">cat_id</td>
<td width="79">cat_name</td>
<td width="79">choose product </td>
</tr>
<?php
$id=$_GET['id'];
$con=mysql_connect("localhost","root","");
mysql_select_db("niladri",$con);
$sql="SELECT * FROM `subcategory`whare `cat_id`=`$id`";
$res=mysql_query("$sql",$con);
while($row=mysql_fetch_array($res))
{
?>
<tr>
<td><?php echo $row[subcat_id];?></td>
<td><?php echo $row[subcat_name];?></td>
<td><a href="fetch3.php"?id=<?php echo $row[subcat_id]?>>click</a></td>
</tr>
<?php
}
?>
</table>
</div>
</body>
it is showing an warning--->
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Program Files\htdocs\Niladri's PHP Programs\PROJECT\fetch2.php on line 16
the previous page fetch1.php code is.....
<?php
ob_start();
session_start();
$sidf=session_id();
session_register('sidf');
?>
<body bgcolor="#FFFF00">
<div align="center">
<table width="284" border="4" cellspacing="2" cellpadding="2">
<tr>
<td width="92">cat_id</td>
<td width="79">cat_name</td>
<td width="79">choose subcategory </td>
</tr>
<?php
$con=mysql_connect("localhost","root","");
mysql_select_db("niladri",$con);
$sql="SELECT * FROM `category`";
$res=mysql_query("$sql",$con);
while($row=mysql_fetch_array($res))
{
?>
<tr>
<td><?php echo $row['cat_id'];?></td>
<td><?php echo $row['cat_name'];?></td>
<td><a href="fetch2.php"?id=<?php print $row['cat_id'];?>">click</a></td>
</tr>
<?php
}
?>
</table>
</div>
</body>
please send me a quick reply
<body bgcolor="#FFFF00">
<div align="center">
<table width="284" border="4" cellspacing="2" cellpadding="2">
<tr>
<td width="92">cat_id</td>
<td width="79">cat_name</td>
<td width="79">choose product </td>
</tr>
<?php
$id=$_GET['id'];
$con=mysql_connect("localhost","root","");
mysql_select_db("niladri",$con);
$sql="SELECT * FROM `subcategory`whare `cat_id`=`$id`";
$res=mysql_query("$sql",$con);
while($row=mysql_fetch_array($res))
{
?>
<tr>
<td><?php echo $row[subcat_id];?></td>
<td><?php echo $row[subcat_name];?></td>
<td><a href="fetch3.php"?id=<?php echo $row[subcat_id]?>>click</a></td>
</tr>
<?php
}
?>
</table>
</div>
</body>
it is showing an warning--->
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Program Files\htdocs\Niladri's PHP Programs\PROJECT\fetch2.php on line 16
the previous page fetch1.php code is.....
<?php
ob_start();
session_start();
$sidf=session_id();
session_register('sidf');
?>
<body bgcolor="#FFFF00">
<div align="center">
<table width="284" border="4" cellspacing="2" cellpadding="2">
<tr>
<td width="92">cat_id</td>
<td width="79">cat_name</td>
<td width="79">choose subcategory </td>
</tr>
<?php
$con=mysql_connect("localhost","root","");
mysql_select_db("niladri",$con);
$sql="SELECT * FROM `category`";
$res=mysql_query("$sql",$con);
while($row=mysql_fetch_array($res))
{
?>
<tr>
<td><?php echo $row['cat_id'];?></td>
<td><?php echo $row['cat_name'];?></td>
<td><a href="fetch2.php"?id=<?php print $row['cat_id'];?>">click</a></td>
</tr>
<?php
}
?>
</table>
</div>
</body>
please send me a quick reply
PHP Syntax (Toggle Plain Text)
$sql="SELECT * FROM `subcategory`where `cat_id`=`$id`"; $res=mysql_query($sql);
PHP Syntax (Toggle Plain Text)
mysql_select_db($dbid) or die("unable to connect"); $sql="SELECT * FROM subcategory where cat_id='$id'"; $res=mysql_query($sql);
![]() |
Other Threads in the PHP Forum
- Previous Thread: listbox prob........
- Next Thread: Problem with $_GET variable
| Thread Tools | Search this Thread |
apache api array beginner binary broken cache cakephp checkbox class cms code confirm cron curl customizableitems database date display dynamic echo email error external fcc file files folder form forms forum freelancing function functions google header headmethod howtowriteathesis href htaccess html iframe image include insert ip javascript joomla limit link login mail malfunction menu method mlm mod_rewrite multiple mysql neutrality oop pageing pagerank paypal pdf php phpmysql play problem query question radio random recursion remote root script search select server sessions sms soap source space sql support! syntax system table template tutorial update upload url validator variable video web youtube





