Thanks Cam,
That was what i was trying to figure out.... i just didnt see it
Best regards,
Davy Obdam
mailto:[EMAIL PROTECTED]
Cam Dunstan wrote:
Davy
put this into a script and run it .......
$dbase = "somedatabase"; // change this to suit !!
$db = mysql_connect("localhost", "root"); // change this also!!
mysql_select_db($dbase,$db);
$result = mysql_list_tables($dbase);
$rowcount = mysql_num_rows($result);
for ($j = 0; $j < $rowcount; $j++){
$tablenam = mysql_tablename($result, $j);
echo "<strong>".$tablenam."</strong> (";
$fieldresult = mysql_list_fields($dbase, $tablenam);
$fieldcount = mysql_num_fields($fieldresult);
echo $fieldcount." fields)<br>\n";
for ($k = 0; $k < $fieldcount; $k++){
$fieldnam = mysql_field_name($fieldresult, $k);
echo " ".$fieldnam." <small>";
$fieldtyp = mysql_field_type($fieldresult, $k);
echo $fieldtyp." (";
$fieldsiz = mysql_field_len($fieldresult, $k);
echo $fieldsiz.") </small><br>\n";
}
echo "<hr>\n";
}
that should tell you everything you need to know about your database and how
to do it.
----- Original Message -----
From: "Davy Obdam" <[EMAIL PROTECTED]>
To: "PHP-WIN" <[EMAIL PROTECTED]>; "PHP" <[EMAIL PROTECTED]>
Sent: Monday, February 03, 2003 5:24 AM
Subject: [PHP-WIN] Looping through the mysql_field_name function
Hi ppl,
I have a problem that probably very simple, but i cannot figure it out
right now....
I need to get the field names of my database. I have a query like select
* from books and now i wanna have both the result and the field name. I
have been trying with mysql_field_name, but not succesfully...
$i = 0;
for($a=0; $a < sizeof(mysql_field_name($db->sqlResult, $i)); $a++) {
echo mysql_field_name($db->sqlResult, $i)."<br />";
$i++;
}
Can anyone help me please.. Your help is greatly appreciated;-)
Best regards,
Davy Obdam
mailto:[EMAIL PROTECTED]
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
--------------------------------------------------------------------
Davy Obdam - Obdam webdesignŠ
mailto:[EMAIL PROTECTED] web: www.davyobdam.com
--------------------------------------------------------------------
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php