Re: $HTTP_POST_VARS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

http://www.php.net/manual/en/function.serialize.php

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?

-Micah


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 (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux