Jump to content
Sign in to follow this  
khan.sikki

Inserting fetched multiple rows into table

Recommended Posts

Hello I am Sikandar 

need assistance in inserting multiple data  which was fetched from a recordset in a table


$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "add_trips")) {
  $insertSQL = sprintf("INSERT INTO trips (trip_date, trip_no, hab_id) VALUES (%s, %s, %s)",
                       GetSQLValueString($_POST['trip_date'], "date"),
                       GetSQLValueString($_POST['trip_no'], "int"),
                       GetSQLValueString($_POST['hab_id'], "int"));

  mysql_select_db($database_conn_db, $conn_db);
  $Result1 = mysql_query($insertSQL, $conn_db) or die(mysql_error());

  $insertGoTo = "u_home.php?trip=t";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}

 

Edited by khan.sikki

Share this post


Link to post
Share on other sites

What happens when you run that?  What exactly are you having problems with?

Share this post


Link to post
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...