Page 1 of 1

Infinite Scrolling PHP

Posted: Fri Jul 10, 2015 2:09 am
by Xaos
Hey guys, I've been trying to implement infinite scroll in PHP forever but I just can't seem to get it work. I think it has something to do with the way my current PHP is structured, but I'm not sure. If anyone wants to take a look, that'd be great :lol:

Code: Select all

<html>
<link rel = "stylesheet" type = "text/css" href = "main.css">
<title>
Buy All The Stuff!
</title>
</html>

<?php

echo '<div class = "header">';
echo 'This is a header example';
echo '</div>';

$hostname = "localhost";
$username = "root";
$password = "";

$conn = mysql_connect($hostname,$username,$password) or die("MYSQL could not connect");

$productDB = mysql_select_db('affiliatemarketing',$conn) or die ("Could not select database");

$result = mysql_query("SELECT * FROM products ORDER BY price");

echo '<div class = "bars">';

echo '<div class = "leftNavBar">';
echo 'This is the left nav bar';
echo '</div>';

echo '<div class = "content">';
while($row = mysql_fetch_assoc($result)){

 echo '<div class = "products">';

 echo '<div class = "productText">';
 echo "<strong><font color='black'>Name:</strong></font> " . $row['name'] . "</br>";
 echo "<strong><font color='black'>Description:</strong></font>" . $row['description'] . "</br>";
 echo "<strong><font color='black'>Price: </strong></font>$" . $row['price'] . "</br>";

 echo '<div class = "productButton">';
 echo '<form action = "purchasePage.php">';
 echo '<input type = "button" name="purchase" value="Purchase Now!" id="purchase">';
 echo '</div>';
 echo '</div>';


 echo '<div class = "productImage">';
 echo "<img src='./" . $row['photo'] . "' height='350px' width='350px'/></br></br></br>";
 echo '</div>';

 echo '</div>';
}
echo '</div>';

echo '<div class = "rightNavBar">';
echo 'This is the right nav bar';
echo '</div>';
echo '</div>';

?>

Re: Infinite Scrolling PHP

Posted: Fri Jul 10, 2015 3:21 am
by Sim
Xaos wrote:been trying to implement infinite scroll in PHP forever

Impossible..

Re: Infinite Scrolling PHP

Posted: Fri Jul 10, 2015 5:43 am
by Winawer
Yeah, you'll need javascript.

Re: Infinite Scrolling PHP

Posted: Fri Jul 10, 2015 7:19 pm
by Xaos
Well yeah I was using jQuery in conjuction with the PHP. Didn't include any of my failed jQuery code though :P

Re: Infinite Scrolling PHP

Posted: Sat Jul 18, 2015 1:12 am
by Jackolantern
You most definitely can do infinite scrolling with PHP! You...just have to do it a screen at a time lol