Kan iemand mij zeggen wat er fout is aan mijn query AUB.
Ben ten einde raad.
Als ik de query run in een localhost omgeving direkt in phpmyadmin is er niks fout.
Als ik de query aanspreek via een functie (zie hieronder Krijg ik de volgende fout :
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 1
SELECT count(*) FROM gelezen WHERE user_id = 'DPC5900')
Beschrijving functie :
Occurs before SQL query executed
Use this event if you like to modify default SQL query on the page.
Avoid editing strSQL parameter, modify strWhereClause and strOrderBy instead.
Parameters
$strSQL - SQL query being to be executed.
$strWhereClause - WHERE clause applied to the SQL query. Example: "active=1"
$strOrderBy - ORDER BY query applied to the SQL query.Example: "ORDER BY
LastName,FirstName"
$pageObject - an object of Page class representing the current page
<?php
function BeforeQueryList($strSQL, $strWhereClause, $strOrderBy, $pageObject)
{
$sleutel = $_SESSION["UserID"] ;
//********** Check if specific record exists ************
global $conn;
$strSQLExists = "select * from gebruikers where PersUserID='$sleutel'";
$rsExists = db_query($strSQLExists,$conn);
$data=db_fetch_array($rsExists);
if($data)
{
$gb_ID = $data['ID'];
$strSQL = "SELECT
newsmain.ID,
newsmain.InforefDoc,
newsmain.InfoDat,
newsmain.InfoTitel,
newsmain.InfoDatBegin,
newsmain.InfoDatEind,
newsmain.Infolocatie
FROM newsmain
INNER JOIN news_cat ON newsmain.ID = news_cat.ID_news
INNER JOIN gebr_cat ON news_cat.ID_category = gebr_cat.ID_Category and ID_gebruiker ='$gb_ID'
where ID NOT IN (SELECT news_id FROM gelezen WHERE user_id = '$sleutel')";
}
else
{
// if dont exist do something else
}
}
?>
Dank bij voorbaat
Dirk