function findPage($page) { if ($page == 1) { echo returnPage1(); } else { if ($page == 2) { echo returnPage2(); } else { if ($page == 3) { echo returnPage3(); } else { if ($page == 4) { echo returnPage4(); } else { if ($page == 5) { echo returnPage5(); } else { if ($page == 6) { echo returnPage6(); } else { if ($page == 99) { echo returnPage99(); } else { echo "BLACKBERRY UNIVERSITY"; } } } } } } } }
//image $sql2 = "SELECT news_imageURL FROM " . $sec . " WHERE id = {$page}"; $result = mysqli_query($conn, $sql2); $imageURL = ""; if ($result->num_rows > 0) { // output data of each row while ($row = $result->fetch_assoc()) { $imageURL .= $row["news_imageURL"] . ","; } } $imageURL = substr($imageURL, 0, -1); //content $sql3 = "SELECT news_content FROM " . $sec . " WHERE id = {$page}"; $result = mysqli_query($conn, $sql3); $nametring = ""; if ($result->num_rows > 0) { // output data of each row while ($row = $result->fetch_assoc()) { $nametring .= $row["news_content"] . ","; } } $nametring = substr($nametring, 0, -1); $item0 = array('type' => 'webview', 'url' => $imageURL); $item1 = array('type' => 'body_news', 'name' => $nametring); $item2 = array('type' => 'title_news', 'name' => $news_title); $item3 = array('type' => 'subtitle_news', 'name' => $news_subtitle); $list = array($item0, $item1, $item2, $item3); echo json_encode($list); } echo returnPage1($recordPage, $section);