This question already has an answer here:
I met some trouble with that error
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in In fact for not having global variables I put all my query in functions.
My queries are ok, no mistakes in the fields name of where ever else.
The trouble is that on local all is fine working, when I put it online, it does not workd, and everywhere it return me some mistakes
for the home I have this mistakes:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /web/teamfrancestron/www/lib_php/strongman.php on line 75
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /web/teamfrancestron/www/lib_php/strongman.php on line 90
My user have all privilege in the database,
here is the code I use : here is for the first mistake
function fetchAccueil() {
$sql = "SELECT
`content`, `date_maj`, `id_maj`, `titre`
FROM `stg_man_home`
WHERE
`id` = '1'";
$result = mysql_query($sql);
return mysql_fetch_assoc($result);
}
And there for the other query
/** * Fonction qui va chercher l'identité d'une personne. * @param type $id * @return type */
function fetchIdentity($id) {
$input_id = mysql_real_escape_string($id);
$query = "SELECT
`nom`, `prenom`
FROM `stg_man_users`
WHERE `id` = '{$input_id}'";
$result = mysql_query($query);
return mysql_fetch_assoc($result);
}
I realy do not see any mistakes on names fileds, I'm sure that my queries are valid ressources. (works on local but not on the server). Im on php 5.4
On other pages I have still the same mistakes
Anykind of help will be much appreciated.
</div>