[PHP-DB] Dynamic Data

2004-06-07 Thread Christopher J. Crane
What is the best way to produce a report listing the fieldname and then the
data in that field. It is a report containing only one row from a table, but
I don't want to hard code the fields since they change often.

I can get the field names dynamically like this:

$fields = mysql_list_fields(Network, Subnets);
$num_columns = mysql_num_fields($fields);
for($ i = 0; $i  $num_columns; $i++) { echo mysql_field_name($fields,
$i); }

now is where I get confusedwhat I would like to happen is do a query on
a single row and put the results into mysql_fetch_assoc and during the prior
loop put the column name into the loop of the data. Something like:

$fields = mysql_list_fields(Network, Subnets);
$num_columns = mysql_num_fields($fields);
$result  =  mysql_query(SELECT * FROM table1 WHERE ID = '$ID';
$field = mysql_fetch_assoc($result)
for($ i = 0; $i  $num_columns; $i++) {
echo b . mysql_field_name($fields, $i) . : /b .
$field[mysql_field_name($fields, $i)] . br\n;

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



[PHP-DB] The New Guy

2002-01-13 Thread Christopher J. Crane

I do a lot of work with Perl and have decided to see what this PHP is all
about. The best way for me to do that, is to just do a project. Here is what
I am looking to do. I would like to use PHP and the SQL language on a CSV or
Flat File Database. A lot of my work is on unix system that people want to
work with Access. They do not want to pay the extra amount of money fora
MySQL database. The answer to this issue is access with exports to CSV files
for some of the simplier stuff like shopping carts and members and stuff
like that.

Here's the thing, can PHP interact with a flat file databse like perl and
the DBD::CSV? If so can someone point me in the right idrection to get
started. I have a server for development and it now has 4.0 PHP.



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]