For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > July 2006 > Insert (MySql) tablename $field, $value problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Insert (MySql) tablename $field, $value problem
Frits v/d Laan

2006-07-23, 6:56 pm

Hi

Can you help me on this.

I have a table and want to save old data - before changing or
deleting them- into another table

I have tried it several ways without any result

Both the fieldnamearray and Values arrays looked allright when written
to a file and the only problem is the INSERT using $VARs

$fields = "mysql_num_fields($result) ";
$sep=''; // komma separator

for ($i=0; $i < $fields; $i++) {
$name = mysql_field_name($result, $i);
$fieldname= "$sep $name";
$oldvalues= "$sep $oldvalue[i]";
INSERT INTO ex_leden ($fieldname) VALUES ($values);
$sep=",";
}


Thanks
Frits v/d Laan
NL


INSERT INTO Mytable ($fieldname) VALUES ($value);

Frits v/d Laan
Biologische tuinplanten kwekerij
http://fvanderlaan.nl
Janwillem Borleffs

2006-07-23, 6:56 pm

Frits v/d Laan wrote:
> $fields = "mysql_num_fields($result) ";
>


This way, $fields will evaluate to 0 in the following loop; surely, you
mean:

$fields = mysql_num_fields($result);


JW


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com