|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi,
I have problem with php and MSSQL I have a combobox with the name of 10 company and in my database i have 1 table different for each company. I need that when the user choose in the combobox one of this company appeard the table with the data. I think that I found part of the code that I need but i have no idea how do that now Please me! <?php session_start(); set_time_limit(0); error_reporting(E_ALL); //complete "stationsqlexpress" with your particular case $SERVER = "stationsqlexpress"; $ADMIN_NAME = "sa"; //complete pass with your pass $ADMIN_PASS = "pass"; //complete database witht the name of database you whant to connect to $DATABASE = "database"; $Conexion = mssql_connect($SERVER, $ADMIN_NAME, $ADMIN_PASS) or die ("Can't connect to Microsoft SQL Server"); mssql_select_db($DATABASE, $Conexion) or die ("Can't connect to Database"); ?> <form name="modulo"> <select name="colori" onchange="SelectPost()"> <option value=""></option> <option value="ROSSO">ROSSO</option> <option value="GIALLO">GIALLO</option> <option value="VERDE">VERDE</option> <option value="BLU">BLU</option> </select> </form> <?php $sql="SELECT * FROM anagrafe; $oggetto = $mssql->runquery($sql); $mssql->closeDb(); print ($oggetto); ?> thanks Lidia |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Mar 8, 12:08 am, lid...@gmail.com wrote:
> Hi, > > I have problem with php and MSSQL > > I have a combobox with the name of 10 company and in my database i > have 1 table different for each company. > > I need that when the user choose in the combobox one of this company > appeard the table with the data. > > I think that I found part of the code that I need but i have no idea > how do that now > > Please me! > > <?php > session_start(); > set_time_limit(0); > error_reporting(E_ALL); > > //complete "stationsqlexpress" with your particular case > $SERVER = "stationsqlexpress"; > $ADMIN_NAME = "sa"; > //complete pass with your pass > $ADMIN_PASS = "pass"; > //complete database witht the name of database you whant to > connect to > $DATABASE = "database"; > > $Conexion = mssql_connect($SERVER, $ADMIN_NAME, $ADMIN_PASS) > or die ("Can't connect to Microsoft SQL Server"); > > mssql_select_db($DATABASE, $Conexion) > or die ("Can't connect to Database"); > ?> > > <form name="modulo"> > <select name="colori" onchange="SelectPost()"> > <option value=""></option> > <option value="ROSSO">ROSSO</option> > <option value="GIALLO">GIALLO</option> > <option value="VERDE">VERDE</option> > <option value="BLU">BLU</option> > </select> > </form> > > <?php > $sql="SELECT * FROM anagrafe; > $oggetto = $mssql->runquery($sql); > $mssql->closeDb(); > print ($oggetto); > ?> > > thanks Lidia Youve got a lot of reading to do. Youre going to need to assign an onChange="yourfunctionname();" event to the select box, and then do an ajax call to a script that will query the database and return the second set of data for the next box. Read about JQuery, AJAX, and javascript events. |
|
![]() |
| Outils de la discussion | |
|
|