Hi Oliver,
below is what I used.
----------------------------------------------------
<?
mysql_con();
$insert_q = "INSERT INTO DB1 VALUES(";
$query = "SELECT * FROM vorlauf WHERE satz_nr = '$fzg_id' LIMIT 1";
$doit = mysql_query($query);
$data = mysql_fetch_assoc($doit);
for($i=0; $i<=126; $i++) {
$fieldname = mysql_field_name($doit, $i);
$value = $data[$fieldname];
if($value == "") {
$value="0";
}
if($fieldname == "lfd_id") {
$value="";
}
echo $fieldname." --> ".$value."<br>";
$titel = $fieldname;
$insert_q .= ",'$value'";
}
$insert_q = $insert_q.')';
$insert_q = eregi_replace("\(,","(", $insert_q);
echo "<p>";
echo $insert_q;
mysql_query($insert_q) or die(mysql_error());
echo "Yup";
$del_q = "DELETE FROM vorlauf WHERE satz_nr = '$fzg_id' LIMIT 1";
$do_del = mysql_uery($del_q);
?>
------------------------------------------------
I'm sure there are better ways to do the whole thing :o) But as long as I
need to cpy one record at a time, I don't really care much for speed. I just
put all the stuff into a string and then use that string as query for the
insertion into the second database.
Scripts like that make me feel good when I say "You can be dumb as heck, ás
long as you find a way to resolve your problems" :o) It works, and it took
me just about 10 minutes of research and another 10 of writing :o)
Hope your weather is just as good as ours here...
All the best!
Chris
----- Original Message -----
From: "Oliver Block" <lists@xxxxxxxxxxxxxxx>
To: <php-general@xxxxxxxxxxxxx>
Cc: "Christian Haensel" <php@xxxxxxxxx>
Sent: Monday, April 30, 2007 1:11 PM
Subject: Re: PHP & MySQL -> Field Title
Am Montag, 30. April 2007 07:47 schrieb Christian Haensel:
but now I have the problem with the field names and all... can someone
point me into the right direction?
<http://www.php.net/manual/de/ref.mysql.php>
php-db at lists.php.net
If you need to use an assoc array, use the following SQL Syntax:
INSERT INTO new_table SET key0=value0, key2=value2, ...,
Regards,
Oliver
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php