Page 1 of 1

get mysql cell content

Posted: Fri Jun 22, 2007 2:43 pm
by giliat
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


hello
this is a part of my php-mysql script :

Code: Select all

$fileds[6]= "location_name";
$fileds[5]= "location_kategory";
$fileds[4]= "location_stars";
$fileds[3]= "location_area";
$fileds[2]= "location_city";
$fileds[1]= "location_telephone";
$fileds[0]= "location_mail";


while ($row = mysql_fetch_array($result))
{

echo "<TR>";
echo "<TD>",$row[$fileds[0]],"</TD><TD>",$row[$fileds[1]],"</TD><TD>",$row[$fileds[2]],"</TD><TD>",$row[$fileds[3]],"</TD><TD>",$row[$fileds[4]],"</TD><TD>",$row[$fileds[5]],"</TD><TD>",$row[$fileds[6]],"</TD>";
echo "</TR>";
}
its work fine, but insted of $fileds[4]="location_stars"; that display a number 1-6 from the mysql query, i whant it to display an image
i try "<img src=../images/star_",$fileds[4],".gif/>"; but the result display images/star_location_stars.gif/; and i need it to display somthing loke this: if the location_stars cell content is 2= images/star_2.gif/;


thanks
:roll:


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Fri Jun 22, 2007 3:14 pm
by superdezign

Code: Select all

foreach($fields as $id => $data)
{
    echo '<img src="../images/star_' . $id . '.gif" />';
}
That should get you started.

Posted: Sun Jun 24, 2007 8:57 am
by Gente
mysql_fetch_assoc() should helps