No, if you're trying to store an array in the database, use serialize();

Something like this:

$serialized_data = serialize($HTTP_POST_VARS);
$serialized_data = addslashes($serialized_data);

mysql_query("INSERT INTO ads (post_vars, createdate)
        VALUES ('$seralized_data', '$today')");

When you pull the data back out, stripslashes() and then unserialize and
you'll get your array back. Make sure your database field is typed
correctly, blob should work. 

Alternativley, you could step through the array and store a separate
record for each value/key. That kind of seems like what you're trying in
your code, but don't you want $value rather than $key?


On Mon, 2003-01-27 at 22:43, Addison Ellis wrote:
> hello,
>       will this work?
> $sql = "INSERT INTO ads ($HTTP_POST_VARS,createdate)
>              VALUES ('$key','$today')";
> mysql_query($sql);
> i have this at the top:
> foreach ($HTTP_POST_VARS as $key => $value)
> thanks again, addison ellis

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to