Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

Function syntax help

$
0
0
I am storing the following MySQL prep statement as a function and calling it before its required, however I've either misunderstood the point of a function or I'm using the wrong syntax somewhere. Can somebody advise?

function addressArea(){
$addressAreaStmt = $mysqli->prepare("SELECT addressArea FROM events WHERE strId = ? AND dateTime < CURDATE() AND areaCountry = '$areaCountry' GROUP BY addressArea ORDER BY addressArea");
}
addressArea();
... etc.
Now I have considered trying to define the function as purely the statement query, but this also fails...

function areaCountry(){
$query1 = 'SELECT areaCountry FROM events WHERE strId = ? AND dateTime < CURDATE() GROUP BY areaCountry ORDER BY areaCountry';
}
$stmt = $mysqli->prepare($query1);
Any help? Cheers!

Viewing all articles
Browse latest Browse all 13200

Trending Articles