crims0nluv Posted November 28, 2007 Share Posted November 28, 2007 Hello~ I have been trying to insert the post data into the database together with other some other information, but i couldn't seem to be able to insert it. I hope you all can help me Here is my coding. $this->post = $GLOBALS[HTTP_POST_VARS]; if (count($this->post)) { $item=$this->post; foreach ($item as $value) echo ($value.'<br>'); $tstring = implode(',' , $item); $item_query=INSERT INTO idea_bank ($item) VALUES ('$tstring'); mysql_query ($item_query); Other than this, I would like to insert another value which is $cid=$_GET['cid']; So I would to insert this to. how do I go about?? Thanks!!! Quote Link to comment https://forums.phpfreaks.com/topic/79204-insert-array-into-database/ Share on other sites More sharing options...
subcool Posted November 28, 2007 Share Posted November 28, 2007 i'd use, since i assume its 1 single post, this: if (isset($_POST['some_key_value'])) { mysql_query("INSERT INTO `table` SET `value` = '".$_POST['value']."', `othervalue` = '".$_POST['othervalue']."', `cid` = '".$_GET['cid']."';"); } right now you're making 1 new row for each value posted to your script o_O Quote Link to comment https://forums.phpfreaks.com/topic/79204-insert-array-into-database/#findComment-401058 Share on other sites More sharing options...
crims0nluv Posted November 30, 2007 Author Share Posted November 30, 2007 ohh i see. =) How is it if I want to insert the whole junk into database, without going through to insert one value by one value? Is it possible? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/79204-insert-array-into-database/#findComment-402699 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.