0
私のページはユニ・サーバにアップロードされていますが、ヘッダーは表示されていますがデータベース値は表示されません(コード・チェッカーでコードを入力してもエラーは見つかりません)jsonがデータベース値を表示していません
ライブラリページ
<?php
function getAllPictures() {
// include the login credentials
include ("loginasdf.php") ;
// connect to the database to get current state
$conn = mysqli_connect($servername, $username, $password, $database);
if (!$conn) { die("Connection failed: " . mysqli_connect_error()); }
$sql = "select * from Pictures" ;
$result = mysqli_query($conn, $sql);
// convert to JSON
$rows = array();
while($r = mysqli_fetch_assoc($result)) {
$rows[] = $r;
}
return json_encode($rows);
}
?>
loginasdf
<h1>Display All Pictures</h1>
<?php
// define the constants to access the database.
$servername = "***";
$username = "***";
$password = "***";
$dbname = "****";
?>
表示画像ページ
<?php
include("library2.php") ;
$picturetxt = getAllPictures() ;
$picturejson = json_decode($picturetxt) ;
// now write out the details
echo "name ".$picturejson -> hname."<br/>" ;
echo "image " .$picturejson -> himage."<br/>" ;
$cl = $picturejson;
for ($i=0 ; $i<sizeof($cl) ; $i++) {
echo "<a href=displaycontact2.php?id=" ;
echo $cl[$i] -> id ;
echo ">" ;
echo $cl[$i] -> hname ;
echo "</a><br/>" ;
}
?>
getAllPictures()は有効なjsonを返しますか? 'header'はどういう意味ですか? –
@BadeaMihaiFlorinヘッダーで私はちょうど意味した、\t
すべての画像を表示
私は質問にそれを入れていない – mattdoesnthaveaclue