With this PHP CODE i can insert into DB (i changed name of $) results of list people eat @my hotel every day. This code is ok for PHP, already works.
$dataogg=ucwords(strftime("%a %d %B %Y"));
if ($_GET["reportMen"]){
$dba="dbxxxxxx";
@mysql_connect("localhost","exexex","xexexe") or die("Demo 1 is not available, please try again later");
@mysql_select_db($dbxxxxxx);
$contGGtot = "SELECT COUNT(GGLIMIT) AS total FROM tab1 WHERE GGLIMIT=1";
$resultGG = mysql_query($contGGtot);
$valuesGG = mysql_fetch_assoc($resultGG);
$num_rowsGG = $valuesGG['total'];
$sql = "INSERT INTO `dbxxxxxx`.`report` (`ID` ,`DATA` ,`TOTALE`) VALUES (NULL , '".$dataogg."', '".$num_rowsGG."');";
$query = mysql_query($sql) or die (mysql_error());
Now, i need to insert this code inside EVENT on my mysql in phpmyadmin. Basically i create a data, daily select total count, insert into DB. I think i can't put php $ on EVENT. Please help me to simplify these sql query in correct language
No, you cannot use php variables in a mysql stored code. The good news is: you do not have to.
insert into dbxxxxxx.report (ID ,DATA ,TOTALE) VALUES (NULL ,date_format(now(),'%a %d %M %Y') ,(SELECT COUNT(GGLIMIT) FROM tab1 WHERE GGLIMIT=1))