Posted by Captain Paralytic on 11/07/06 10:09
strawberry wrote:
> You're quite right, of course! Call me a dummie if you like but the
> only way I could think of resolving that was to ask again whether or
> not $key = 'name'
> This doesn't look very elegant but it looks like it might work. I'll
> turn the echoes into real mysql statements and see what happens. Maybe
> I don't have to bother with the implosion
> I described. I guess it just means more INSERT statements - but so
> what, right?
Nah, I won't call you a dumie, but I will suggest that what you may
want to do is to change the innermost if statement to something like
this:
if ($key == 'name') {
$table = $value;
} elseif {
($key == 'ID') {
echo "INSERT INTO $table (ID) VALUES ('$value')<BR>\n";
} else {
echo "INSERT INTO $table ($key) VALUES ('$value') UPDATE ON
DUPLICATE KEY<BR>\n";
}
[Back to original message]
|