Re: changing output method
| From: | chintan | Date: | Tue, 01 Mar 2005 08:54:44 +0000 |
| Subject: | Re: changing output method | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-38721@lists.php.net to get a copy of this message | ||
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 | |+--------------+--------------+------+-----+---------+-------+