Why always Warning: mysql_fetch_object (): suppliedargumentisnotavalidMySQLresul why always
Warning: mysql_fetch_object (): supplied argument is not a valid MySQL result resource in D: \ AppServ1 \ www \ forum \ index. php on line 46
Code:
$ Id = $ row ["id"];
$ Res = mysql_query ("select count (*) as total from reply where topic id = '$ ID '");
$ R = mysql_fetch_object ($ res );
Help
Reply to discussion (solution)
Topic id = '$ ID' "// The error message is returned.
How to change it ?.....
You can run the SQL statement in MYSQL to check whether there are any results.
Concatenate the last $ id with a hyphen. do not write it directly into SQL.
The table structure and requirements are not posted. you only know how to change it.
Topic
$ Res = mysql_query ("select count (*) as total from reply where id =". $ id );
The topic is another table.
If the topic is another table, you must use the join query or multi-table match query.