SQL SELECT IN HOOK

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
igimanigi
Posts: 11
Joined: 2016-11-30 18:24

SQL SELECT IN HOOK

Post by igimanigi » 2016-12-14 11:00

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.

TheSpooki
Posts: 14
Joined: 2016-05-19 13:29

Re: SQL SELECT IN HOOK

Post by TheSpooki » 2016-12-14 13:35

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

Post Reply