Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Test-????
- MENIU
- <html>
- <head>
- <title>MENIU</title>
- </head>
- <body>
- <table border="3" bgcolor="#66CCFF" cellpadding="30">
- <td>
- <a href="delete.htm">Delete candidat</a> <br>
- <a href="afisare.php">Afisare candidati</a> <br>
- </td>
- </table>
- </body>
- </html>
- delete html
- <html>
- <head>
- <title>FORM STERGERE</title>
- </head>
- <body>
- <form action="delete.php" method="post">
- Id candidat de sters: <input type="text" name="id">
- <input type="submit" value="Sterge">
- <input type="reset" value="Reseteaza">
- </form>
- </body>
- </html>
- delete php
- <html>
- <head>
- <title>STERGERE</title>
- </head>
- <body>
- <?php
- $id=$_POST['id'];
- mysql_connect("localhost","root") or die ("Nu s-a efectuat conectarea");
- mysql_select_db("test") or die ("Nu se poate deschide bd");
- $check=mysql_query("select * from candidati where id=$id");
- $c=mysql_fetch_row($check);
- if(isset($c[0]))
- $query=mysql_query("delete from candidati where id=$id");
- else echo"Persoana cautata nu exista in baza de date!";
- mysql_close();
- ?>
- <br>
- <a href="index.htm">INAPOI LA MENIU</a>
- </body>
- </html>
- afisare.php
- <html>
- <head>
- <title>Afisare</title>
- </head>
- <body>
- <?php
- mysql_connect("localhost","root") or die ("Nu s-a efectuat conectarea");
- mysql_select_db("test") or die ("Nu se poate deschide bd");
- $query=mysql_query("select * from Candidati");
- echo "<table border='2'>";
- echo "<tr>";
- echo "<th> ID </th>";
- echo "<th> NUME </th>";
- echo "<th> MEDIA BAC </th>";
- echo "<th> MEDIA MULTIANUALA </th>";
- echo "</tr>";
- while($row=mysql_fetch_row($query)) {
- echo " <tr> ";
- foreach($row as $value)
- echo "<td> $value </td>";
- echo "</tr>";
- }
- $bac=mysql_query("SELECT MIN(media_bac) AS min FROM Candidati");
- $n=mysql_fetch_row($bac);
- echo " <h3> Cea mai mica medie la bacalaureat este $n[0] </h3>";
- $mate=mysql_query("SELECT MIN(media_mate) AS min FROM Candidati");
- $m=mysql_fetch_row($mate);
- echo " <h3> Cea mai mica medie multianuala la mate este $m[0] </h3>";
- mysql_close();
- ?>
- </body>
- </html>
- lab3->>>>>>>>>>>>>>>> SQL
- //meniu html
- <body>
- <form method="GET"
- action="http://localhost/introducere_studenti.php">
- <table border="3" align=”center” BGCOLOR="Silver">
- <tr>
- <td>Marca:</td>
- <td><input type="text" name="marca_form"></td>
- </tr>
- <tr>
- <td>Nume:</td>
- <td><input type="text" name="nume_form"></td>
- </tr>
- <tr>
- <td>Prenume:</td>
- <td><input type="text" name="prenume_form"></td>
- </tr>
- <tr>
- <td>An studiu:</td>
- <td>
- <select name="an_form">
- <option value="1">An 1</option>
- <option value="2">An 2</option>
- <option value="3">An 3</option>
- <option value="4">An 4</option>
- </option>
- </select>
- </td>
- </tr>
- <tr>
- <td colspan="2" align="center">
- <input type="SUBMIT" value="Add">
- <input type="RESET" value="Reset">
- </td>
- </tr>
- </table>
- </form>
- </body>
- </html>
- //conexiune php
- <body>
- <?php
- mysql_connect("localhost","root","") or die ("Nu se poate
- conecta la serverul MySQL");
- mysql_select_db("facultate") or die("Nu se poate selecta baza
- de date");
- ?>
- </body>
- </html>
- //inserare php
- <body>
- <?php
- include ("conexiune.php");
- $marca=$_GET['marca_form'];
- $nume=$_GET['nume_form'];
- $prenume=$_GET['prenume_form'];
- $an=$_GET['an_form'];
- $query=@mysql_query("select count(*) from studenti_ac where Marca=’$marca’");
- $row=@mysql_fetch_row($query);
- $nr=$row[0];
- if ($nr==0){
- $query1=@mysql_query("insert into studenti_ac values('$marca','$nume','$prenume',$an)");
- header("Location: afisare.php");
- }
- else{
- echo"<center>";
- echo "Studentul respectiv exista deja in baza de date!";
- echo"</center>";
- }
- mysql_close();
- ?>
- </body>
- </html>
- //afisare php
- <body>
- <?php
- include ("conexiune.php");
- $query2=@mysql_query("select * from studenti_ac ");
- //calculeaza nr. de inregistrari returnate prin interogare
- $nr_inreg=@mysql_num_rows($query2);
- if ($nr_inreg>0){
- echo "<table border='2' align='center'>";
- $coln=mysql_num_fields($query2); //nr. de campuri
- echo"<tr bgcolor='silver'>";
- // realizare automata a capului de tabel (continând toate câmpurile)
- for ($i=0; $i<$coln; $i++){
- //numele câmpurilor ca si cap de tabel
- $var=mysql_field_name($query2,$i);
- echo "<th> $var </th>";
- }
- echo"</tr>";
- // afiseaza inregistrarile gasite in urma interogarii
- while($row=mysql_fetch_row($query2)){
- echo"<tr>";
- foreach ($row as $value){
- echo "<td>$value</td>";
- }
- echo"</tr>";
- }
- echo"</table>";
- }
- else{
- echo"<center>";
- echo "Nu s-a gasit nici o inregistrare!!!";
- echo"</center>";
- }
- ?>
- </body>
- </html>
- //stergere html
- <body>
- <form method="POST" action="http://localhost/stergere_studenti.php">
- <table border="3" align="center" bgcolor="silver">
- <tr>
- <td>Marca:</td>
- <td>
- <input type="text" name="marca_form">
- </td>
- </tr>
- <tr>
- <td colspan="2" align="center">
- <input type="SUBMIT" value="Sterge">
- <input type="RESET" value="Anulare">
- </td>
- </tr>
- </table>
- </form>
- </body>
- </html>
- //steregere studenti php
- <body>
- <?php
- include ("conexiune.php");
- @$marca=$_POST['marca_form'];
- // cautare dupa câmpul nume a înregistrarilor care vor fi sterse
- $query=mysql_query("select * from studenti_ac where Marca='$marca' ");
- //calculeaza nr. de inregistrari returnate prin interogare
- $nr_inreg=mysql_num_rows($query);
- if ($nr_inreg>0){
- echo "<center>";
- echo "S-au gasit " . $nr_inreg . " inregistrari";
- echo"</center>";
- // creare tabela de afisare rezultate
- echo "<table border='3' align='center'>";
- //numarare campuri
- $coln=mysql_num_fields($query);
- echo"<tr bgcolor='silver'>";
- // realizare automata a capului de tabel (continând toate câmpurile)
- for ($i=0; $i<$coln; $i++){
- //numele câmpurilor ca si cap de tabel
- $var=mysql_field_name($query,$i);
- echo "<th> $var </th>";
- }
- echo"</tr>";
- // extragere informatii si afisare
- while (list ($marca,$nume,$prenume,$an) =mysql_fetch_row($query)){
- print ("<tr>" . " <td>$marca</td>" . " <td>$nume</td>" . " <td>$prenume</td>" . " <td>$an</td>" . " </tr>");
- }
- echo"</table>";
- // Apelarea scriptului de stergere efectiva/anulare (cu transmitere mai departe
- // a parametrilor de intrare, în cazul de fata ‘nume’ dupa care se face cautarea)
- echo "<form method='POST' action='http://localhost/stergere2.php'>";
- // ”pasare”, transmitere mai departe a parametrului nume ($nume)
- //sub numele ‘ nume1’
- echo "<input type='hidden' name='marca1_form' value= ".$_POST['marca_form'].">";
- echo "<input type='SUBMIT' value='Stergere efectiva'>";
- echo "</form>";
- // link pt. revenire la pagina de start si anulare stergere
- echo "<a HREF='http://localhost/stergere.html'>Renunt si revin...</a>";
- }
- else
- die("Nu gasesc nici o inregistrare ...");
- mysql_close();
- ?>
- </body>
- </html>
- //stergere 2 php
- <body>
- <?php
- include ("conexiune.php");
- @$marca1=$_POST['marca1_form'];
- // stergere efectiva
- $query =mysql_query("DELETE FROM studenti_ac where Marca='$marca1'");
- mysql_close ();
- ?>
- </body>
- </html>
- //cautare html
- <body>
- <form method="POST" action="http://localhost/Update1_Studenti.php">
- <table border="3" align="center" bgcolor="Silver">
- <tr>
- <td>Nume:</td>
- <td><input type="text" name="nume_form"></td>
- </tr>
- <tr>
- <td>Prenume:</td>
- <td><input type="text" name="prenume_form"></td>
- </tr>
- <tr>
- <td colspan=”2” align=”center”>
- <input type="SUBMIT" value="Cauta">
- <input type="RESET" value="Anulare">
- </td>
- </tr>
- </table>
- </form>
- </body>
- </html>
- //update 1 php
- <body>
- <?php
- include ("conexiune.php");
- $nume=$_POST['nume_form'];
- $prenume=$_POST['prenume_form'];
- // cautarea înregistrarii care va fi modificata
- $query=@mysql_query("select * from studenti_ac where nume='$nume' and prenume=$'prenume'");
- $nr_inreg=@mysql_num_rows($query);
- if ($nr_inreg>0){
- echo "<center>";
- echo "S-au gasit " . $nr_inreg . " inregistrari";
- echo"</center>";
- echo "<table border='2' align='center'>";
- echo"<tr bgcolor='silver'>";
- $coln=mysql_num_fields($query);
- for ($i=0; $i<$coln; $i++){
- $var=mysql_field_name($query,$i);
- echo "<th> $var </th>";
- }
- echo"</tr>";
- $nr_val=0; // contor indice array
- while ($row = mysql_fetch_row($query)){
- echo"<tr>";
- foreach ($row as $value) {
- echo "<td BGCOLOR='Yellow'> $value</td>";
- // memorare într-un sir (array) a datelor din articolul gasit
- $sir[$nr_val]=$value;
- $nr_val++;
- }
- echo "</tr>";
- }
- echo "</table>";
- // Rezolvarea este valabila pentru o singura înregistrare gasita
- // Pentru mai multe înregistrari gasite, modificarile efectuate se aplica asupra tuturor
- echo '<br><hr>'; // trasarea unei linii
- // apel script pentru modificarea efectiva
- echo "<form method='POST' action='http://localhost/Update2_Studenti.php'>";
- // transfer (ascuns) spre script a parametrilor de cautare
- echo "<input type='hidden' name='nume2_form' value=".$sir[1].">";
- echo "<input type='hidden' name='prenume2_form' value=".$sir[2].">";
- // transfer spre script ca parametrii a datelor care pot fi modificate
- echo "<table>";
- echo "<tr>";
- echo "<td>";
- echo "<input type='text' name='marca1_form' value=".$sir[0].">";
- echo "<input type='text' name='nume1_form' value=".$sir[1].">";
- echo "<input type='text' name='prenume1_form' value=".$sir[2].">";
- echo "<input type='text' name='an1_form' value=".$sir[3].">";
- echo "</td>";
- echo "</tr>";
- echo "<tr>";
- echo "<td>";
- echo "<input type='SUBMI' value='Modifica!' >";
- echo "</td>";
- echo "</tr>";
- echo "</table>";
- echo "</form>";
- // link de revenire si renuntare la modificare
- echo '<a HREF="http://localhost/cautare.html"> Renunt si revin...</a>';
- }
- else
- die ("Nu gasesc nici o inregistrare ...");
- mysql_close();
- ?>
- </body>
- </html>
- //update 2 php
- <body>
- <?php
- include ("conexiune.php");
- echo $nume2=$_POST['nume2_form'];
- echo $prenume2=$_POST['prenume2_form'];
- echo $marca1=$_POST['marca1_form'];
- echo $nume1=$_POST['nume1_form'];
- echo $prenume1=$_POST['prenume1_form'];
- echo $an1=$_POST['an1_form'];
- // modificare efectiva
- $query =mysql_query("update studenti_ac set marca='$marca1',nume='$nume1', prenume='$prenume1',an_studiu='$an1' where nume='$nume2' and prenume='$prenume2'");
- // afisare mesaj de eroare pentru date incorect introduse (daca se doreste)
- $var=mysql_error();
- echo $var;
- echo "OK, am modificat!";
- mysql_close ();
- ?>
- </body>
- </html>
- *****************************************************************************************************************
- lab4->>>>>>>>>>>>>>>>>>>>>>>>>>> oracle
- ----meniu
- <body>
- <a href="http://localhost/lab4/inserare.html">inserare </a>
- <hr>
- <a href="http://localhost/lab4/stergere.html">stergere </a>
- <hr>
- <a href="http://localhost/lab4/imprumut.html">imprumut_carte </a>
- <hr>
- <a href="http://localhost/lab4/afisare.php">afisare_carti</a>
- </body>
- </html>
- ---inserare html
- <body>
- <form method="POST"
- action="http://localhost/lab4/inserare.php">
- <table border=”3” align=”center” BGCOLOR="Silver">
- <tr>
- <td>Cod_ISBN:</td>
- <td><input type="text" name="Cod_isbn"></td>
- </tr>
- <tr>
- <td>Titlu_carte:</td>
- <td><input type="text" name="Titlu_carte"></td>
- </tr>
- <tr>
- <td>Autor_carte:</td>
- <td><input type="text" name="Autor_carte"></td>
- </tr>
- <tr>
- <td>Editura:</td>
- <td><input type="text" name="Editura"></td>
- </tr>
- <tr>
- <td>Nr_exemplare:</td>
- <td><input type="text" name="Nr_exemplare"></td>
- </tr>
- <tr>
- <td>Anul_aparitiei:</td>
- <td><input type="text" name="Anul_aparitiei"></td>
- </tr>
- <tr>
- <td colspan=”2” align=”center”>
- <input type="SUBMIT" value="Add">
- <input type="RESET" value="Reset">
- </td>
- </tr>
- </table>
- </form>
- </body>
- </html>
- ------------inserare php
- <body>
- <?php
- $connection=OCI_connect("student", "student", "xe");
- $cod_isbn=$_POST['Cod_isbn'];
- $titlu_carte=$_POST['Titlu_carte'];
- $autor_carte=$_POST['Autor_carte'];
- $editura=$_POST['Editura'];
- $nr_exemplare=$_POST['Nr_exemplare'];
- $anul_aparitiei=$_POST['Anul_aparitiei'];
- $stmt=OCI_Parse($connection,"SELECT count(*) FROM Evidenta_carti where cod_isbn='$cod_isbn'");
- OCI_Execute($stmt);
- $row=OCI_Fetch_row($stmt);
- $nr=$row[0];
- if ($nr==0){
- $stmt1=OCI_Parse($connection, "insert into Evidenta_carti values('$cod_isbn', '$titlu_carte', '$autor_carte', '$editura', $nr_exemplare, $anul_aparitiei) ");
- OCI_Execute($stmt1);
- @OCI_Free_Statement($stmt1);
- }
- else{
- echo "Cartea exista deja!";
- }
- OCI_Free_Statement($stmt);
- OCI_close($connection);
- ?>
- </body>
- </html>
- ----afisare
- <body>
- <?php
- $connection=OCI_connect("student", "student", "xe");
- $stmt=OCI_Parse($connection,"SELECT * FROM Evidenta_carti");
- OCI_Execute($stmt);
- echo "<table border='4' align='center'>";
- echo "<tr>";
- echo "<th>COD_ISBN</th>";
- echo "<th>TITLU_cARTE</th>";
- echo "<th>AUTOR_cARTE</th>";
- echo "<th>EDITURA</th>";
- echo "<th>NR_EXEMPLARE</th>";
- echo "<th>ANUL_APARITIEI</th>";
- echo "</tr>";
- while($row=OCI_Fetch_row($stmt))
- {
- print("<tr>\n".
- "<td>$row[0]</td>\n".
- "<td>$row[1]</td>\n".
- "<td>$row[2]</td>\n".
- "<td>$row[3]</td>\n".
- "<td>$row[4]</td>\n".
- "<td>$row[5]</td>\n".
- "</tr>\n");
- }
- OCI_Free_Statement($stmt);
- OCI_close($connection);
- ?>
- </body>
- </html>
- ---------------stergere html
- <body>
- <form method="GET"
- action="http://localhost/lab4/stergere.php">
- <table border=”3” align=”center” BGCOLOR="Silver">
- <tr>
- <td>Carte_de_sters:</td>
- <td><input type="text" name="Carte_de_sters"></td>
- </tr>
- <tr>
- <td colspan=”2” align=”center”>
- <input type="SUBMIT" value="Sterge">
- <input type="RESET" value="Reset">
- </td>
- </tr>
- </table>
- </form>
- </body>
- </html>
- --------------stergere php
- <body>
- <?php
- $connection=OCI_connect("student", "student", "xe");
- $numecarte=$_GET['Carte_de_sters'];
- $stmt=OCI_Parse($connection,"SELECT count(*) FROM Evidenta_carti where titlu_carte='$numecarte' ");
- @OCI_Execute($stmt);
- @$row=OCI_Fetch_row($stmt);
- $nr=$row[0];
- if ($nr==0){
- echo "Cartea nu exista !";
- }
- else
- {
- $stmt=OCI_Parse($connection,"DELETE from Evidenta_carti where titlu_carte='$numecarte' ");
- OCI_Execute($stmt);
- }
- OCI_Free_Statement($stmt);
- OCI_close($connection);
- ?>
- </body>
- </html>
- ----------------update html
- <body>
- <form method="GET"
- action="http://localhost/lab4/imprumut.php">
- <table border=”3” align=”center” BGCOLOR="Silver">
- <tr>
- <td>Carte_de_imprumutat:</td>
- <td><input type="text" name="Carte_de_imprumutat"></td>
- </tr>
- <tr>
- <td colspan=”2” align=”center”>
- <input type="SUBMIT" value="Imprumuta">
- <input type="RESET" value="Reset">
- </td>
- </tr>
- </table>
- </form>
- </body>
- </html>
- -----------update php
- <body>
- <?php
- $connection=OCI_connect("student", "student", "xe");
- $carteimprumutat=$_GET['Carte_de_imprumutat'];
- $stmt=OCI_Parse($connection,"SELECT count(*) FROM Evidenta_carti where titlu_carte='$carteimprumutat'");
- @OCI_Execute($stmt);
- @$row=OCI_Fetch_row($stmt);
- $nr=$row[0];
- if ($nr==0){
- echo "Cartea nu exista !";
- }
- else
- {
- $stmt=OCI_Parse($connection,"UPDATE Evidenta_carti SET nr_exemplare=nr_exemplare-1 WHERE titlu_carte='$carteimprumutat' ");
- OCI_Execute($stmt);
- echo "Nr de exemplare a fost decrementat!";
- }
- OCI_Free_Statement($stmt);
- OCI_close($connection);
- ?>
- </body>
- </html>
- ___________________________________************************************************************************8888888
- subiect test
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <html>
- <head>
- <title>Meniu</title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- </head>
- <body>
- <div class="menubar">
- <a href="update.php">Update</a>
- <a href="afisare.php">afisare</a>
- <a href="stergere.php">stergere</a>
- <a href="afisare2.php">afisare2</a>
- </div>
- </body>
- </html>
- ORACLE---------------
- afisare
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <html>
- <head>
- <title>afisare2</title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- </head>
- <body>
- <?php
- $connection=OCI_connect("localhost", "root", "root");
- $stmt=OCI_Parse($connection,"SELECT * FROM candidati where media_bac='10'");
- OCI_Execute($stmt);
- echo "<table border='4' align='center'>";
- echo "<tr>";
- echo "<th>id</th>";
- echo "<th>nume</th>";
- echo "<th>prenume</th>";
- echo "<th>adresa</th>";
- echo "<th>media_bac</th>";
- echo "<th>media_multianuala</th>";
- echo "</tr>";
- while($row=OCI_Fetch_row($stmt))
- {
- print("<tr>\n".
- "<td>$row[0]</td>\n".
- "<td>$row[1]</td>\n".
- "<td>$row[2]</td>\n".
- "<td>$row[3]</td>\n".
- "<td>$row[4]</td>\n".
- "<td>$row[5]</td>\n".
- "</tr>\n");
- }
- OCI_Free_Statement($stmt);
- OCI_close($connection);
- ?>
- </body>
- </html>
- stergere
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <html>
- <head>
- <title>Untitled Document</title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- </head>
- <body>
- <body>
- <form method="GET"
- action="http://localhost/stergere.php">
- <table border=”3” align=”center” BGCOLOR="Silver">
- <tr>
- <td>Student_de_sters:</td>
- <td><input type="text" name="Student_de_sters"></td>
- </tr>
- <tr>
- <td colspan=”2” align=”center”>
- <input type="SUBMIT" value="Sterge">
- <input type="RESET" value="Reset">
- </td>
- </tr>
- </table>
- </form>
- <?php
- $connection=OCI_connect("localhost", "root", "root");
- $cnp=$_GET['Student_de_sters'];
- $stmt=OCI_Parse($connection,"SELECT count(*) FROM candidati where cnp='$cnp' ");
- @OCI_Execute($stmt);
- @$row=OCI_Fetch_row($stmt);
- $nr=$row[0];
- if ($nr==0){
- echo "Studentul nu exista !";
- }
- else
- {
- $stmt=OCI_Parse($connection,"DELETE from candidati where cnp='$cnp' ");
- OCI_Execute($stmt);
- }
- OCI_Free_Statement($stmt);
- OCI_close($connection);
- ?>
- </body>
- </html>
- </body>
- </html>
- SQL------------------
- conexiune
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <html>
- <head>
- <title>conexiune</title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- </head>
- <body>
- <?php
- mysql_connect("localhost", "root", "") or die ("nu se poate conecta la server");
- mysql_select_db("admitere") or die("nu se poate conecta la baza de date");
- ?>
- </body>
- </html>
- afisare
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <html>
- <head>
- <title>afisare</title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- </head>
- <body>
- <?php
- include ("conexiune.php");
- $queryCandidati = @mysql_query("select * from candidati");
- $nr_inreg = @mysql_num_rows($queryCandidati);
- if($nr_inreg>0){
- echo "<table border='2' align 'center'>";
- $coln=mysql_num_fields($queryCandidati);
- echo "<tr bgcolor='silver'>";
- for($i=0; $i<$coln; $i++)
- {
- //numele campurilor ca si cap de tabel
- $var=mysql_field_name($queryCandidati, $i);
- echo"<th> $var</th>";
- }
- echo "</tr>";
- //afisare inregistrari gasite in urma interogarii
- while($row = mysql_fetch_row($queryCandidati)){
- echo"<tr>";
- foreach ($row as $value){
- echo"<td>$value</td>";
- }
- echo "</tr>";
- }
- echo"</table>";
- }
- else{
- echo"<center>";
- echo "Nu s au gasit inregistrari";
- echo"</center>";
- }
- ?>
- </body>
- </html>
- update1
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <html>
- <head>
- <title>Update</title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- </head>
- <body>
- <?php
- include ("conexiune.php");
- $id=$_POST['id'];
- // cautarea înregistrarii care va fi modificata
- $query=@mysql_query("select * from candidati where id='$id' ");
- $nr_inreg=@mysql_num_rows($query);
- if ($nr_inreg>0){
- echo "<center>";
- echo "S-au gasit " . $nr_inreg . " inregistrari";
- echo"</center>";
- echo "<table border='2' align='center'>";
- echo"<tr bgcolor='silver'>";
- $coln=mysql_num_fields($query);
- for ($i=0; $i<$coln; $i++){
- $var=mysql_field_name($query,$i);
- echo "<th> $var </th>";
- }
- echo"</tr>";
- $nr_val=0; // contor indice array
- while ($row = mysql_fetch_row($query)){
- echo"<tr>";
- foreach ($row as $value) {
- echo "<td BGCOLOR='Yellow'> $value</td>";
- // memorare într-un sir (array) a datelor din articolul gasit
- $sir[$nr_val]=$value;
- $nr_val++;
- }
- echo "</tr>";
- }
- echo "</table>";
- // Rezolvarea este valabila pentru o singura înregistrare gasita
- // Pentru mai multe înregistrari gasite, modificarile efectuate se aplica asupra tuturor
- echo '<br><hr>'; // trasarea unei linii
- // apel script pentru modificarea efectiva
- echo "<form method='POST' action='http://localhost/update2.php'>";
- // transfer (ascuns) spre script a parametrilor de cautare
- echo "<input type='hidden' id='id2_form' value=".$sir[1].">";
- // transfer spre script ca parametrii a datelor care pot fi modificate
- echo "<table>";
- echo "<tr>";
- echo "<td>";
- echo "<input type='text' name='media_bac1' value=".$sir[0].">";
- echo "<input type='text' name='media_multianuala1' value=".$sir[1].">";
- echo "</td>";
- echo "</tr>";
- echo "<tr>";
- echo "<td>";
- echo "<input type='SUBMI' value='Modifica!' >";
- echo "</td>";
- echo "</tr>";
- echo "</table>";
- echo "</form>";
- else
- die ("Nu gasesc nici o inregistrare ...");
- mysql_close();
- ?>
- </body>
- </html>
- update2
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <html>
- <head>
- <title>Untitled Document</title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- </head>
- <body>
- <?php
- include ("conexiune.php");
- echo $id2=$_POST['id2'];
- echo $media_bac1=$_POST['media_bac1'];
- echo $media_multianuala1=$_POST['media_multianuala1'];
- // modificare efectiva
- $query =mysql_query("update candidati set id='$id1',media_bac='$media_bac1', media_multianuala='$media_multianuala1' where id='$id2'");
- // afisare mesaj de eroare pentru date incorect introduse (daca se doreste)
- $var=mysql_error();
- echo $var;
- echo "OK, am modificat!";
- mysql_close ();
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement