0

Im new at PHP but learning fast,

I need help on getting the mysql result into the $imagedir value

//Select Query for images from db
$query="SELECT id, fld_imagename FROM tbl_banner";
$result = mysql_query($query) or die(mysql_error());   

//Loop to get path from query
while($row = mysql_fetch_array( $result )) 
{ 

$mydir = "imge_uploads/".$row['fld_imagename']. ",";?>

<?php } 

// Image directory - HERE THE RESULT MUST BE
$imageDir = $mydir;

Maybe im just a bit uneducated thus far .. lol $imageDir should get the path that is stored in mysql ...

This method does not work

ty
Mike

4
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by diafol
0

Ideally saying this code should work (just tried this). Are you sure, that SELECT query is returning any data.

Do one thing, write something like

echo "blabla..";

Inside the while loop to check if it is really returning any rows.

0

If you are expecting a single result, you don't need the while loop. Check for any result with mysql_num_rows().

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.