...

View Full Version : help debugging please



chump2877
06-29-2005, 12:46 AM
Find the parse error near this line:


if (date("n") = $month)

in the following code (please):


if (date("n") != $month);
{
$query2 = "DROP TABLE reference_no";
$result2 = mysql_query($query2);
if (mysql_errno())
{
die("<br>" . mysql_errno() . ": " . mysql_error() . "<br>");
}

$query2 = "CREATE TABLE reference_no (ref_num VARCHAR(20), month VARCHAR(20))";
$result2 = mysql_query($query2);
if (mysql_errno())
{
die("<br>" . mysql_errno() . ": " . mysql_error() . "<br>");
}

$queryC = "ALTER TABLE reference_no ADD index_no INT NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST";
$resultC = mysql_query($queryC);


$reference_no = 1;
$month = date("n");


$queryZ = "INSERT INTO reference_no (ref_num, month) VALUES ('" . $reference_no . "', '" . $month . "')";
$resultZ = mysql_query($queryZ);
if (mysql_errno())
{
die("<br>" . mysql_errno() . ": " . mysql_error() . "<br>");
}
if (mysql_affected_rows() != 1)
{
die("<br>Failed to add user information.");
}
}


// If today's month is the same as last entries month.

if (date("n") = $month)
{
$month = date("n");
$reference_no = $number_of_rows;
$reference_no++;

$queryZY = "INSERT INTO reference_no (ref_num, month) VALUES ('" . $reference_no . "', '" . $month . "')";
$resultZY = mysql_query($queryZY);
if (mysql_errno())
{
die("<br>" . mysql_errno() . ": " . mysql_error() . "<br>");
}
if (mysql_affected_rows() != 1)
{
die("<br>Failed to add user information.");
}
}

Thanks.

Kurashu
06-29-2005, 12:50 AM
if (date("n") === $month)


That'll fix it.

chump2877
06-29-2005, 12:52 AM
oops, good catch...thanx... :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum