Jump to content

[SOLVED] Trouble with "WHILE" loops


netrunnr

Recommended Posts

:(

Hello There People!!

 

I'm hacing a slight issue with While loops, can anyone help?

 

                  <?php

					$Sno = 1;
					$pGTotal = 0;

					if(!(session_register('login')))
					{
						$query = "SELECT * FROM userordersdetail WHERE order_id=".$oid."";									
						$result_orderdetails = mysql_query($query)or die("error".mysql_error());
						$rownum = mysql_num_rows($result_orderdetails);

						if($rownum > 0)
						{
							while($res_order = mysql_fetch_array($result_orderdetails))
							{
								$pPrice = $res_order['product_price'];
								$pTotPrice = $pPrice * $res_order['product_qty'];
								$pTotPrice = number_format($pTotPrice,2,'.','');
								$pGTotal = $pGTotal + $pTotPrice;
								$pGTotal = number_format($pGTotal,2,'.','');
								$pPrice = number_format($pPrice,2,'.','');
				?>
                  <tr class="bodyText">
                    <td height="36" align="center"><strong> <?php echo $Sno; ?>.</strong></td>
                    <td align="center"> <?php echo $res_order['product_name']; ?></td>
                    <td align="center"> <?php echo $res_order['product_size']; ?></td>
                    <td align="center">  <?php echo $pPrice; ?></td>
                    <td align="center"> <?php echo $res_order['product_qty']; ?> </td>
                    <td align="center">  <?php echo $pTotPrice; ?> </td>
                    <td> </td>
                    <td> </td>
                  </tr>
                  <tr>
                    <td colspan="8" ></td>
                  </tr>
                  <?php
								$Sno++;
								}
							}
							else
							{
								echo "<tr>";
								echo "<td height=\"25\" colspan=\"8\"><font size=\"2\" face=\"Geneva, Arial, Helvetica, sans-serif\">Shopping Basket Is Empty!</font></td>";
							    echo "</tr>";
							}
						}
						else
						{
					  ?>
                  <tr>
                    <td height="25" colspan="8"> </td>
                  </tr>
                  <tr>
                    <td height="25" colspan="8"> </td>
                  </tr>
                  <?php
						}
					  ?>

Link to comment
Share on other sites

Hey, cheers for the reply.

 

Basically I want the code to check to see if the session is true (which it is). then go through the databse picking out the UserOrderDetails and showing them (what they ordered, quantities etc).

 

I changed the line you mentioned but to no avail.  :-\

Link to comment
Share on other sites

I just get the standard: syntax error, unexpected T_STRING, expecting T_VARIABLE... etc

 

Thank you anyway, i just want to connect to the db, read the contents where the Order ID is $oID and just pull the information out.

 

I've done this loads of times, but this time it has be stumped :(

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.