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 2 of 2
  1. #1
    Regular Coder
    Join Date
    Feb 2006
    Posts
    138
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Unexpected $end - issue with query

    My code is breaking (unexpected end) - when I remove the SQL query line that begins $result=, the error stops... What is wrong here that's causing the code to stop? I don't see any special characters in that line that would screw it up, but maybe I'm missing something?

    PHP Code:
    <?
    function directoryToArray($directory$recursive) {
        
    $array_items = array();
        if (
    $handle opendir($directory)) {
            while (
    false !== ($file readdir($handle))) {
                if (
    $file != "." && $file != "..") {
                    if (
    is_dir($directory"/" $file)) {
                        if(
    $recursive) {
                            
    $array_items array_merge($array_itemsdirectoryToArray($directory"/" $file$recursive));
                        }
                        
    $file $directory "/" $file;
                        
    $array_items[] = preg_replace("/\/\//si""/"$file);
                    } else {
                        
    $file $directory "/" $file;
                        
    $array_items[] = preg_replace("/\/\//si""/"$file);
                    }
                }
            }
            
    closedir($handle);
        }
        return 
    $array_items;
    }

    $files directoryToArray("./inttest"false);



    foreach (
    $files as $file) {

        
    $handle fopen($file"r");

    $data fgetcsv($handle5000",");

    while ((
    $data fgetcsv($handle5000",")) !== FALSE) {
        

    if (
    $data[1] != NULL){

    $scrubnumber preg_replace("/[^0-9]/",""$data[1]); 



    $fname $data[0];
    $phone1 $scrubnumber;
    $arrival $data[3];



    $result=MYSQL_QUERY("INSERT INTO myrtle (LeadNumber, fname, lname, email, phone1, arrival, comments, LXSubAffld, Date, Time, location, source, ip, ProjectID) 

          VALUES ('NULL','$fname','$lname','$email','$phone1','$arrival','$comments','$LXSubAffld','$Date','$Time','$location','$source','$ip','$ProjectID')"
    ) or 

                   die(
    'Error making query'.mysql_error());"

    }
    else {}





    }



    unlink($file);


    }



    ?>

  • #2
    Regular Coder
    Join Date
    Feb 2006
    Posts
    138
    Thanks
    11
    Thanked 0 Times in 0 Posts
    And I found the answer - missing parenthesis.. Took me giving up and posting this to see the problem clearly I guess


  •  

    Posting Permissions

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