Now you can query the activity information for the last five days, but you do not know how to traverse it.
Now you can query the activity information for the last five days, but you do not know how to traverse it.
Reply content:
Now you can query the activity information for the last five days, but you do not know how to traverse it.
Check that there is a php in your tag. you can use php to connect to the database and query the result. The result is usually an array. you can use php to traverse the array.
Your ultimate goal is to bind the result to the page ??
If yes, continue.
What binding method do you use to directly output data to the page ?? Or ajax binding ?? Common Code:
// Consistent with the SQL query above $ SQL = ''; $ db = new PDO ('MySQL: host = localhost; dbname = db_name ', $ user, $ pwd); $ result = $ db-> query ($ SQL)-> fetchAll (PDO: FETCH_ASSOC); if ($ ajax) {echo json_encode ($ result ); exit;} else {// combined with html output foreach ($ result as $ v) {// execute related operations ....}}