Page 1 of 1

SQL SELECT IN HOOK

Posted: 2016-12-14 11:00
by igimanigi
i am still new at appgini and i have encountered this situation. I have the following code trying to retrieve Patient details;

$res = sql("SELECT Name,Address,Email,Patient_Phone FROM Patient WHERE ID=".$data['Patient_ID'],$eo);


if(mysql_num_rows($res)){

while($row = mysql_fetch_row($res)){

$data['Patient_Name'] = $row[0];
$data['Patient_Address'] = $row[1];
$data['Patient_Email'] = $row[2];
$data['Patient_Phone'] = $row[3];

}

}

This code is not running beyond the if statement meaning the $res object is does not have anything. What should I do to make it work. My table definitely has data.

Re: SQL SELECT IN HOOK

Posted: 2016-12-14 13:35
by TheSpooki
I'm not sure but I think appgini changes

Code: Select all

mysql_num_rows
and

Code: Select all

mysql_fetch_row
to

Code: Select all

if(db_num_rows($res)){

while($row = db_fetch_row($res)){
instead of

Code: Select all

mysql_fetch_row
shouldn't it be

Code: Select all

db_fetch_assoc
Worth a shot though
Thanks,
Joe