私はPHPプログラミングに不慣れで、それについての知識が乏しいですが、それを使用してクライアントのAndroidアプリケーションへのWebサービスを作成したいと思います...
PHPを使用して最初のWebサービスを作成し始めましたが、正常に機能していますが、必要なすべての関数とメソッドを含む1つのファイルを作成する方法と、Androidから呼び出す方法を知りたいです。
ありがとうございました
これはfunctions.phpです
<?php
function GetAllRest()
{
mysql_connect("localhost","root","root");
mysql_select_db("myhoteldb");
$sql=mysql_query("SELECT rest_id ,rest_name,cuisine,no_tables,bg_img,rest_logo FROM restaurant");
while($row=mysql_fetch_assoc($sql))
$output[]=$row;
print(json_encode($output));
mysql_close();
}
function GetAllCategory($lang_id,$rest_id)
{
mysql_connect("localhost","root","root");
mysql_select_db("myhoteldb");
$sql=mysql_query("SELECT cat_lang.rowid ,cat_lang.cat_id as _id,lang_id, cat_name,cat_description from cat_lang ,menu_category WHERE lang_id= $lang_id AND restaurant= $rest_id ");
while($row=mysql_fetch_assoc($sql))
$output[]=$row;
print(json_encode($output));
mysql_close();
}
?>
および URLhttp://localhost/mywebservices.php?op = GetAllCategory&lang_id = 1&rest_id = 1
そして私は今このエラーを受け取りました
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in
22行目のC:\ xampp \ htdocs \ features.php
Notice: Undefined variable: output in C:\xampp\htdocs\functions.php on line 24
null