私はMySQLデータベースをPHP経由でiPhoneアプリに接続しようとしています。私はこのチュートリアルに従っていますhttp://codewithchris.com/iphone-app-connect-to-mysql-database/私のPHPファイルは何も返されないのですか?
このようなことは初めてです。私はいくつかの重要な情報を残しておきたいのですが、残念です。ここで
はここでここで私の問題お申し込み
だXcodeでplistのだ、私はお申し込み
<?php
// Create connection
$con=mysqli_connect("localhost","gaethrco_travis","Energy=mc^2","gaethrco_data");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// This SQL statement selects ALL from the table 'Locations'
$sql = "SELECT * FROM Locations";
// Check if there are results
if ($result = mysqli_query($con, $sql))
{
// If so, then create a results array and a temporary one
// to hold the data
$resultArray = array();
$tempArray = array();
// Loop through each row in the result set
while($row = $result->fetch_object())
{
// Add each row into our results array
$tempArray = $row;
array_push($resultArray, $tempArray);
}
// Finally, encode the array to JSON and output the results
echo json_encode($resultArray);
}
// Close connections
mysqli_close($con);
?>
上のデータベースにアップロードPHPファイルですは私が自分のウェブサイトに行くと、gaethr.com/service.php 何も起こりません。チュートリアルによると、これは私はいくつかの重要な情報を残している場合は、私に教えてください
が起こるはずです。
をレコードセット
を検証私はこれらのタグを削除しています。 – Alexander
クエリが成功したかどうかをチェックする必要があります。接続は正常ですが、クエリが失敗しました(たとえば、 'Locations'テーブルは存在しません)。 {...} else {echo mysqli_error($ con); } '*または何か* – HPierce