Hi I have completed the upload file part of my website... Now I want to let users view the file they uploaded...
So I created a table and Wanted to view the file through img src tag.. but it is not working...
In the database, I add the file path but in my directory it is added as a jpeg??
Here is my code
So I created a table and Wanted to view the file through img src tag.. but it is not working...
In the database, I add the file path but in my directory it is added as a jpeg??
Here is my code
Code:
<table border="1" cellspacing="2" cellpadding="2">
<tr>
<th><font face="Arial, Helvetica, sans-serif">School</font></th>
<th><font face="Arial, Helvetica, sans-serif">Site</font></th>
<th><font face="Arial, Helvetica, sans-serif">Address</font></th>
<th><font face="Arial, Helvetica, sans-serif">Address 2</font></th>
<th><font face="Arial, Helvetica, sans-serif">City</font></th>
<th><font face="Arial, Helvetica, sans-serif">State</font></th>
<th><font face="Arial, Helvetica, sans-serif">Phone</font></th>
<th><font face="Arial, Helvetica, sans-serif">Email</font></th>
<th><font face="Arial, Helvetica, sans-serif">Photo</font></th>
</tr>
<?php
//set your connection string
$username="whhhhh;
$password="whhhh";
$database="whhhh";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
//place your query statement into a variable string
$query="Select * from school ";
//for execution $result variable will place the string for querying purposes
$result=mysql_query($query);
//how many rows does the above query bring up
$num=mysql_numrows($result);
//close if there is no recordsets
mysql_close();
echo "<b><center>MMA Schools</center></b><br><br>";
//loop through the recordset
$i=0;
while ($i < $num) {
//assign each field to a variable
//$variable=mysql_result($result,$i,"fieldname");
$school = mysql_result($result,$i,"name");
$site = mysql_result($result,$i,"site");
$address= mysql_result($result,$i,"street");
$street2= mysql_result($result,$i,"street2");
$city = mysql_result($result,$i,"city");
$state= mysql_result($result,$i,"state");
$phone= mysql_result($result,$i,"phone");
$email= mysql_result($result,$i,"email");
$photo= mysql_result($result,$i,"photo");
?>
<tr>
<td><font face="Arial, Helvetica, sans-serif"><? echo $school; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><a href="[URL unfurl="true"]http://<?[/URL] echo $site; ?>" class="lightwindow"><? echo $site; ?></a></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $address; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $street2; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $city; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $state; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $phone; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $email; ?></font></td>
<td><img src="mmaxtra.com/<? echo $photo; ?>"></td><==NOT WORKING
</tr>
<?
$i++;
}
echo "</table>";