EdgarsK Posted January 28, 2010 Report Share Posted January 28, 2010 un vel viena lieta - tak ja kode, dari to skaisti lieto atkapes, tabus.. ta lai vis ir vieglak parskatamaks un pasam prieks. savadak tev tur ka sudu bedre :/ Quote Link to comment Share on other sites More sharing options...
Chapman Posted January 28, 2010 Author Report Share Posted January 28, 2010 (edited) es zinu, es pec tam vnk sakartoju kodu. a taa rakstu uz "atro" mazliet kods no php.net piemeriem: <?php // Send a select query to MSSQL $query = mssql_query('SELECT [username], [name] FROM [php].[dbo].[userlist]'); // Check if there were any records if (!mssql_num_rows($query)) { echo 'No records found'; } else { // The following is equal to the code below: // // while ($row = mssql_fetch_row($query)) { while ($row = mssql_fetch_array($query, MSSQL_NUM)) { // ... } } // Free the query result mssql_free_result($query); ?> jautajums tieshi par: ($row = mssql_fetch_array($query, MSSQL_NUM)) kas par MSSQL_NUM? kas tas ir ko un ko "ziema ēd" jeb ko dara? pašlaik ejoshais kods būtu šāds: <?php $link = mssql_connect($host, $username, $password); mssql_select_db('SecKeyPrior'); $nod_query = mssql_query('SELECT Id_Nod, Nod_Nos From S_Nod'); //naw masīvā ierakstīšanas koda, tāpēc prasu padomu jums $nod_skaits = mssql_num_rows($nod_query); echo $nod_skaits; ?> <html> <head> <script type="text/javascript"> function nod() { var mylist=document.getElementById("myList"); document.getElementById("favorite").value=mylist.options[mylist.selectedIndex].text; } </script> </head> <form> Nodaļa: <select id="myList" onchange="nod()"> <?php for ( $a = 1; $a <= $nod_skaits; $a++ ) { ?> <option> <?php /*masīva elementa izvade*/ ?> </option> <?php }?> </select> <p>N: <input type="text" id="favorite" size="20"></p> </form> kā man labāk ierakstīt Nod_nos elementus masīvā? Edited January 28, 2010 by Chapman Quote Link to comment Share on other sites More sharing options...
EdgarsK Posted January 28, 2010 Report Share Posted January 28, 2010 es arii rakstu uz atro :/ bet man nesagada problemas visu sakartot uzreiz pietam es nevaru normali pastradat ja kods ir izmetats uz visam pusem uzreiz jaiet pipet un jasez php.lv jo negribas neko darit, tieksim ta ir sobrid :/ besi :D kods ir izmetats, ir jastrada bet besis jo tagad jakarto lai vareut kautko dariit. Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted January 28, 2010 Report Share Posted January 28, 2010 EdgarsA: Kapeec fetch_array nevis fetch_assoc? mssql_... tapeec ka vinjsh lieto MSSQL nevis MySQL Kapec lietot lielos burtus? Tapec, ka ta bus vieglak uztveramas SQL komandas no parastajiem vertibam. Es gan piekritu, ka Random_Name labak ir saukt random_name. Quote Link to comment Share on other sites More sharing options...
EdgarsK Posted January 28, 2010 Report Share Posted January 28, 2010 tev rakstits ka Es programmēju HTML tad paliec pie ta;) Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted January 28, 2010 Report Share Posted January 28, 2010 laba atbilde... Quote Link to comment Share on other sites More sharing options...
Chapman Posted January 28, 2010 Author Report Share Posted January 28, 2010 (edited) viss... dab;uju gatavu: <?php $link = mssql_connect($host, $username, $password); mssql_select_db('SecKeyPrior'); $nod_query = mssql_query('SELECT Id_Nod, Nod_Nos From S_Nod'); ?> <html> <head> <script type="text/javascript"> function nod() { var mylist=document.getElementById("myList"); document.getElementById("adm_nod").value=mylist.options[mylist.selectedIndex].text; } </script> </head> <body> <center> <table class="In" > <tr> <td width="500"> <form> <table border="1" cellpadding="0" cellspacing="0"> <tr> <td width="50"> Nodaļa: </td> <td> <select id="myList" onchange="nod()"> <?php while ($row = mssql_fetch_assoc($nod_query)) { ?> <option> <?php echo $row["Nod_Nos"];?> </option> <?php }?> </select> <!--<p>N: <input type="text" id="adm_nod" size="20"></p>--> </td> </tr> <tr> <td> Vārds: </td> <td> <!--Vārda input--> </td> </tr> <tr> <td> Uzvārds: </td> <td> <!--Uzvārda input--> </td> </tr> </table> </form> </td> </tr> reuzltāts: Edited January 28, 2010 by Chapman Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.