Simple Invoices logo
    • CommentAuthorpharpbx
    • CommentTimeJan 25th 2007 edited
     permalink
    Hi,

    I see an error when trying to open http://mydomain/simpleviewer

    [code]You have an error in your SQL syntax near '; ' at line 5[/code]

    I saw the [url=http://simpleinvoices.org/forum/topic.php?id=46]MySQL Error[/url] post from Ktisis.

    I changed $mysql =5; for $mysql =4; due my php version

    This is the first 10 lineas of index.php

    [code]
    <?php

    include('./include/include_main.php');
    #include('./config/config.php');
    include("./lang/$language.inc.php");
    include('./include/sql_patches.php');
    #include('./include/menu.php');

    $conn = mysql_connect( $db_host, $db_user, $db_password );
    mysql_select_db( $db_name, $conn );
    [/code]


    Server info:

    PHP Version 4.3.2
    MySql 3.23.58
    Browser: firefox2.0 and IE6
    Red Hat Enterprise Linux
    Server Apache 2.0.46


    What could be wrong? Thanks!
    • CommentAuthorjustin
    • CommentTimeJan 25th 2007 edited
     permalink
    Hey Pharpbx,

    Ive never used MySQL 3 with Simple Invoices before so i cant be 100% sure what the error could be.

    2. things

    1. can you browser to other Simple Invoices pages
    ie /manage_invoices.php etc..

    2. im about to release a new version of Simple Invoices (sometime between today and Sunday), you may want to retry with this new version as there have been alot of modifications to Simple Invoices since the last release and it may resolve this issue - no promises, but its worth a try :)

    Cheers

    Justin
    • CommentAuthorpharpbx
    • CommentTimeJan 25th 2007 edited
     permalink
    Justin, thanks for response.

    Yes, I can browse other Simple Invoices pages, such us /manage_invoices.php, /invoice_total.php, etc.

    I will wait for this release. Meanwhile I'm gonna see if I can upgrade MySql. If I do that , I need to reinstall all aplication?

    Thanks.
    • CommentAuthorjustin
    • CommentTimeJan 27th 2007 edited
     permalink
    Hey Pharpbx,

    hmm.. in the index page there is some sql but should be skipped if youve set your $mysql to something less than 5

    If you could upgrade MySQL that would be great and should resolve this issue.

    You shouldn't need to reinstall the application, just make sure after the upgrade that your Simple Invoices db is still there, also you way want to drop the Simple Invoices db and recreate it using the standard .sql to take advantages of MySQL 5

    let me know how you go

    Cheers

    Justin
    • CommentAuthorpharpbx
    • CommentTimeFeb 11th 2007 edited
     permalink
    Justin,

    OK, I just install last release "simpleinvoices_20070206.zip" but is not working.

    Same error:


    You have an error in your SQL syntax near '; ' at line 5


    I can browse other simple invoices pages.

    Unfortunately my hosting provider can't upgrade mysql.

    Thanks for your help.

    Daniel
    • CommentAuthorjustin
    • CommentTimeFeb 11th 2007 edited
     permalink
    Hey Daniel,

    what you can try is to comment out sections of the start.php file,

    open start.php and place a /* before a section and then a */ (refer below) after it
    the sections im referring to are the various sql statements, just try one by one and see which one causes Simple Invoices to die - let me know if you find it and i'll try to adjust the code

    ie

    from

    if ($mysql > 4) {
    $sql = "
    SELECT
    si_customers.c_id as ID,
    si_customers.c_name as Customer,
    (select sum(inv_it_total) from si_invoice_items,si_invoices where si_invoice_items.inv_it_invoice_id = si_invoices.inv_id and si_invoices.inv_customer_id = ID) as Total,
    (select IF ( isnull(sum(ac_amount)), '0', sum(ac_amount)) from si_account_payments,si_invoices where si_account_payments.ac_inv_id = si_invoices.inv_id and si_invoices.inv_customer_id = ID) as Paid,
    (select (Total - Paid)) as Owing
    FROM
    si_customers,si_invoices,si_invoice_items
    WHERE
    si_invoice_items.inv_it_invoice_id = si_invoices.inv_id and si_invoices.inv_customer_id = c_id
    GROUP BY
    Owing DESC
    LIMIT 1;
    ";

    $result = mysql_query($sql, $conn) or die(mysql_error());

    while ($Array = mysql_fetch_array($result)) {
    $largest_debtor = $Array['Customer'];
    };
    }


    to

    /*
    if ($mysql > 4) {
    $sql = "
    SELECT
    si_customers.c_id as ID,
    si_customers.c_name as Customer,
    (select sum(inv_it_total) from si_invoice_items,si_invoices where si_invoice_items.inv_it_invoice_id = si_invoices.inv_id and si_invoices.inv_customer_id = ID) as Total,
    (select IF ( isnull(sum(ac_amount)), '0', sum(ac_amount)) from si_account_payments,si_invoices where si_account_payments.ac_inv_id = si_invoices.inv_id and si_invoices.inv_customer_id = ID) as Paid,
    (select (Total - Paid)) as Owing
    FROM
    si_customers,si_invoices,si_invoice_items
    WHERE
    si_invoice_items.inv_it_invoice_id = si_invoices.inv_id and si_invoices.inv_customer_id = c_id
    GROUP BY
    Owing DESC
    LIMIT 1;
    ";

    $result = mysql_query($sql, $conn) or die(mysql_error());

    while ($Array = mysql_fetch_array($result)) {
    $largest_debtor = $Array['Customer'];
    };
    }
    */


    good luck

    Cheers

    Justin
    • CommentAuthorpostman
    • CommentTimeMar 13th 2007 edited
     permalink
    I had this error also and I am also running MySQL 3.23.
    The problem is the ; symbol at the end of the following SQL statement:
    $sql4 = "
    SELECT
    count(sql_patch_ref) as count
    FROM
    si_sql_patchmanager;
    ";

    removing the ; symbol sorted it out.
    $sql4 = "
    SELECT
    count(sql_patch_ref) as count
    FROM
    si_sql_patchmanager
    ";


    It might be worth doing this in the code (unless there is any impact on later MySQL versions).
    Cheers,
    jonny
    • CommentAuthoraplysia
    • CommentTimeMar 13th 2007 edited
     permalink
    @postman: Thx for the info. I corrected it in the code. I think their are some more such "errors" with a ; at the end...
    • CommentAuthorjustin
    • CommentTimeMar 13th 2007 edited
     permalink
    thanks guys for sorting this out

    cheers

    justin