Re: Describing mysql table

From: Date: Tue, 18 Sep 2001 21:26:38 +0000
Subject: Re: Describing mysql table
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-67748@lists.php.net to get a copy of this message
Hey I figured out my problem. Instead of using a foreach loop, I used a while loop and everything is cool man :). UPDATED CODE: $query = "DESCRIBE mpn_users"; $result = mysql_query($query); while ($data = mysql_fetch_array($result)){
        echo "$data[0],  $data[1],  $data[2]<br>";
} Gerard Samuel wrote:
Im trying to get results from a mysql command (describe tablename;) into php. I know about the php functions, but I would like the mysql nameing instead. Im trying like so $query = "DESCRIBE users"; $result = mysql_query($query); $array = mysql_fetch_array($result); foreach ($array as $data) {
        echo "$data[0], $data[1], $data[2]<br>";
} Im not getting the expected results like the mysql command line. What am I doing wrong... Thanks


« previous php.general (#67748) next »