{ Learn Code. Share Code. Teach Code. Love Code. }

  • displaying records

 #84468  by Mark
 Thu Apr 16, 2020 4:57 pm
hello

im using this to display my records in a table with pagination but it will show all the records but i want it do it only shows the records that the username put in to the database i tried this.

below shows all the records
Code: Select all
$sql = 'SELECT * FROM orders LIMIT '.$page1.', 4';
this is ment to just show the records off the person logged in but seems to get an error.
Code: Select all
$sql = 'SELECT * FROM orders  WHERE OrderBy = '$username'LIMIT '.$page1.', 4';
 #84469  by CodenStuff
 Sat Apr 18, 2020 7:07 pm
Mark wrote:
Thu Apr 16, 2020 4:57 pm
hello

im using this to display my records in a table with pagination but it will show all the records but i want it do it only shows the records that the username put in to the database i tried this.

below shows all the records
Code: Select all
$sql = 'SELECT * FROM orders LIMIT '.$page1.', 4';
this is ment to just show the records off the person logged in but seems to get an error.
Code: Select all
$sql = 'SELECT * FROM orders  WHERE OrderBy = '$username'LIMIT '.$page1.', 4';
Maybe try:
Code: Select all
$sql = "SELECT * FROM orders WHERE OrderBy = '$username' LIMIT '.$page1.', 4";
Unsure if that will work but let me know either way.
 #84470  by CodenStuff
 Sat Apr 18, 2020 7:08 pm
Also what is the error?