Hello guys,
So I wrote this code that fetch data from mysql table:
while($row = mysql_fetch_array($result))
{
$src = '';
switch( $row['speed'] ) {
case 'fast':
$src = 'fast.png';
break;
case 'slow':
$src = 'slow.png';
break;
default:
$src = 'default.jpg';}
}
}
echo "<tr>";
echo "<td><a href='http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF'])."/hits.php?id=".$row['id'] . "'>".$row['proxy']."</a></td>";
echo "<td>" . $row['hits'] . "</td>";
echo "<td>" . $row['age'] . "</td>";
echo "<td>" . $row['country'] . "</td>";
echo "<td><img src=\"". $src."\" /></td>";
echo "</tr>";
}
echo "</table>";
Now I need to add one more column called "icons" and i don't know how to implement it inside of that WHILE loop.
It should be something like:
while($row = mysql_fetch_array($result))
{
$src = '';
switch( $row['speed'] ) {
case 'fast':
$src = 'fast.png';
break;
case 'slow':
$src = 'slow.png';
break;
default:
$src = 'default.jpg';}
{
$ico = '';
switch( $row['icon'] ) {
case 'icon1':
$ico = 'icon1.png';
break;
case 'icon2':
$ico = 'icon2.png';
break;
default:
$ico = 'icondefault.jpg';}
}
}
echo "<tr>";
echo "<td><a href='http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF'])."/hits.php?id=".$row['id'] . "'>".$row['proxy']."</a></td>";
echo "<td>" . $row['hits'] . "</td>";
echo "<td>" . $row['age'] . "</td>";
echo "<td>" . $row['country'] . "</td>";
echo "<td><img src=\"". $src."\" /></td>";
echo "<td><img src=\"". $ico."\" /></td>";
echo "</tr>";
}
echo "</table>";
So , variable $src does work but variable $ico doesn't work and Im not even sure if is possible to use that $ico variable but i hope you can help me.
I hope you can help me and sorry for huge code but that's simplest way I could explain my problem
Thanks in advance!