This post was last edited by Xiaoshengbboy on 2013-06-14 00:42:16
To help you.
$sql = "SELECT * from Xym_pic";
$res =mysql_query ($sql, $conn);
while ($row =mysql_fetch_assoc ($res)) {
$data []= $row;
}//randomly extracts 9 records to simulate the actual situation
$keys = Array_rand ($data, 10);
$json = Array ();
foreach ($keys as $key) {
$json [] = $data [$key];
}
echo Json_encode ($json);
This code in the waterfall stream data.php part of the code, each time you get the data from the database to put into the array $data[] inside, the original is random to fetch 9 records, I want this program, every time to get rid of the 9 records sorted, is the first time to take out is 0-9, The second time is 10-9, and so on! How can you help tell how to get the data out? Thank you so much! The younger brother Bong 100 points, solves the Plus!!! If the good intentions of the intention to add QQ guidance, it is quite grateful AH: QQ 2 7 7 6 2 8 1 8 1
Reply to discussion (solution)
Session_Start (); if (Isset ($_session[' last ')) $_session[' last '] = 0, $last = $_session[' last '), $sql = "SELECT * FROM Xym_ Pic Limit $last, 9 "; $res =mysql_query ($sql, $conn), while ($row =mysql_fetch_assoc ($res)) { $data []= $row;} $_session[' last '] + = count ($data); Echo Json_encode ($data)
;
Thank you for the moderator's reply has been resolved thank you!!!!!!!!!
Session_Start (); if (Isset ($_session[' last ')) $_session[' last '] = 0, $last = $_session[' last '), $sql = "SELECT * FROM Xym_ Pic Limit $last, 9 "; $res =mysql_query ($sql, $conn), while ($row =mysql_fetch_assoc ($res)) { $data []= $row;} $_session[' last '] + = count ($data); Echo Json_encode ($data)
;
I have a small problem, that is, I have a database in a total of more than 80 records, each taken out to nine, take out 8 times, took out, but I refresh the page when the session is still in, I can not take out the data, how to solve it? Thanks, man.
Session_Start (); if (Isset ($_session[' last ')) $_session[' last '] = 0, $last = $_session[' last '), $sql = "SELECT * FROM Xym_ Pic Limit $last, 9 "; $res =mysql_query ($sql, $conn), while ($row =mysql_fetch_assoc ($res)) { $data []= $row;} $_session[' last '] + = count ($data); Echo Json_encode ($data)
;
I have a small problem, that is, I have a database in a total of more than 80 records, each taken out to nine, take out 8 times, took out, but I refresh the page when the session is still in, I can not take out the data, how to solve it? Thanks, man.
The waterfall stream should not be stored in the session, is it? Should be the same as paging through the request parameters to determine the data start bar
You don't get it, you take it from scratch.
You don't get it, you take it from scratch.
Now it is because I can not get it, I judge if the result set is empty, then destroy the session, refresh the page or not take out the data
You don't get it, you take it from scratch.
Now it is because I can not get it, I judge if the result set is empty, then destroy the session, refresh the page or not take out the data
The result set is empty I let the session be destroyed, but he's going to have an infinite loop.
I think the result set is empty, will not take the result, until the page refreshes, only re-count
How can i solve it?
Session_Start (); if (Isset ($_session[' last ")) $_session[' last '] = 0, $last = $_session[' last ']; $sql = "SELECT * from Xym_pic limit $last, 9"; $res =mysql_query ($sql, $conn); if (Mysql_num_rows ($res) ==0) { $last = $_ Session[' last '] = 0; $sql = "SELECT * from Xym_pic limit $last, 9"; $res =mysql_query ($sql, $conn);} while ($row =mysql_fetch_assoc ($res)) { $data []= $row;} $_session[' last '] + = count ($data); Echo Json_encode ($data)
You don't get it, you take it from scratch.
Now it is because I can not get it, I judge if the result set is empty, then destroy the session, refresh the page or not take out the data
The result set is empty I let the session be destroyed, but he's going to have an infinite loop.
I think the result set is empty, will not take the result, until the page refreshes, only re-count
How can i solve it?
The final result set of this code JSON is returned to a JS file, JS to determine the location of the page loading new content, I even destroyed the session, a load will start to get the data again!
This is a headache!
What exactly do you want to do?
What exactly do you want to do?
This is the waterfall flow, I want to press strip out of the latest 80 data, and then terminated, I refresh the page, and then retrieve the data!
Now this waterfall flow mechanism is, static page call Js,js control the current position of the page, the distance from the bottom of how many px after the php file, this PHP code is no problem, that is, when JS gets, is it not to judge if JSON is empty is not to get it?
Now JS as long as the scrolling will continue to get content, if PHP inside the result set is empty, he will get a data once!
Log out of session or set $_session to empty when finished
JS side Of course also need to have data to return, without words, no longer send the request
Log out of session or set $_session to empty when finished
JS side Of course also need to have data to return, without words, no longer send the request
Thank you very much, I have JS to make a try!
Thank you for your patience and help OH!!!!!!!