Re: Good Damn
| From: | B.C. Lance | Date: | Sun, 11 Aug 2002 15:49:23 +0000 |
| Subject: | Re: Good Damn | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-112037@lists.php.net to get a copy of this message | ||
you might wanna use this instead:
$result = mysql....;
if (mysql_num_rows($result) {
while ....
}
else {
echo 'no articles';
}
$result will always hold an int value if the query does not contain any error. so doing a num_rows on it will be more accurate in telling you if records are been retrieved.
Sascha Braun wrote:
$Query = "SELECT * FROM basket_db WHERE session_id = '$PHPSESSID'";
$Result = mysql_query($Query, $connect);
if ($Result) {
while ($arrResult = mysql_fetch_array($Result, MYSQL_ASSOC)) {
echo '<tr bgcolor="#fffdd7" class="text01">'; echo '<td>'.$arrResult['image_id'].'</td>';
echo '<td>'.$arrResult['name'].'</td>';
echo '<td><a class="text01" href="'.$PHP_SELF.'?action=delete&id='.$arrResult['id'].'">delete</a></td>';
echo '<td> Hier Preis'.$arrResult[''].'</td>';
echo '<td> hier gesamt'.$arrResult[''].'</td>';
echo '</tr>';
} } else {
echo '<tr bgcolor="#fffdd7" class="text01">';
echo '<td colspan="5">There are no Artikles in Cart.</td>';
echo '</tr>';
}
This script is not doing what I want it too!
Ich want to see : There are no Artikles in Cart
when there are no Artikels in Cart
But it good damn doesn't work!
Please tell me why