class_contact.php error


  -----  
Author Message

Gephri
Member

Mon Jun 25, 2007 5:02 pm   Post subject: class_contact.php error
Hello Thoul:

Started getting the following error whenever someone tries to add a member to the Contact List. Have not been able to figure out where I should fix the code.

Code:

Could not UPDATE data in contact table DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 4

UPDATE phpbb_contact_list SET user_ignore = 0, alert = 1, disallow = 0 WHERE user_id = 3 AND contact_id =

Line : 413
File : class_contact.php


Does this cryptic info mean much to you...?
Thanks in advance for any help!
 

Thoul
Administrator

Mon Jun 25, 2007 7:36 pm   Post subject: Re: class_contact.php error
This means the user_id for the new contacts isn't being passed along to the script. Does this happen from using the contact management or the little image links (or both)?
 

Gephri
Member

Mon Jun 25, 2007 11:56 pm   Post subject:
Oh - clever test!
The "little image links" work perfectly - it's just the addition of a buddy within the contact list that generates the error
 

Thoul
Administrator

Tue Jun 26, 2007 4:59 pm   Post subject: Re: class_contact.php error
After you submit the form, there should be a confirmation page. On that page, view the source (right click and select View Source or Page Source). Somewhere in the source you should see <input type="hidden" name="mark[]" value="X" />, with X being some number. Let me know if you see this; that will narrow down the area where the user ids are being lost.
 

Gephri
Member

Wed Jun 27, 2007 11:51 am   Post subject:
Unfortunetly I dont get a confirmation page - I get the error page listed above.

When I open class_contact.php and go to "line 413" it is the following code:

Code:

         case 'update':
            // Update contact info
            $sql = 'UPDATE ' . CONTACT_TABLE . '
                  SET user_ignore = ' . $ignore . ', alert = ' . $alert . ', disallow = ' . $disallow . '
                  WHERE user_id = ' . $userid . '
                  AND ' . CONTACT_ID_NAME . $list_sql;

            if ( !$result = $db->sql_query($sql) )
            {
               $this->contact_die('Could not UPDATE data in contact table', __LINE__, __FILE__, $sql);
            }
            break;


Hope this helps
 

Thoul
Administrator

Thu Jun 28, 2007 11:38 am   Post subject: Re: class_contact.php error
Okay, it sounds like you're using a different version of the files than what I have in front of me. Can you save a copy of your contact.php, contactcp_edit.php and class_contact.php files as txt, upload them somewhere, and post a link to them, please? I'll need to look at all three files and walk through the process to see where the data is being lost.
 

Thoul
Administrator

Fri Jun 29, 2007 10:14 am   Post subject: Re: class_contact.php error
Try uncommenting this line in your contact.php:

Code:

//   $confirm = ( isset($_REQUEST['confirm']) ) ? true : 0;

That prevents the confirmation page from appearing and may be causing this problem.
 

Gephri
Member

Fri Jun 29, 2007 4:37 pm   Post subject:
unfortunetly that didnt work when I try to add a member from the contact page - although all the other add-buddy links work on other page - like users page, board, etc.

A little more info that may help is the following info that is sent to me via email whenever the contact page error occurs:

Code:


Could not UPDATE data in contact tableDEBUG MODE<br /><br />SQL Error : 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 4<br /><br />UPDATE sspg_contact_list
                  SET user_ignore = 0, alert = 1, disallow = 0
                  WHERE user_id = 5
                  AND contact_id = <br /><br />Line : 413<br />File : class_contact.php

FORM:
Array
(
    [mode] => edit
    [action] => add
    [type] => buddy
    [username] => Princess
    [alert] => on
    [single] => Add Member
)


Any other ideas thoul / thanks for your patience.
 

Thoul
Administrator

Sat Jun 30, 2007 12:55 pm   Post subject: Re: class_contact.php error
Yeah, that does help. Let's try this. In contact.php, find this:

Code:

   elseif( $confirm )
   {
      $alert = 0;
      $ignore = 0;
      $disallow = 0;


Below it, add:

Code:

      // Get user_id from a username
      if( $username && !$contact_id )
      {
         $sql = 'SELECT user_id FROM ' . USERS_TABLE . "
               WHERE username='$username'";

         if ( !$result = $db->sql_query($sql) )
         {
            $message = 'Could not get user_id from username';
            message_die(GENERAL_ERROR, $message . $contact_list->append_msg, '', __LINE__, __FILE__, $sql);
         }

         if( !$row = $db->sql_fetchrow($result) )
         {
            $message = 'Could not get user_id from username row';
            message_die(GENERAL_ERROR, $message . $contact_list->append_msg, '', __LINE__, __FILE__, $sql);
         }

         $contact_id = $row['user_id'];
      }


Let me know how that goes.
 

Gephri
Member

Mon Jul 02, 2007 11:26 am   Post subject: that's it!
that's it thoul !
thank you so much for hanging in there to help get this solved !

If it is a solution that can help anyone else, then I should let you know that I found the could youhad me search for on
contactcp_edit.php
rather than
contact.php

But I'm defintely not being a stickler on details!

thanks again from me and my members that have been trying to sign up buddies.

Gephri
 

Page 1 of 2
Go to page 1, 2  Next
Display posts from previous: