Hi everyone
I was working on a php script to display images and I am running into
problems. My problems are when I execute the query to thumb path it won't
display the image/s.
Anyhelp is alway's appreciated
I have a mysql table with the following structure
image_id Integer Auto_increment
title varchar
descript text
thumb_path varchar
imaage_path varchar
category_id Integer
and my script
<html>
<body>
<?php
$link = @mysql_connect( "localhost" , "myuser", "mypass");
if (!$link) {
print "Could not connect to server";
exit;
}
if (!@mysql_select _db("photos_db" )) {
print "Could not select database";
exit;
}
$query1 = "SELECT * FROM categories";
$query2 = "SELECT * FROM images ORDER BY image_id DESC";
$result1 = mysql_query($qu ery1);
$result2 = mysql_query($qu ery2);
?>
<table width="700" bgcolor="#CCCCC C">
<tr>
<td width="700" align="center" valign="middle" height="50">
<?php
if ($result1 && @mysql_num_rows ($result1) > 0) {
$data1 = "";
while ($row1 = mysql_fetch_arr ay($result1)) {
$data1 .= '<font color="black" size="14">';
$data1 .= $row1['category_descr iption'];
}
echo $data1;
}
?>
</td>
</tr>
<?php
//here is where I am running into problems
//it does not want to display the image even though I specify the path
if ($result2 && @mysql_num_rows ($result2) > 0) {
$data2 = "";
while ($row2 = mysql_fetch_arr ay($result2)) {
$data2 .= $row2['thumb_path'];
?>
<td><img src="<?php echo "$data2";?> "></td>
<?php
}
}
?>
</tr>
</table>
</body>
</html>
I was working on a php script to display images and I am running into
problems. My problems are when I execute the query to thumb path it won't
display the image/s.
Anyhelp is alway's appreciated
I have a mysql table with the following structure
image_id Integer Auto_increment
title varchar
descript text
thumb_path varchar
imaage_path varchar
category_id Integer
and my script
<html>
<body>
<?php
$link = @mysql_connect( "localhost" , "myuser", "mypass");
if (!$link) {
print "Could not connect to server";
exit;
}
if (!@mysql_select _db("photos_db" )) {
print "Could not select database";
exit;
}
$query1 = "SELECT * FROM categories";
$query2 = "SELECT * FROM images ORDER BY image_id DESC";
$result1 = mysql_query($qu ery1);
$result2 = mysql_query($qu ery2);
?>
<table width="700" bgcolor="#CCCCC C">
<tr>
<td width="700" align="center" valign="middle" height="50">
<?php
if ($result1 && @mysql_num_rows ($result1) > 0) {
$data1 = "";
while ($row1 = mysql_fetch_arr ay($result1)) {
$data1 .= '<font color="black" size="14">';
$data1 .= $row1['category_descr iption'];
}
echo $data1;
}
?>
</td>
</tr>
<?php
//here is where I am running into problems
//it does not want to display the image even though I specify the path
if ($result2 && @mysql_num_rows ($result2) > 0) {
$data2 = "";
while ($row2 = mysql_fetch_arr ay($result2)) {
$data2 .= $row2['thumb_path'];
?>
<td><img src="<?php echo "$data2";?> "></td>
<?php
}
}
?>
</tr>
</table>
</body>
</html>
Comment