Onbekend |
|
deze werkt wel:
<?php
$query = mysql_query("SELECT name, description FROM products WHERE name LIKE '%".$_GET['sid']."%' ORDER BY name ASC LIMIT 0,24");
echo "<table width=\"100%\">";
$color = 0;
while($fetch = mysql_fetch_array($query))
{
$nColor = ($color++ %2 == 0) ? "#FFCCCC" : "FF0066";
echo "<tr><td class=\"coloredtext\" bgcolor=\"".$nColor."\">".substr($fetch['name'], 0, 10)."</td><td class=\"coloredtext\" bgcolor=\"".$nColor."\">".substr($fetch['description'], 0, 60)."</td></tr>";
}
echo "</table>";
?>
<?php $query = mysql_query("SELECT name, description FROM products WHERE name LIKE '%".$_GET['sid']."%' ORDER BY name ASC LIMIT 0,24"); echo "<table width=\"100%\">"; $color = 0; { $nColor = ($color++ %2 == 0) ? "#FFCCCC" : "FF0066"; echo "<tr><td class=\"coloredtext\" bgcolor=\"".$nColor."\">".substr($fetch['name'], 0, 10)."</td><td class=\"coloredtext\" bgcolor=\"".$nColor."\">".substr($fetch['description'], 0, 60)."</td></tr>"; } ?>
Deze werkt niet (zelfde pagina):
<?php
$query = mysql_query("SELECT name, description FROM products WHERE name LIKE '%".$_GET['sid']."%' OR category LIKE '%".$_GET['sid']."%' ORDER BY name ASC LIMIT 25,48");
echo "<table width=\"100%\">";
$color = 0;
while($fetch = mysql_fetch_array($query))
{
$nColor = ($color++ %2 == 0) ? "#FFCCCC" : "FF0066";
echo "<tr><td class=\"coloredtext\" bgcolor=\"".$nColor."\">".substr($fetch['name'], 0, 10)."</td><td class=\"coloredtext\" bgcolor=\"".$nColor."\">".substr($fetch['description'], 0, 60)."</td></tr>";
}
echo "</table>";
<?php $query = mysql_query("SELECT name, description FROM products WHERE name LIKE '%".$_GET['sid']."%' OR category LIKE '%".$_GET['sid']."%' ORDER BY name ASC LIMIT 25,48"); echo "<table width=\"100%\">"; $color = 0; { $nColor = ($color++ %2 == 0) ? "#FFCCCC" : "FF0066"; echo "<tr><td class=\"coloredtext\" bgcolor=\"".$nColor."\">".substr($fetch['name'], 0, 10)."</td><td class=\"coloredtext\" bgcolor=\"".$nColor."\">".substr($fetch['description'], 0, 60)."</td></tr>"; }
Zelfde code alleen de LIMIT in de query is anders... |