I'm new to PHP.
Now I'm trying to fix PHP source other one already have worked. I succeeded to connect it with mysql using PEAR. I'm on running it on my local, with MAMP and installed XDebug as well.
Here's the problem.
$select_query = " SELECT SEQ FROM TB_VISITOR WHERE VISITOR_NAME = '$visitor_name' AND VISITOR_PHONE_NO = '$visitor_phone_no' ";
$result =& $db->query($select_query);
if( PEAR::isError($result) )
{
$result_message['result'] = false;
$result_message['error_message'] = 'Search Fail';
}else
{
if( $result->fetchInto($row) )
{
$visitor_seq = $row[0];
}
}
I think that I'm blocked here, and want to know further what the problem was. What I want to see could be expressed in JQuery as 'console.log($result);
so I tried echo, echo $result > Never worked. Of course, console.log never worked on PHP :'(
and with XDebug I tried like phpinfo(); I got error message ? on PHP logs phpinfo() expects parameter 1 to be integer, object given in /Applications/MAMP/htdocs/smartvisiting/visitor_enrollment_proc.php on line 54
so again tried phpinfo($result); nothing happened.
Please let me know how I can see of 'result' in anyway.
I'm on using Chrome dev mode, Atom as editor tool, and running PHP through MAMP.
答案 0 :(得分:0)
$select_query = " SELECT SEQ FROM TB_VISITOR WHERE VISITOR_NAME = '$visitor_name' AND VISITOR_PHONE_NO = '$visitor_phone_no' ";
$result = $db->query($select_query);
if (mysql_errno())
{
echo mysql_error();
}
else
{
if( $result->fetchInto($row) )
{
$visitor_seq = $row[0];
}
}