Hello,
I created a simple database. All this database does is store links of files which were uploaded from the user. A sample of the link is stated below;
d:/mysql/data/uploads/image011.jpg
Now, how do I retrieve this link so that it can be read and display the image on screen (ie. php or html file)?
I was trying the use the code below but the image does nt come up;
<?php
$db=mysql_connect("lanycomputer","someuser",""
or die("Could not connect : " . mysql_error());
print "Connected successfully";
print "<br>";
print "<center><h2><b>My Picture</b></h2></center>";
mysql_pconnect();
mysql_select_db("myimages" or die("Could not select database"
$query = "SELECT * FROM myimage";
$result = mysql_query($query) or die("Query failed : " . mysql_error());
/* Printing results in HTML */
print "<br>";
print "<table width=75% border=1>\n";
print "<td width=14%><b>UserID</b></td>";
print "</tr>";
print "</table>";
while ($row= mysql_fetch_array($result))
{
print "<table width=75% border=1>\n";
print "<td width=8%>";
I THOUGHT READFILE() WOULD WORK
readfile("c:/mysql/data/mylogin/image2.jpg"
print $row["imagefilepath"];
print "<img src='$row[imagefilepath]'>";
print "</td>";
I tried using the three commands listed above to see if I could get a display. But I was not successful.
Using readfile just makes the browser hang.
Any assistance would be appreciated.
Thanks,
KJ
I created a simple database. All this database does is store links of files which were uploaded from the user. A sample of the link is stated below;
d:/mysql/data/uploads/image011.jpg
Now, how do I retrieve this link so that it can be read and display the image on screen (ie. php or html file)?
I was trying the use the code below but the image does nt come up;
<?php
$db=mysql_connect("lanycomputer","someuser",""
or die("Could not connect : " . mysql_error());
print "Connected successfully";
print "<br>";
print "<center><h2><b>My Picture</b></h2></center>";
mysql_pconnect();
mysql_select_db("myimages" or die("Could not select database"
$query = "SELECT * FROM myimage";
$result = mysql_query($query) or die("Query failed : " . mysql_error());
/* Printing results in HTML */
print "<br>";
print "<table width=75% border=1>\n";
print "<td width=14%><b>UserID</b></td>";
print "</tr>";
print "</table>";
while ($row= mysql_fetch_array($result))
{
print "<table width=75% border=1>\n";
print "<td width=8%>";
I THOUGHT READFILE() WOULD WORK
readfile("c:/mysql/data/mylogin/image2.jpg"
print $row["imagefilepath"];
print "<img src='$row[imagefilepath]'>";
print "</td>";
I tried using the three commands listed above to see if I could get a display. But I was not successful.
Using readfile just makes the browser hang.
Any assistance would be appreciated.
Thanks,
KJ