Jump to content

Recommended Posts

i have stored arrayed fields into the database... i want to create a new page where i can call and retrieve these values stored from the database? please help...

[code]
<?php
include("config.php");

$field_a = $_POST['field_a'];
$field_b = $_POST['field_b'];
$field_c = $_POST['field_c'];
$field_d = $_POST['field_d'];
$field_e = $_POST['field_e'];
$field_f = $_POST['field_f'];
$num = $_POST['num'];
foreach($field_a as $key => $val)
{
$sql="INSERT INTO sample (field_a, field_b, field_c, field_d, field_e, field_f, code) VALUES

('".$val."','".$field_b[$key]."','".$field_c[$key]."','".$field_d[$key]."','".$field_e[$key]."','".$field_f[$key]."','$code')";
mysql_query($sql) or die(mysql_error());
}

?>
[/code]
[code]$query = "SELECT * FROM sample";
$result = mysql_query($query) or die(mysql_error());
if($result && mysql_num_rows($result) > 0)
{
     while($row = mysql_fetch_array($result))
     {
          extract($row);
          echo "$field_a<br />";
          echo "$field_b<br />";
          // etc
     }
}[/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.