Hello!
I have just started with PHP and MySQL. I don't have it on my computer and am using my web space proveder (uksecurewebhosting.net). When creating a table it appears like a form with the usual feilds (feild, type, length/set, attributes, null, default, extra) I have an exisitng table that has the following fields:
link, varchar (50), NULL, (Default)image.jpg (name of file not the actual picture)
hotel, varchar (50), NOT NULL,Primary Key
location, varchar (50), NULL,
rating, varchar (10), NULL,
price, varchar (10), NULL,
When I call up the data I wanted the default image (image.jpg) to appear if no other image is stated. But as it runs now, no image appears (just a broken image).
When I enter new data all the fields appear on screen with blank boxes next to them and I just enter the data I want to show (leaving the 'link' field blank if I want the default image to display). My test web page is
www.galesjam.co.uk/text/hotels.php where you can see the one image that doesn't display.
The code I am using is (a partialy sortable table - just starting!):
<html>
<head>
</head>
<body bgcolor=#00184A>
<br><br><br><br>
<table align="center" width=60%
border=0 rules=none
bordercolorlight="white" bordercolordark="white"
cellpadding=2>
<tr>
<td colspan=5> <br><br>
</td>
<tr>
<tr>
<td align="Left"width=20%>Link</p>
</td>
<td align="Left"width=30%><A href="hotels.php"><p class="marked">Hotel</p></a>
</td>
<td align="Left"width=30%><p class="marked">Location</p>
</td>
<td align="Left"width=10%><p class="marked">Rating</p>
</td>
<td align="Left"width=10%><p class="marked">Price</p>
</td>
</tr>
<?php
$db_connection = mysql_connect ("localhost","XXXX","XXXX");
mysql_select_db ("XXXX");
$query = "select * from hotels order by hotel";
$query_result = mysql_query($query);
while ($Row = mysql_fetch_array($query_result)) {
Print ("<tr>\n");
Print ("<td align=left><img src=\"$Row[link]\" border=0></td>");
Print ("<td align=left>$Row[hotel]</td>");
Print ("<td align=left>$Row[location]</td>");
Print ("<td align=left>$Row[rating]</td>");
Print ("<td align=left>$Row[price]</td>");
Print ("</tr>");
}
mysql_free_result($query_result);
mysql_close();
?>
</table>
</body>
</html>
Any help/suggestions!?