Database Query Error

The site was working great. Then, suddenly just a few minutes ago, in accessing /admin/profile.php through the admin panel>Users>Members link, I get a red box with Database Query Error and the following email ...

 

Database error in sitename

Query:

SELECT `Profiles`.`ID` as `ID`, 

  `NickName`,

  `Email`,

  `Sex`,

  DATE_FORMAT(`DateLastLogin`,  '%m-%d-%y %H:%i' ) AS `DateLastLoginCur`,

  DATE_FORMAT(`DateReg`,  '%m-%d-%y %H:%i' ) AS `DateReg`,

  `Status`

   

  FROM `Profiles` 

      

   

  WHERE 1      AND (`Couple`=0 OR `Couple`>`Profiles`.`ID`)  ORDER BY DateLastLogin deleted LIMIT 0, 30;

 

Mysql error:

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 'deleted LIMIT 0, 30' at line 12

 

Found error in file /home/sitename/admin/profiles.php

at line 258. Called db_res function 

with erroneous argument #0

 

Debug backtrace:

Array

(

    [1] => Array

        (

            [file] => /home/sitename/admin/profiles.php

            [line] => 258

            [function] => db_res

            [args] => Array

                (

                    [0] => SELECT `Profiles`.`ID` as `ID`, 

  `NickName`,

  `Email`,

  `Sex`,

  DATE_FORMAT(`DateLastLogin`,  '%m-%d-%y %H:%i' ) AS `DateLastLoginCur`,

  DATE_FORMAT(`DateReg`,  '%m-%d-%y %H:%i' ) AS `DateReg`,

  `Status`

   

  FROM `Profiles` 

      

   

  WHERE 1      AND (`Couple`=0 OR `Couple`>`Profiles`.`ID`)  ORDER BY DateLastLogin deleted LIMIT 0, 30;

                )

 

        )

 

)

 

Help. How could this happen out of nowhere. I haven't changed anything in the profile.php file. Please, please, this is not something I understand well. Really would appreciate a detailed, clear answer.

Quote · 1 Oct 2008

Well, I fixed the problem by clearing cache.

 

But why did it happen in the first place??

Quote · 1 Oct 2008

ORDER BY DateLastLogin deleted LIMIT 0, 3

.. seems value of DateLastLogin was ... deleted? :)

Quote · 1 Oct 2008

so ... what should be changed?

Quote · 1 Oct 2008

line 269 in that file must be:
ORDER BY $sortor $sorttype




a little above this here are always (191 - 218 lines):

/* here we make check for the first click on the value
 * in case we change our incoming value we set order type to ASCENDING
 * in other case we check for additional clicks and change the image
 * $sorttype - ASCENDING or DESCENDING
*/
if ( $_GET['sortor'] && ($_GET['sortor'] != $_COOKIE['sortor']) )
{
    $sorttype = "DESC";
}
elseif ( $_GET['sortor'] )
{
    if ( $_COOKIE['sorttype'] == "ASC" )
    {
   		$sorttype = "DESC";
   		$sortor_image = "";
    }
    else
    {
    	$sorttype = "ASC";
    	$sortor_image = "";
    }
}

if ($sorttype != '') {
	$sorttype = ($sorttype == 'DESC') ? 'DESC' : 'ASC';
}

setcookie( "sorttype", $sorttype );

Quote · 2 Oct 2008

Hi, I added your code and line 269 is ORDER BY $sortor $sorttype...and, I still get Database Query Error.  Please help...

This happens when I'm viewing profiles that have unapproved picture

Quote · 27 Mar 2009
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.