dark22horse Posted April 24, 2007 Share Posted April 24, 2007 Hi guys, thanks for your help before. But im back again, with more problems. I am trying to get pictures out of my database, they are not actually pictures in the database, but I think just a reference to them. I will show in my code. This is my PHP page I using to display them. <? //connect to mysql //change user and password to your mySQL name and password mysql_connect("localhost","root",""); //select which database you want to edit mysql_select_db("car"); //select the table $result = mysql_query("select * from car"); //grab all the content while($r=mysql_fetch_array($result)) { //the format is $variable = $r["nameofmysqlcolumn"]; //modify these to match your mysql table columns $price=$r["price"]; $description=$r["description"]; $photo=$r["photo"]; //display the row echo "$price"; echo "$description"; echo "$photo"; } ?> This is the information that is displayed from the php page. £150000this is a expensive114369546_58f1ef86b6_m.jpg$510000this is a description 461738934_0b4c73e6d9_m.jpg£222222here461738934_0b4c73e6d9_m.jpg I know this is not very well organised, but I want to get the thing working before i make it look good. cheers Link to comment https://forums.phpfreaks.com/topic/48496-solved-showing-pictures-from-a-mysql-database/ Share on other sites More sharing options...
shaunrigby Posted April 24, 2007 Share Posted April 24, 2007 Change: <? //connect to mysql //change user and password to your mySQL name and password mysql_connect("localhost","root",""); //select which database you want to edit mysql_select_db("car"); //select the table $result = mysql_query("select * from car"); //grab all the content while($r=mysql_fetch_array($result)) { //the format is $variable = $r["nameofmysqlcolumn"]; //modify these to match your mysql table columns $price=$r["price"]; $description=$r["description"]; $photo=$r["photo"]; //display the row echo "$price"; echo "$description"; echo "$photo"; } ?> To: <? //connect to mysql //change user and password to your mySQL name and password mysql_connect("localhost","root",""); //select which database you want to edit mysql_select_db("car"); //select the table $result = mysql_query("select * from car"); //grab all the content while($r=mysql_fetch_array($result)) { //the format is $variable = $r["nameofmysqlcolumn"]; //modify these to match your mysql table columns $price=$r["price"]; $description=$r["description"]; $photo=$r["photo"]; //display the row echo "$price"; echo "$description"; echo "<img src='path/to/images/$photo' alt='' />"; //You need to implement the IMG tag } ?> Link to comment https://forums.phpfreaks.com/topic/48496-solved-showing-pictures-from-a-mysql-database/#findComment-237167 Share on other sites More sharing options...
dark22horse Posted April 24, 2007 Author Share Posted April 24, 2007 thats is great mate cheers!!!!! I was sooo close, yet sooo far!!!! Link to comment https://forums.phpfreaks.com/topic/48496-solved-showing-pictures-from-a-mysql-database/#findComment-237180 Share on other sites More sharing options...
shaunrigby Posted April 24, 2007 Share Posted April 24, 2007 k Link to comment https://forums.phpfreaks.com/topic/48496-solved-showing-pictures-from-a-mysql-database/#findComment-237194 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.