ciao ho fatto cosi ,
Codice PHP:
$estrazione_ticketuser mysql_query("SELECT * 
FROM ticket_message 
WHERE ticketid = '"
$id_ticket ."' 
OR userid = 1 
OR staffid = 1 
OR adminid = 1 
"
)or die("ERRORE DI QUERY TICKET MESSAGGI:".mysql_error());//da guardare
$row mysql_fetch_array($estrazione_ticketuser);
$userid  intval($row['userid']);
$staffid intval($row['staffid']);
$adminid intval($row['adminid']);


 function 
Autormessage($userid $staffid$adminid)
{

if(
$userid !=0){
$sql "SELECT * FROM user           WHERE id = ".$userid."  AND stato 1   LIMIT 1";
$estrazione_user  mysql_query($sql)or die("ERRORE DI QUERY USER:".mysql_error());
  if(
$estrazione_user  mysql_query($sql))
  { 
while(
$curr mysql_fetch_array($estrazione_user)){
          echo 
"".$curr['email']."";
}
}else{echo 
"ERRORE DI QUERY USER BIS:".mysql_error();}
}else if(
$staffid !=0){
$sql "SELECT * FROM staff          WHERE id ='".$staffid."' AND stato 1   LIMIT 1";
$estrazione_staff  mysql_query($sql)or die("ERRORE DI QUERY STAFF:".mysql_error());
  if(
$estrazione_staff  mysql_query($sql))
  {
while(
$curr mysql_fetch_array($estrazione_staff)){
          echo 
"".$curr['email']."";
}

}else{echo 
"ERRORE DI QUERY STAFF BIS:".mysql_error();}

}else if(
$adminid !=0){

$sql "SELECT * FROM amministrator  WHERE id ='".$adminid."' AND stato 1   LIMIT 1";
$estrazione_admin  mysql_query($sql)or die("ERRORE DI QUERY ADMIN:".mysql_error());
 
  if(
$estrazione_admin  mysql_query($sql))
  {
  
while(
$curr mysql_fetch_array($estrazione_admin)){
          echo 
"".$curr['email']."";
}

}else{echo 
"ERRORE DI QUERY ADMIN BIS:".mysql_error();}



}else
{
return 
false;
}
}
$autoreMessTicket Autormessage($userid $staffid$adminid);
echo 
$autoreMessTicket
e questo e l errore :
codice:
ERRORE DI QUERY USER: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 '1 LIMIT 1' at line 1