RE: need help with SHOW COLUMNS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I think you may want to loop over $row=mysql_fetch_array($result), each
row should have the name of the field, and some additional info about it
(I just ran a SHOW COLUMNS query on my log tables in my last post, that
should give you an idea of what the output is), try executing the query
in the mysql client, the top row of the output will be the names of the
fields of the array....

So try:
while($row = mysql_fetch_array ($result)){
   var_dump($row);
}

to see what the db is returning, and access it accordingly.

-- Josh


-----Original Message-----
From: David Rice [mailto:haloplayer@hotmail.com] 
Sent: Tuesday, November 05, 2002 10:12 AM
To: php-db@lists.php.net
Subject:  need help with SHOW COLUMNS


I am tryin to create a DBMS,

the part of my code that is currently causing a problem is

mysql_select_db("filterseveuk") or die(mysql_error());
   $query = "SHOW COLUMNS FROM " .$table. "";

   $result =  mysql_query ( $query ) or die( mysql_error () );

   $numrows = mysql_num_rows ($result);

   $row = mysql_fetch_array ($result);

   for($x=0; $x <= $numrows; $x++){

    echo $row[$x] ;

   }
It produces the error

user_idint(11)PRIauto_increment

The output i want to obtain from this query is that php prints out a
list of 
the field names.
I don't know why this is not working
How do i get it to only display the column names!?

_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online 
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux