Jump to content

Recommended Posts

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!!!

 

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/79204-insert-array-into-database/
Share on other sites

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.