Php Mysql Content Load Like Facebook
I wan to load data from mysql with PHP like Facebook (load data by scrolling down). I checked in many tutorial where everyone is doing by order by ID
but I can't do so while my fetching query is like follows.
mysql_query("SELECT * FROM conferencecreate WHERE ccFlag = 1 AND ccStartingDate >= '$nowTime' GROUP BY ccTitle");
If I want to implement ORDER BY ccId DESC
then its not working. Any Idea how to solve this issue?
I tried this :-
mysql_query("SELECT * FROM conferencecreate
WHERE ccFlag = 1
AND ccStartingDate >= '$nowTime'
GROUP BY ccTitle
ORDER BY ccId DESC");
But this produced the error
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource
Answer
You really should not be using the mysql_
database extension any more but that said you need to learn how to process errors generated by any of the the mysql extensions
So try this
$res = mysql_query("SELECT * FROM conferencecreate
WHERE ccFlag = 1
AND ccStartingDate >= '$nowTime'
GROUP BY ccTitle
ORDER BY ccId DESC");
if ( ! $res ) {
echo mysql_error();
exit;
}
Now you should see an error message describing what is wrong with the query you have coded.
Please dont use the
mysql_
database extensions, it is deprecated (gone for ever in PHP7) Especially if you are just learning PHP, spend your energies learning thePDO
ormysqli_
database extensions, and here is some help to decide which to use
Related Questions
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?