Getting Data From Multiple Rows in PHP & MySQL -
i have university assignment have create dynamic gallery website using php , mysql, , idea create portfolio myself, have not done php in past , struggling bit getting work.
basically, want 'thumbnail' row each column in table below , display them separate images, can seem first column's image in table display, therefore if knows how can multiple display, of great help.
http://i.gyazo.com/00dde8157ba75ecd81cc52ca59effa32.png
here code:
$result = mysql_query($queryselect); //-------------- store content id = 1 in array -------------- ------------------- $row = mysql_fetch_array($result); //---------------- display results in html ----------------------------------------------------- ?> <?php echo "<img src=\"" .$row["thumbnail"]."\"/>";?>
note: there code above connect database.
try this:
$result = mysql_query($queryselect); //-------------- store content id = 1 in array -------------- ------------------- while($row = mysql_fetch_array($result)){ //---------------- display results in html ----------------------------------------------------- ?> <!-- part works same normal html --> <img src="<?=$row["thumbnail"]?>"> <!-- can add <br> tag or else ... <?=$vvar?> php shorthand echo method --> <? } ?>
but seeing comment:
//-------------- store content id = 1 in array -------------- -------------------
i dont id if want multiple images. other way.
like if want images uploaded try,
select * `imgtable` `uploadedby` = 'admin'
as sql query
note: recommend use mysqli_
instead of mysql_
mysql_
depricated.
Comments
Post a Comment