RE: [PHP-DB] Re: CSV update Mysql feature

2004-06-01 Thread Kenny
Well the problem is how would I create the query?



-Original Message-
From: Uzi Klein [mailto:[EMAIL PROTECTED] 
Sent: 01 June 2004 07:36
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: CSV update Mysql feature

It's kinda clear.
What isn't clear is what the problem?

Kenny [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 hi all,

 What I am trying to achieve to no avail is the following

 I export values from a Mysql db into CSV format for quick updates and
 that works fine..

  http://www.xarex.com/jantar/admin/pick_csv.php
 www.xarex.com/jantar/admin/pick_csv.php

 But as you can see from the page you can select the options that you
 want to d/l
 I am going to make ID compulsory but its not necessary for the time
 being,

 The problem that I am having is with the update Mysql feature
 What I need to happen is the first line of the CSV is the headings (db
 field names)
 So that when I do the update it only updates the fields that were
chosen
 on the pick_csv page.
 Now I will have no way of knowing before hand what fields will be
chosen
 so I will have to create the update Mysql query on the fly,

 I hope this is clear enough

 any help will be great

 K-



-- 
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



RE: [PHP-DB] Re: CSV update Mysql feature

2004-06-01 Thread David Robley
Kenny wrote:

 Well the problem is how would I create the query?
 
 
 
 -Original Message-
 From: Uzi Klein [mailto:[EMAIL PROTECTED]
 Sent: 01 June 2004 07:36
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Re: CSV update Mysql feature
 
 It's kinda clear.
 What isn't clear is what the problem?
 
 Kenny [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 hi all,

 What I am trying to achieve to no avail is the following

 I export values from a Mysql db into CSV format for quick updates and
 that works fine..

  http://www.xarex.com/jantar/admin/pick_csv.php
 www.xarex.com/jantar/admin/pick_csv.php

 But as you can see from the page you can select the options that you
 want to d/l
 I am going to make ID compulsory but its not necessary for the time
 being,

 The problem that I am having is with the update Mysql feature
 What I need to happen is the first line of the CSV is the headings (db
 field names)
 So that when I do the update it only updates the fields that were
 chosen
 on the pick_csv page.
 Now I will have no way of knowing before hand what fields will be
 chosen
 so I will have to create the update Mysql query on the fly,

 I hope this is clear enough

 any help will be great

I haven't looked at your page; but the general idea would be to test what
options are selected and dynamically build your query accordingly. Eg,
assuming your info is coming from POST:

$query = SELECT id;
if(isset($_POST['name'])) { $query .= , name; }
// more of the same for each field
$query .=  FROM table WHERE where ORDER BY whatever;

Or something like that. Then you output in csv format with echo or print or
sprintf or whatever

-- 
David Robley

Don't hate yourself in the morning - sleep till noon.

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