syah
Posts: 29
|
| Posted: 02/16/2009, 5:06 PM |
|
i have a problem....i create 2 listbox..one is country and another one is location...when user choose and click the button, the record will appear in a same page...hw i write the code in button onclick and record form...? it just like hide/show the record...
|
 |
 |
damian
Posts: 838
|
| Posted: 02/18/2009, 1:24 AM |
|
why do you want to show the value in a 2nd location? when you select it in a drop down you are already showing it as the selected value?
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
syah
Posts: 29
|
| Posted: 02/18/2009, 6:06 PM |
|
now i can view when i select from the listbox...i put some code like below and i put before show in grid form....my problem is when i click from selected list box.. it's show 10 record and all are same... i just want if there have a same name, it will appear once, and go to the next record to appear...?
please somebody help me....
$subcountry_id = CCGetFromGet("subcountry_id");
$db = new clsDBhalal2all();
$SQL = "SELECT City FROM restaurant WHERE subcountry_id = $subcountry_id ";
$db->query($SQL);
$Result = $db->next_record();
if ($Result)
{
$City = $db->f("City");
}
$db->close();
$area->City->SetValue($City);
|
 |
 |
aondecker
Posts: 58
|
| Posted: 02/19/2009, 4:30 AM |
|
Quote syah:
now i can view when i select from the listbox...i put some code like below and i put before show in grid form....my problem is when i click from selected list box.. it's show 10 record and all are same... i just want if there have a same name, it will appear once, and go to the next record to appear...?
please somebody help me....
$subcountry_id = CCGetFromGet("subcountry_id");
$db = new clsDBhalal2all();
$SQL = "SELECT City FROM restaurant WHERE subcountry_id = $subcountry_id ";
$db->query($SQL);
$Result = $db->next_record();
if ($Result)
{
$City = $db->f("City");
}
$db->close();
$area->City->SetValue($City);
put the code in the before show row for the grid.. not the before show .. and every row will be different
|
 |
 |
syah
Posts: 29
|
| Posted: 02/19/2009, 4:43 PM |
|
i put that code before show row grid, but it show the same thing....
|
 |
 |
syah
Posts: 29
|
| Posted: 02/19/2009, 5:55 PM |
|
it just show the first record only and follow the same name...e.g:-
england
england
england
england.
please help.....
(beginner programmer)
|
 |
 |
damian
Posts: 838
|
| Posted: 02/19/2009, 8:46 PM |
|
try using 'unique' in your sql query....
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
aondecker
Posts: 58
|
| Posted: 02/20/2009, 4:14 AM |
|
Quote damian:
try using 'unique' in your sql query....
ah yes.. i misunderstood your question. do a
"select distinct city from restuarant where subcountry_id =".$subcountry_id;
you should probably put this as your datasource for your grid. not in the beforeshow row event i believe
|
 |
 |
syah
Posts: 29
|
| Posted: 02/22/2009, 7:16 PM |
|
hw do i can view my list of record when both country and location are selected
e.g:-
LOCATION:-Africa
COUNTRY:-South Africa
it will view a list of places in south africa...but the problm is, it only show one record and another record are same...i mean it only show one record...
i put below code in before show row, but still same
$subcountry_id = CCGetFromGet("subcountry_id");
$db = new clsDBhalal2all();
$SQL = "SELECT distinct City FROM restaurant WHERE subcountry_id = $subcountry_id ";
$db->query($SQL);
$Result = $db->next_record();
if ($Result)
{
$City = $db->f("City");
}
$db->close();
$area->City->SetValue($City
please give me some coding to know....
<beginner programmer>
|
 |
 |
damian
Posts: 838
|
| Posted: 02/28/2009, 2:12 AM |
|
have you tried using dependant list boxes?
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
syah
Posts: 29
|
| Posted: 03/01/2009, 6:25 PM |
|
i do and it succesful....i do some mistake in sql in grid...i modified the sql and it success...
|
 |
 |
damian
Posts: 838
|
| Posted: 03/01/2009, 6:51 PM |
|
which way is successful?
dependant list box builder?
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
syah
Posts: 29
|
| Posted: 03/02/2009, 6:00 PM |
|
yes. i use dependent list box builderf
|
 |
 |