GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 18-Apr-2007, 22:07
integritywins integritywins is offline
New Member
 
Join Date: Apr 2007
Posts: 1
integritywins is on a distinguished road

unexpected end of file


Please help me with the below code.

I have spent 3 days trying to figure out why I am getting this "Parse error: syntax error, unexpected $end in /home/dollar/public_html/croncheckfreeleads.php "

I have gone through all of the forums a dozen times and tried changing the code several ways. I'm going NUTS!

PHP Code:

<?PHP
$administratoremailid="7dcrons@leadcow.com";
$sentback=0;
$notcontacted=0;
$adminnotify = "Y";

   include "connect.php";

   function getdays($day1,$day2) 
    {
     return round((strtotime($day2)-strtotime($day1))/(24*60*60),0); 
       }

       // The following three lines prime our while
       $query_freeleads = "SELECT ID, bad_phone, HaveContacted, NeedToCallBack, DateLeadAssigned, Notes
                             FROM freeleads WHERE DateLeadAssigned != '0000-00-00 00:00:00'";

       $result_existingleads = mysql_query($query_freeleads,$db);

       $numberofleads = mysql_num_rows($result_existingleads);
       $numberofleadsincontactwith = 0;
       $havecontacted = 'false';

       // The following while tests each row of our data set
      while ( ($rowoffreeleads=@mysql_fetch_object($result_existingleads)) != false):

         // The following lines confirm that there isn't leads sitting with a member for more than 7 days
         if (getdays(date($rowoffreeleads->DateLeadAssigned),date("m/d/Y h:i:s)) >= 7 )  
    {
            if ($rowoffreeleads->bad_phone == 'Yes') 
               $havecontacted = 'true';

            if ($rowoffreeleads->HaveContacted == 'Yes')
               $havecontacted = 'true';

            if ($rowoffreeleads->NeedToCallBack == 'Yes') 
               $havecontacted = 'true';

            if (!empty($rowoffreeleads->Notes)) 
               $havecontacted = 'true';
     
            // If there is indication of contact reset & continue
            if ($havecontacted=='true') 
        
               $numberofleadsincontactwith++;
               $havecontacted = 'false';
           $notcontacted=$notcontacted+1;
             else                  // Reset the DateLeadAssigned & refuser
               $theid  = $rowoffreeleads->ID;
               $sql = UPDATE freeleads SET DateLeadAssigned = '0000-00-00 00:00:00', refuser = '0' WHERE ID ='$theid' ;
           $result=mysql_query($sql,$db); 
           $sentback=$sentback+1;
        
         }  // End If


      endwhile;  // End While 

    if($adminnotify = 'Y')
    {
    $cronsubject = 'Ran Croncheckfreeleads!!';
    $messagebody = 'Finished Croncheckfreeleads $notcontacted Kept AND $sentback Returned';
        SendHTMLMail($administratoremailid,$cronsubject,$messagebody,$administratoremailid);          
    }

?>

Last edited by LuciWiz : 19-Apr-2007 at 10:25. Reason: Please insert your Php code between [php] & [/php] tags
  #2  
Old 18-Apr-2007, 23:25
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,702
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold

Re: unexpected end of file


Quote:
Originally Posted by integritywins
Please help me with the below code.
Line 28, by my count:
PHP Code:

if (getdays(date($rowoffreeleads->DateLeadAssigned),date("m/d/Y h:i:s)) >= 7 ) 


Unterminated string???
PHP Code:

if (getdays(date($rowoffreeleads->DateLeadAssigned),date("m/d/Y h:i:s")) >= 7 ) 



Note that stuff like this really stands out with color-coded context. Using an editor with this feature might help. On the other hand if you had put [php] before the first line of code when in your post and [/php] after the last line, and hit "preview" before posting, you might have spotted it yourself (and saved yourself a couple of days of agony). Oh, well...


Also, there are a couple of nesting errors caused by improper blocking of if{}else{} statements, I'm thinking. (But you can probably spot them after terminating the string and looking at subsequent error messages.)

Regards,

Dave
Last edited by davekw7x : 19-Apr-2007 at 00:13.
  #3  
Old 20-Apr-2007, 05:33
realmetrics.com realmetrics.com is offline
New Member
 
Join Date: Apr 2007
Posts: 8
realmetrics.com is on a distinguished road

Re: unexpected end of file


Hi,

Here is the basic code for checking EOF in PHP..

Code:
<?php $myFile = "YourFile.txt"; $handle = fopen($myFile, 'r'); while (!feof($handle)) { $data = fgets($handle, 512); echo $data; echo "<br>"; } fclose($handle); ?>

While surfing the net, I found this code. You can modify the code for your needs.

I hope this solves your problem.
__________________
http://www.realmetrics.com - Metrics you can count on
 
 

Recent GIDBlogMeeting the local Iraqis by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Airport Log program using 3D linked List : problem reading from file batrsau C Programming Language 11 29-Feb-2008 07:44
Thread synchronization Assignment help!! rossi143 C Programming Language 1 25-Mar-2007 20:10
Download files in c for windows operating system oozsakarya C Programming Language 5 20-Jun-2006 03:33
CD burner wont burn!! robertli55 Computer Hardware Forum 1 18-Jun-2004 10:53
Yet another CD burner problem: Lite-On LSC-24082K Erwin Computer Hardware Forum 1 22-May-2004 11:28

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 17:13.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.