Results 1 to 2 of 2

Thread: php errors coding some mysql calls for logic hook

  1. #1
    ptemplin7 is offline Sugar Community Member
    Join Date
    Jun 2007
    Location
    Puget Sound Washington
    Posts
    380

    Unhappy php errors coding some mysql calls for logic hook

    Hi all,

    Ok I'm tired of trying to find the error!

    I have written a special section of my logic hook to take a new user we have and add here to the invite list by directly manipulating the the meetings_users table. The office generally invites everyone so it will show on the calendar since they are scheduling out quite a ways.

    I keep getting php errors in the code. In paritcular this one:

    Parse error: syntax error, unexpected T_STRING, expecting '(' in /var/www/html/dev2/custom/include/Clients/Assignclientnumber.php on line 412

    Using CentOS, php 5.0, mysql 5, Sugar 5.2K.
    Can you please help find the error. Also, please check my insert statement, is this the correct way to get the mysql to generate its on id for the meetings_user table entry? Will the $countr query correctly? This logic fires off the Account before_save. I've used a special account name to make sure it only runs when I want it to! I couldn't get the date to work correctly so I hard coded it.

    Thanks for the help, Looking forward to a solution!
    Paris

    Code:
    class Assignclientnumber {
    	function Assignclientnumber (&$bean, $event, $arguments)
    	{
       // check if value not set for both
    
    ... lots of other stuff here ....
    
    //
    //   Special coding for Mass add to meetings for new employee
    //
    if ($bean->name = '123add'){
    //
    // Get list of meetings to process    add correct date!
         $query = "SELECT id FROM meetings WHERE date_start >= '2010-03-14' AND deleted = '0'"; 
         $result = $bean->db->query($query, true,"Error mtg ID: ");   
         while($row = $bean->db->fetchByAssoc($result)) {
    echo "Meetings DB row: ".$row['id']." * ";
    echo "Meetings DB row no id: ".$row." * ";
    $line = readline("Continue? ");
    //  [16]
    	$query = "SELECT COUNT(meeting_id) FROM meetings_users WHERE meeting_id = ".$row['id']; 
    	$countr = $bean->db->query($query, true,"Error with count: ");
    echo " countr: ".$countr." xx ";
    $line = readline("Continue? ");
          if ($countr > 1) {     // If only single person is in the table ignore
    	$query = "select * from meetings_users where meeting_id=".$row['id']." and user_id = 'f1a0b548-2ece-11df-b351-001e0b7ff34a'";
    	$result2 =  $bean->db->query($query, true,"Error Meeting users: "); 
    	$row2 =  $bean->db->fetchByAssoc($result2); 
    // 
            if($row2 != null) {
    //echo "row2 meet-user ".$row2." xx ";
    	   $query = "INSERT INTO meetings_users (`id`,`meeting_id`,`user_id`,`required`,`accept_status`,`date_modified`,`deleted`) VALUES (null,{$row['id']},'f1a0b548-2ece-11df-b351-001e0b7ff34a','1','none','2010-03-14 00:00:00',0)";
    	   $insrt = $bean->db->query($query, true,"Error inserting: "); 
            } //If not null
          } // if count>1
        } //while row
    } if client name = special  (This is Line 412!!)
    
    
    }  //end function
    } //end class
    Paris Templin, CEO

    Templin Computing LLC- Washington State based IT and Onlne Backup Specialiosts. We specialize in providing CRM and backup solutions to small and medium businesses.

    http://www.templincomputing.net

  2. #2
    datasponge is offline Sugar Community Member
    Join Date
    Mar 2008
    Location
    San Jose, CA, USA
    Posts
    553

    Default Re: php errors coding some mysql calls for logic hook

    Hi Paris,

    I see many problems on the line you have marked as 412:

    PHP Code:
    } if client name special  (This is Line 412!!) 
    Is the entire line after the brace supposed to be a comment like the lines above it?

    Your if statement has no condition or a flawed condition and no code to execute for true. If it's a condition, it is using a single '=' which causes assignment rather than test for equality. To test for equality use '=='. If it is intended as a condition, it has no statement to execute. If it's a condition, the condition is normally surrounded by parentheses, which may be the reason for the error.

    Phil

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 10
    Last Post: 2010-11-16, 02:41 AM
  2. Replies: 9
    Last Post: 2010-02-01, 03:36 PM
  3. Mysql and Arrays logic hook Problem
    By vantagejuan in forum Help
    Replies: 0
    Last Post: 2009-10-27, 02:58 AM
  4. Replies: 3
    Last Post: 2009-08-15, 03:00 AM
  5. logic hook
    By atik in forum Developer Help
    Replies: 2
    Last Post: 2009-03-28, 10:47 AM

Bookmarks

Posting Permissions

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