Jump to content

Anyone able to figure out why the second query here isnt working...


jaxdevil

Recommended Posts

these codes below were working, but they were wrong because I had LIMIT on them and set to one item, now that I removed the LIMIT  function from both queries the second one does not pull up at all. Any ideas why? Oh yeah, and the first query is still reflecting just the 10% from the first item, not the array. anyone can figure that out too? I am stumped.

 

Thanks in advance guys,

SK

 

<?php
$sql = "SELECT * FROM checkout WHERE bidnum=$di";
$query = mysql_query($sql);
$sum5 = array();
while($row = mysql_fetch_array($query)) {
$sum5[] = $row['amt'];
echo "</center>";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "<table width=\"1000\" height=\"20\" border=\"1\" bordercolor=\"green\" cellpadding=\"0\" cellspacing=\"0\">";
echo "<tr>";
echo "<td width=\"900\" align=\"center\" valign=\"middle\">";
echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">";
echo "<tr>";
echo "<td width=\"100\">";
echo "</td>";
echo "<td width=\"650\" align=\"center\" valign=\"middle\">";
echo "<font face=\"Tahoma\" size=\"2\"><b>10% Buyers Premium</b></font>";
echo "</td>";
echo "<td width=\"150\">";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</td>";
echo "<td width=\"100\" align=\"center\" valign=\"bottom\">";
echo "<center>";

$sum5 = number_format(array_sum($sum5)*0.1,2,'.','');
echo "" .$sum5;


}
?>

<?php
$sql = "SELECT * FROM checkout WHERE bidnum=$di";
$query = mysql_query($sql);
$sum6 = array();
while($row = mysql_fetch_array($query)) {
$sum6[] = $row['amt'];
echo "</center>";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "<table width=\"1000\" height=\"20\" border=\"1\" bordercolor=\"green\" cellpadding=\"0\" cellspacing=\"0\">";
echo "<tr>";
echo "<td width=\"900\" align=\"center\" valign=\"middle\">";
echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">";
echo "<tr>";
echo "<td width=\"100\">";
echo "</td>";
echo "<td width=\"650\" align=\"center\" valign=\"middle\">";
echo "<font face=\"Tahoma\" size=\"2\"><b>7% Sales Tax</b></font>";
echo "</td>";
echo "<td width=\"150\">";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</td>";
echo "<td width=\"100\" align=\"center\" valign=\"bottom\">";
echo "<center>";

$sum6 = number_format(array_sum($sum6)*0.07,2,'.','');
echo "" .$sum6;


}
?>

Link to comment
Share on other sites

$di is being called in a GET statement.  i.e. deduct.php?di=57 would pull the rows whos bidnum=57

 

i added the or die statements in the query. I didn't get any errors back. i think it maybe a tables problem? I could be wrong of course.

 

Please help if you can.

 

Thanks in advance,

SK

Link to comment
Share on other sites

change

$sql = "SELECT * FROM checkout WHERE bidnum=$di";
$query = mysql_query($sql);

to

$sql1 = "SELECT * FROM checkout WHERE bidnum=$di";
$query1 = mysql_query($sql1) or die(mysql_error());

 

AND change

$sql = "SELECT * FROM checkout WHERE bidnum=$di";
$query = mysql_query($sql);

to

$sql2 = "SELECT * FROM checkout WHERE bidnum=$di";
$query2 = mysql_query($sql2) or die(mysql_error());

 

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.