Jump to content

Recommended Posts

[!--quoteo(post=345456:date=Feb 13 2006, 02:43 PM:name=ITStudent)--][div class=\'quotetop\']QUOTE(ITStudent @ Feb 13 2006, 02:43 PM) [snapback]345456[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Is it possible to insert the values of an array into a table, with each value being stored in a new row.

I need to take the value of the array select information from a table based on this and then insert to the second table.

Thanks.
[/quote]

i'm not sure i follow what you're asking. the simple answer to your question is yes, you can store each value in an array in a new row. something like this is all you need:
[code]
<?php
$q = "INSERT INTO tableName (colName) VALUES ";
foreach ($array as $value)
  $q .= "('$value'), ";

$q = substr($q, 0, strlen($q) - 2);
mysql_query($q);
?>
[/code]
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.