Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 sql query needed

Author  Topic 

azeemaqsood
Starting Member

5 Posts

Posted - 2009-06-11 : 12:54:36
Hello to all!

I am immediately in need to know the solution to the following scenario.
There are three tables

1. clients 2. payments 3. plots

There is customer application form in which there is a field in which plotID is selected from a drop down list from the plots table containing the plot number and plot category. There is a foreign key clientID in plots table. By the time form is submitted I want to store the clientID in the plots table relatibve to the plot ID selected.
Can anybody advise please......

I will be so thankful....

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-11 : 12:57:16
which clientid do you want to save against a plot? the id of logged in client who selected the plot through screen?
Go to Top of Page

azeemaqsood
Starting Member

5 Posts

Posted - 2009-06-11 : 13:03:27
yes actually there is login system. A general form it is for submitting an application. It has all the clients table data. Except that it has an option of selecting a plot from plots table which is done by plotID. Now the primary key in clients table is clientID and it is also a foreign in plots table.
I just want that when a plot is selected by the applicant then its client id should be saved in the plots table relative to the plotID selected. I am getting the posted value of plotID from the app form and stored it in variable named $plotID. but dont know how to use it..
The existing query is as follows
---------------------------------------------------

$sql = "INSERT INTO clients";
$sql .= "(img_path,scan_copy_path,date_issue,username,fhname,gender,nic_no,nicop_no,passport_no,place_issue,present_address,pak_address,phone_off,fax,email,phone_res,cpp_name,cpp_phone,cpp_address)";
$sql .= "VALUES ('".$imgrand."_$largeimg_name','".$img2rand."_$largeimg2_name', '$issueDate', '$username', '$fhname','$gender','$nic_no','$nicop_no','$passport_no','$place_issue','$present_address','$pak_address','$phone_off','$fax','$email','$phone_res','$cpp_name','$cpp_phone','$cpp_address')";
$result = mysql_query($sql) or die(mysql_error());
$msg= "Thank you. You have been successfully registered to our database.<br/>";
echo $msg;

___________________________________________________

Please advise...
Best regards
Azeem
Go to Top of Page

azeemaqsood
Starting Member

5 Posts

Posted - 2009-06-11 : 13:11:28
quote:
Originally posted by visakh16

which clientid do you want to save against a plot? the id of logged in client who selected the plot through screen?



Yes if such is the case tell me the solution as there is no login system and no session established just a form with the values stored in db....
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-11 : 13:15:57
then take the client info from login and then save the clientid corresponding to that in clientid field.
Go to Top of Page

azeemaqsood
Starting Member

5 Posts

Posted - 2009-06-11 : 13:26:24
quote:
Originally posted by visakh16

then take the client info from login and then save the clientid corresponding to that in clientid field.




actually there is no login table...All you have is a login application form...????
so what else i can do?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-11 : 13:29:10
then how do you identify who has currently logged in?
Go to Top of Page

azeemaqsood
Starting Member

5 Posts

Posted - 2009-06-11 : 13:35:04
quote:
Originally posted by visakh16

then how do you identify who has currently logged in?




Like i said there is no login system..There are no online payments made by the customers. Its only a form once they fill their details and select the plots the values are stored in database and then there is an admin interface where the admin will add the payments details received to him manually.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-11 : 13:43:34
i think what you need to maintain is some kind of login info and then identify the logged in users based on that and determine clientid to be save for them.
Go to Top of Page
   

- Advertisement -