This topic is locked
[SOLVED]

 Code For Getting Info From Child Table

4/24/2013 7:19:48 PM
PHPRunner General questions
ladykathleen author

I am trying to effect a tables List display from a child table's data.
Here is the code I was trying to use but I am getting a php error.

The Error says the problem is this part "SELECT FeeCollected, UserID FROM CheckBefore WHERE FeeCollected = 'Yes' AND UserID = $checkid"
Can anyone see what the problem is?
Here is the full code:
global $conn;

$checkid = $data['ID'];

$strfeepaid = "SELECT FeeCollected, UserID FROM CheckBefore WHERE FeeCollected = 'Yes' AND UserID = $checkid";

$rs = db_query($strfeepaid,$conn);

$datachild = db_fetch_array($rs);

$ttl=$datachild[0];

if ($ttl)

{

$row["rowstyle"]='style="background:#009966"';

}
Thank you in Advance for any help on this.

C
cgphp 4/25/2013
global $conn;

$checkid = $data['ID'];

$strfeepaid = "SELECT FeeCollected, UserID FROM CheckBefore WHERE FeeCollected = 'Yes' AND UserID = " . $checkid;

$rs = db_query($strfeepaid,$conn);

$datachild = db_fetch_array($rs);

if($datachild)

{

$row["rowstyle"]='style="background:#009966"';

}
ladykathleen author 4/25/2013

Cristian,
Thank you it worked like a dream.