此脚本 :
<?php
$myfamille=$_POST[ myfamille ];
$conn = odbc_connect( sage , <Administrateur> , );
if (!$conn)
{exit("Connection Failed: " . $conn);}
$sql="Select F_ARTSTOCK.AR_Ref,AR_Design,AS_QteSto
FROM F_ARTICLE,F_FAMILLE,F_ARTSTOCK
where F_ARTICLE.FA_CodeFamille=F_FAMILLE.FA_CodeFamille
AND F_ARTICLE.AR_Ref=F_ARTSTOCK.AR_Ref
AND F_FAMILLE.FA_CodeFamille= ".$myfamille."
and F_ARTSTOCK.AS_QteSto <> 0";
$rs=odbc_exec($conn,$sql);
if (!$rs)
{exit("Error in SQL");}
while($e=odbc_fetch_object($rs))
{$output[]=$e;}
print(json_encode($output));
?>
给我这个错误:
Notice: Undefined variable: output in C:wampwwwarticlecbase.php on line 24
请注意,删除这条线使代码有效,我不知道有什么问题
AND F_FAMILLE.FA_CodeFamille= ".$myfamille."
我也有类似的脚本,但用 Sql 服务器,效果很好
<?php
$myservername=$_POST[ myservername ];
$servername=".\".$myservername;
$myusername=$_POST[ myusername ];
$mypassword=$_POST[ mypassword ];
$db_name="bijou";
$myfamille=$_POST[ myfamille ];
$connectionInfo = array( "Database"=>$db_name, "UID"=>$myusername, "PWD"=>$mypassword);
$conn = sqlsrv_connect( $servername, $connectionInfo);
if (!$conn)
{exit("Connection Failed: " . $conn);}
$sql="Select F_ARTSTOCK.AR_Ref,AR_Design,AS_QteSto FROM F_Article,F_Famille,F_ARTSTOCK
where F_ARTICLE.FA_CodeFamille=F_FAMILLE.FA_CodeFamille
AND F_ARTICLE.AR_Ref=F_ARTSTOCK.AR_Ref
AND F_FAMILLE.FA_CodeFamille= ".$myfamille." and F_ARTSTOCK.AS_QteSto != .000000";
$rs=sqlsrv_query($conn,$sql);
if (!$rs)
{exit("Error in SQL");}
while($e=sqlsrv_fetch_object($rs))
{ $output[]=$e;}
print(json_encode($output));
?>
并使用有机碳化合物的工艺:
<?php
$myusername=$_POST[ myusername ];
$conn = odbc_connect($myusername, <Administrateur> , );
if (!$conn)
{exit("Connection Failed: " . $conn);}
$sql="SELECT FA_CodeFamille AS FA_CodeFamille,FA_Intitule AS FA_Intitule FROM F_FAMILLE";
$rs=odbc_exec($conn,$sql);
if (!$rs)
{exit("Error in SQL");}
while($e=odbc_fetch_object($rs))
{ $output[]=$e;}
print(json_encode($output));
?>
Please help me. regards
$output = array();
while($e=odbc_fetch_object($rs)) {
$output[] = $e;
}
Is working fine on many scripts i have any help please