Jump to content

anything wrong with this query ???


Recommended Posts

function get_inc(){
$clutches = "SELECT * FROM cluth WHERE uid = '$id'";
$clu = mysql_query($clutches)or die(mysql_error());
$result = mysql_fetch_array($clu,MYSQL_ASSOC);
$i = 1;
echo "<tr><td>Number.</td><td>clutch Size.</td><td>Worth</td></tr>";
while($result = mysql_fetch_array($clu,MYSQL_ASSOC)){
$cid = $result['id'];
$sire = $result['sire'];
$dame = $result['dame'];
$datel = $result['date_layed'];
$size = $result['size'];
$price = $result['price'];
echo "<tr><td>$i.</td><td>
<a href=\"?room&height=350&width=520&modal=true\" 
class=\"thickbox\" title=\"$sire+$dame\">
($size) Egg Clutch</a>
</td><td>$price</td></tr>";
$i++;
} 

}

 

Link to comment
https://forums.phpfreaks.com/topic/241292-anything-wrong-with-this-query/
Share on other sites

function get_inc(){
$clutches = "SELECT * FROM cluth WHERE uid = '$id'";
$clu = mysql_query($clutches)or die(mysql_error());
echo "<tr><td>Number.</td><td>clutch Size.</td><td>Worth</td></tr>";
$i = 1;
while($result = mysql_fetch_array($clu,MYSQL_ASSOC)){ //result_type is not needed but is fine as-is
$cid = $result['id'];
$sire = $result['sire'];
$dame = $result['dame'];
$datel = $result['date_layed'];
$size = $result['size'];
$price = $result['price'];
echo "<tr><td>$i.</td><td>";
<a href=\"?room&height=350&width=520&modal=true\"  
class=\"thickbox\" title=\"$sire+$dame\">
($size) Egg Clutch</a>
</td><td>$price</td></tr>";
$i++;
} 

}

only thing I changed is the redundancy of the $result variable

you can also echo $i++ instead of $i

whats going on with your href?

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.