salto Posted November 26, 2006 Share Posted November 26, 2006 Good morning,I am a bit stuck on formating the following query. The methods I have used in the past for getting results in tables werefor a single record return and don't seem to want to work. Can anyone suggest the appropriate method or point me in a direction of what functions I should be looking at?Thanks for any insight!Cheers.Spence[code]<?php$link = mysql_connect('server', 'sitam', 'password');if (!$link) {die('Not connected : ' . mysql_error());}// select the environmental database$dbvariable = 'environmental';// use dbvariable in case we need to use other db later.$db_selected = mysql_select_db($dbvariable, $link);if (!$db_selected) {die ('Can\'t connect to $dbvariable : ' . mysql_error());}$query = "SELECT * FROM res_v5 WHERE Canton LIKE '$canton_var' AND TIPO like '$landuse_var' AND Inunda LIKE '$proximity_var'";$result = mysql_query($query); if (!$result) {$message = 'Invalid query: ' . mysql_error() . "\n";$message .= 'Whole query: ' . $query;die($message);}if (mysql_num_rows($result) == 0) {echo "No rows found";exit;}$loop_num = 1;$space_val = "_";//this works, now testing foreach methodwhile ($row = mysql_fetch_assoc($result)) {echo $loop_num;echo $row["ID"];echo $row["Canton"];echo $row["TIPO"];echo $row["Inunda"];echo $space_val;$loop_num = $loop_num + 1;}print ('did I make it here');?>[/code] Quote Link to comment Share on other sites More sharing options...
Barand Posted November 26, 2006 Share Posted November 26, 2006 The usual way to format multiple rows is to use an HTML table. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.