[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
www.dhtmlgoodies.com • View topic - Client lookup with display multiple recordset on the form
Page 1 of 1

Client lookup with display multiple recordset on the form

PostPosted: Thu Jun 05, 2008 5:19 am
by some
Hi U all, Please please help,
I have been trying to retrieve multiple record set in the form but no avail.

Here is what i would like to do-

the basic is I have 2 tables

table1: have----------- ClientID, firstname, lastname
1 , tom , Duong

table2: have-------------ClientID, order_type,
1 , A
1 , B
1 , C

after i enter in clientID and hit tab I would like to display on form ClientID, firstname, lastname and 3 order_type A,B and C.

I got it to work ClientID, firstname, lastname but I don't know how retrieve all 3 order_type A,B and C.

Please help me, thank you so much in advance..

PostPosted: Thu Jun 05, 2008 8:00 am
by saintSR
I'm not sure if it would work but: in your php file do a second query on the ID in the second table and echo those values.



.

PostPosted: Thu Jun 05, 2008 4:08 pm
by some
Thank you very much for your quick respond.
I'm not sure how I can write back to the form with the second table,..

here is my php file:

<?php

if(isset($_GET['getClientId'])){

$sql="SELECT table1.ClientID, table1.firstname, table1.lastname, table2.order_type
FROM table1, table2
WHERE table1.ClientID = table2.ClientID";
AND table1.ClientID ='".$_GET['getClientId']."'

$res = mssql_query($sql);
if($inf = mssql_fetch_array($res)) {

echo "formObj.ClientID.value = '".$inf['ClientID']."';\n";
echo "formObj.firstname.value = '".$inf['firstname']."';\n";
echo "formObj.lastname.value = '".$inf['lastname']."';\n";
while ($inf=mssql_fetch_array($res))
{
echo "formObj.order_type.value = '".$inf['ordertype']."';\n";
}

}else{

echo "formObj.ClientID.value = '';\n";
echo "formObj.firstname.value = '';\n";
echo "formObj.lastname.value = '';\n";
echo "formObj.ordertype.value = '';\n";
}
}
?>

By doing this way I only get the last record set (order_type = C). I just thinking after the while loops we need to append the result in to string and set the texbox = to that String....what do you think? If this making sense to you. Would you help me come up with the coding, I could not come up with the right syntax to make it work.

Thanks a lot,
Some

PostPosted: Thu Jun 05, 2008 9:18 pm
by saintSR

PostPosted: Thu Jun 05, 2008 10:19 pm
by some

PostPosted: Thu Jun 05, 2008 10:33 pm
by saintSR