as usual my database is in mysql and there are lots of records available i had wrote my script like this $link = mysql_connect("localhost", "chintan","hellomysql") or die("Could not connect"); mysql_select_db("chintan") or die("Could not select database");
$query = "SELECT * FROM stockiestandbookingagents"; $result = mysql_query($query) or die("Query failed");
$i=0; while($i<mysql_num_fields($result)) { echo (mysql_field_name($result, $i)); print "\t"; while ($line = mysql_fetch_array($result)) { foreach ($line as $col_value); } $i++; print "\t$col_value\n"; }
mysql_free_result($result); mysql_close($link);
but it just displays the pincode of the city only(the last column) the table structure is like below; +--------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------+--------------+------+-----+---------+-------+ | CompanyName | varchar(50) | | PRI | | | | AddressLine1 | varchar(100) | YES | | NULL | | | AddressLine2 | varchar(100) | YES | | NULL | | | City | varchar(50) | YES | | NULL | | | PostalCode | varchar(50) | YES | | NULL | | +--------------+--------------+------+-----+---------+-------+
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php