Jump to content

[SOLVED] Issue with a simple select statement


owen.aaron

Recommended Posts

Im not sure if this is a php or mysql issue honestly. Im trying to set up a basic call from a MySQL DB. I have added the lines,

 

if (!$link) {

die('Could not connect: ' . mysql_error());

}

echo 'Connected successfully';

 

In the connect string so I can see the bd is connected but no data is displayed. The output of this code can be found here http://kerseyre.com/waterfront.php, if anyone can help me find the error of my ways it would be greatly appreciated =)

 

<?php
include('dbconnect.php');



	$query=mysql_query("SELECT * FROM Property ORDER by price");
	while($fetch=@mysql_fetch_array($query)) {
	$waterfront.="
	<td width='200' bgcolor='8BA446'>$fetch[address]</td><td width='75' bgcolor='8BA446'>$fetch[acreage]</td><td width='100' bgcolor='8BA446'><p>$</p>$fetch[price]</td><td width='125' bgcolor='8BA446'>Pictures</td>";
	}
print "	
</html>		
<head></head>

<body bgcolor='FEF1B5'>

<center>
<table border='1' cellpadding='0' cellspacing='1'  bordercolor='4F4F2F'>
<tr>
	<td colspan='4' bgcolor='458B00'><center><div style='font-size:20;font-weight: bold;' >County</div></center></td>
</tr>
<tr>
	<td width='200' bgcolor='8BA446'>Address</td>
	<td width='75' bgcolor='8BA446'>Acreage</td>
	<td width='100' bgcolor='8BA446'>Price</td>
	<td width='125' bgcolor='8BA446'>Pictures</td>
</tr>
	<tr>
$waterfront

</tr>
</table>
</center>

</body>
</html>";

?>

Thought i would add the DB info,

 

version 5.0.24a

table setup...

 

Field Type Null Default

address  text No     

type  text No     

lot_number  smallint(6) No     

acreage  smallint(6) No     

picture1  text No     

id  tinyint(4) No     

price  mediumint(10) No  0   

 

 

Indexes: Keyname Type Cardinality Field

PRIMARY  PRIMARY 2  id 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.