Jump to content

loop/query problem


justinh

Recommended Posts

<?php
for($i = 1; $i <= $_POST['numberinparty']; ++$i){

$fname = $_POST[$i .'fname'];
$lname = $_POST[$i .'lname'];
$sql = "INSERT INTO hrclienta ( cl_id, cl_firstname, cl_lastname, cl_address, cl_city, cl_zip, cl_state, cl_email, cl_cell, cl_home, cl_fax, cl_partyid, cl_under, cl_hunter, cl_partycontact) VALUES('', '$fname', '$lname', '', '', '', '', '', '', '', '', '$_SESSION[huntid]', '', '', '')";
     $queryadd = mysql_query($sql) or die(mysql_error());

echo "<label><b>Guest ".$i.":</b></label>".$fname." ". $lname."<br /><br>";
}
?>

 

This is adding a blank row into the database after it adds all the clients. Any ideas? If I need to post the whole code I can.

Link to comment
https://forums.phpfreaks.com/topic/144492-loopquery-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.