Jump to content

One query works but the other doesnt??


OriginalSunny

Recommended Posts

Hi,
I have used the following code for my queries:

$connect = connect_to_db("con.inc");
$query = "SELECT * FROM purc WHERE
ID='{$_SESSION['ID']}'";
$result = mysql_query($query,$connect)
or die("sql_del: ".mysql_error($connect));

$connect1 = connect_to_db("con.inc");
$query1 = "SELECT * FROM [b]purc_item[/b] WHERE
ID='{$_SESSION['ID']}'";
$result1 = mysql_query($query,$connect1)
or die("sql_del: ".mysql_error($connect1));

The only difference is the table which is highlighted in bold and i have changed the variable names. Now the following code is used to extract the data:

echo "The ID for the product is: <br>";

while($row = mysql_fetch_array($result))
{
echo ''.$row['ID'].'';
}

echo "The quantity for the product is: <br>";

while($row = mysql_fetch_array([b]$result1[/b]))
{
echo "<td><b>";
echo ''.$row['quantity'].'';
echo "</b></td>";
}
echo "<br><br>";

The first piece of data is extracted perfectly but the second piece doesnt seem to work?? I have changed the variable name. It seems i can keep extracting data from the first query but not the second? I had this problem before and wanst able to see what i was doing wrong?
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.