Infinite Scrolling PHP

C++, C#, Java, PHP, ect...
Post Reply
User avatar
Xaos
Posts: 946
Joined: Wed Jan 11, 2012 4:01 am

Infinite Scrolling PHP

Post 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>';

?>
Sim
Posts: 412
Joined: Sat Dec 26, 2009 5:37 pm

Re: Infinite Scrolling PHP

Post by Sim »

Xaos wrote:been trying to implement infinite scroll in PHP forever

Impossible..
oRPG Creator - Make Your Own Browser Game
oRPG Creator on Facebook
Winawer
Posts: 180
Joined: Wed Aug 17, 2011 5:53 am

Re: Infinite Scrolling PHP

Post by Winawer »

Yeah, you'll need javascript.
User avatar
Xaos
Posts: 946
Joined: Wed Jan 11, 2012 4:01 am

Re: Infinite Scrolling PHP

Post by Xaos »

Well yeah I was using jQuery in conjuction with the PHP. Didn't include any of my failed jQuery code though :P
User avatar
Jackolantern
Posts: 10893
Joined: Wed Jul 01, 2009 11:00 pm

Re: Infinite Scrolling PHP

Post by Jackolantern »

You most definitely can do infinite scrolling with PHP! You...just have to do it a screen at a time lol
The indelible lord of tl;dr
Post Reply

Return to “Coding”