Jump to content

Syntax error


DeepakJ

Recommended Posts

Can someone help me find out whats wrong with this code.

 

<html><head><title>AlibreCam Verification System</title></head>


<center><TABLE border=0 cellpadding=3><form name="input" action="linput.php"
method="get">
<tr>
<td>Customer ID:</td>
<td><input type="text" name="user"></td>
</tr>
<tr>
<td>Product ID:</td>
<td> <input type="text" name="user1"></td>
</tr>

<tr>	<td colspan=2><center><input type="submit" value="Submit"></center></td>
</tr>
</form><br></table><br>

<?php
$hostname = "localhost";
$username = "root";
$password = "xxxxxx";
$dbname = "xxxxxxxxx";
$customerid = $_GET['user'];
$productid = $_GET['user1'];


mysql_connect($hostname, $username, $password) or DIE("Unable to connect to MySQL server $hostname");
$selected = mysql_select_db($dbname) or DIE("Could not select requested db $dbname");

$queryb = "SELECT * FROM invoiceid,productid WHERE invoiceid.invoicenum=productid.invoicenum && customerid='$customerid'";
$bResult = mysql_query($queryb) or die(mysql_error()); 
$productcounter=0;
while($row=mysql_fetch_array($bResult)){
$productcounter = $productcounter + 1;
$numoflicenses[] = $row['numoflicenses'];
$invoicetracker[] = $row['invoicenum'];
}
$adder = 0;
foreach ($numoflicenses as $num => $value){
$adder=$adder+$numoflicenses;
if ($adder > $productcounter){
	$queryc="UPDATE productid SET productid=$productid WHERE invoicenum=$invoicetracker[$num]";
	mysql_query($queryc) or die(mysql_error());
}

}

?>
</html>

 

Error: Notice: Undefined variable: numoflicenses in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\InputMaintainance\linput.php on line 40

 

Warning: Invalid argument supplied for foreach() in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\InputMaintainance\linput.php on line 40

Link to comment
https://forums.phpfreaks.com/topic/62107-syntax-error/
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.