Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Looping form, query statement error

$
0
0
Hi guys,

I am working on a looping form. I have a code that I also got from a website about inserting multiple form using PHP/MySQL.

for($i = 1; $i < 10; $i++) {
					
						if (empty($_POST["clientname$i"]) && empty($_POST["details$i"])) {
							continue;
						} else {		

							$entry .= "('".$_POST["clientname$i"]."','".$_POST["details$i"]."','".$_POST["amount$i"]."','".$_POST["fileno$i"]."','".$_POST["cmn$i"]."')";				
						}
					}
					
						
					$entry = "INSERT INTO cashadvanceentry (cae_caid, cae_client, cae_details, cae_amount, cae_fileno, cae_cmn) VALUES ";
					$entryquery = mysql_query($entry) or die(mysql_error());



and this is the error

Notice: Undefined variable: entry in D:\xampp\htdocs\intranet\cash-advance-form.php on line 40

Notice: Undefined index: amount2 in D:\xampp\htdocs\intranet\cash-advance-form.php on line 40
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1


I'm not sure what went wrong. Did I do a mistake on coding it?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>