get mysql cell content

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
giliat
Forum Commoner
Posts: 28
Joined: Sun May 20, 2007 2:00 pm

get mysql cell content

Post 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]
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Code: Select all

foreach($fields as $id => $data)
{
    echo '<img src="../images/star_' . $id . '.gif" />';
}
That should get you started.
User avatar
Gente
Forum Contributor
Posts: 252
Joined: Wed Jun 13, 2007 9:43 am
Location: Ukraine, Kharkov
Contact:

Post by Gente »

mysql_fetch_assoc() should helps
Post Reply