Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,793
    Thanks
    19
    Thanked 156 Times in 147 Posts

    help debugging please

    Find the parse error near this line:

    PHP Code:
    if (date("n") = $month
    in the following code (please):

    PHP Code:
    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.
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!

  • #2
    Regular Coder
    Join Date
    Aug 2004
    Location
    The US of A
    Posts
    767
    Thanks
    1
    Thanked 0 Times in 0 Posts
    PHP Code:
    if (date("n") === $month
    That'll fix it.

  • #3
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,793
    Thanks
    19
    Thanked 156 Times in 147 Posts
    oops, good catch...thanx...
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •