I’m trying to write a Newsletter, now i want to fetch 5 emails from the database every time i click a button, now i was able to write the code for this but the code for the other 5 i wasnt able too… this is my code … btw Ajax is running the PHP
<?php
$con = mysql_connect(“test1.ndp.net”,”test1_admin”,””);
if (!$con)
die(‘Could not connect: ‘ . mysql_error());
mysql_select_db(“test1_db”, $con);
$result = mysql_query(“SELECT email FROM table1 WHERE Ban = ‘0’”);
$ray = array();
$number = $_GET[‘number’]; //number = 5;
for($counter ; $counter<$number; $counter++) {
$row = mysql_fetch_array($result);
$ray[$counter] = $row[’email’];
}
mysql_close($con);
$string = implode(‘,’,$ray);
echo $string;
?>
I’m able to get the first 5 emails without any problem but the problem is that the second 5 i cant seem to be able to get it… i want to do it like a window of 5 emails every time i click the button i need the php to fetch 5 entries then i want to be able to send the news to the emails then when i click the button again i want to slide the window 5 places and fetch the other 5 new emails etc….
Please Help ?
Thank you for your time