Re: Looping?

From: Date: Sat, 05 Oct 2002 14:40:57 +0000
Subject: Re: Looping?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-118956@lists.php.net to get a copy of this message
Just checked the manual and there are no functions named *mysql_numrows* or *mysql_num_row*, but only *mysql_num_rows* (notice the S at the end) Steve Jackson wrote:
Nope doesn't make any difference mysql_numrows or mysql_num_row returns the same: In this case nothing!
-----Original Message----- From: Marek Kilimajer [mailto:kilimajer@webglobe.sk] Sent: 05 October 2002 17:03 To: PHP Subject: Re: [PHP] Looping? typo: Justin French wrote:
This should get you started: <? $dbreturn = mysql_query("SELECT * FROM Items WHERE ItemID = '$ItemID'"); echo mysql_error(); $ItemHits = mysql_numrows($dbreturn);
     
mysql_num_rows()
while($row = mysql_fetch_array($dbreturn)) { $ItemID = $row['ItemID']; $ImageName = $row['ImageName']; $ItemName = $row['ItemName']; $ItemSKU = $row['ItemSKU']; $ItemCost = $row['ItemCost']; $ItemDescription = $row['ItemDescription']; echo "<table width='400' border='0' cellspacing='0' cellpadding='0'>"; echo "<tr>"; echo "<td><img src='images/$ImageName' width='175'></td>"; echo "<td valign='top'>"; echo "<table width='225' border='0' cellspacing='0' cellpadding='0'>"; echo "<tr>"; echo "<td><span class='pikkuleipa'>Product Name:</span></td>"; echo "<td><span class='pikkuleipa'>$ItemName</span></td>"; echo "</tr>"; echo "<tr>"; echo "<td><span class='pikkuleipa'>Product Code:</span></td>"; echo "<td><span class='pikkuleipa'>$ItemSKU</span></td>"; echo "</tr>"; echo "<tr>"; echo "<td><span class='pikkuleipa'>Unit price:</span></td>"; echo "<td><span class='pikkuleipa'>¬$ItemCost</span></td>"; echo "</tr>"; echo "<tr>"; echo "<td><span class='pikkuleipa'><b>Description</b></span><br></td>"; echo "</tr>"; echo "<tr>"; echo "<td>"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "<table width='225' border='0' cellspacing='0' cellpadding='0'>"; echo "<tr>"; echo "<td><span class='pikkuleipa'>$ItemDescription</span></td>"; echo "</tr>"; echo "</table>"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "<form method='post' action='$Relative/addcart.php'>"; echo "<table width='400' border='0' cellspacing='0' cellpadding='0'>"; echo "<tr>"; echo "<td width='175' align='right'><span class='pikkuleipa'>Quantity Required:</span></td>"; echo "<td width='225'>"; echo "<INPUT TYPE='TEXT' Name='ItemQuantity' Value='1' size='2'>"; echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td width='175'></td>"; echo "<td width='225'><input type='image' border='0' name='submit' src='images/add.gif'></td>"; echo "</tr>"; echo "</table>"; echo "</form>"; } ?>
     


« previous php.general (#118956) next »