Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.
Moderator: General Moderators
razarac
Forum Newbie
Posts: 2 Joined: Tue Jan 26, 2010 1:30 pm
Post
by razarac » Tue Jan 26, 2010 1:36 pm
hi all,
I'am new in PHP, and i have problem with pictures...if u can tell me how can i pull picture from data base(picture is stored in DB as path to picture)
code:
Code: Select all
$con=mysql_connect("localhost","root","");
mysql_select_db("aiesec", $con); // odabir baze
$result=mysql_query("SELECT * FROM prakse");
$counter=0;
while($row=mysql_fetch_array($result)){
$counter++;
if ($counter%2==0){
$add=" class=\"alt\">";
}else{
$add=">";
}
echo " <tr>\n";
echo " <td" . $add . $row['praksa'] . "</td>\n";
echo " <td" . $add . $row['PICTURE'] . "</td>\n";
echo " </tr>\n";
}
?>
this gets me only that txt from table, I tryed something but didnt make it...
i'am working in dreamweaver cs3
thx all
Luke
The Ninja Space Mod
Posts: 6424 Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA
Post
by Luke » Tue Jan 26, 2010 10:27 pm
Please use our php tags when you post code. I have updated your post to reflect how we'd like it posted in the future.
To answer your question, you need to use an img html tag. Do something like this instead:
Code: Select all
echo " <tr>\n";
echo " <td" . $add . $row['praksa'] . "</td>\n";
echo " <td" . $add . " <img src='" . $row['PICTURE'] . "' alt='Picture name'></td>\n";
echo " </tr>\n";
razarac
Forum Newbie
Posts: 2 Joined: Tue Jan 26, 2010 1:30 pm
Post
by razarac » Wed Jan 27, 2010 3:19 am
ty very much it works now
and I'am sry I didnt see this PHP tag