Advertisement
Guest User

Untitled

a guest
Dec 16th, 2019
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.66 KB | None | 0 0
  1. Test-????
  2. MENIU
  3.  
  4.  
  5. <html>
  6. <head>
  7. <title>MENIU</title>
  8.  
  9. </head>
  10.  
  11. <body>
  12. <table border="3" bgcolor="#66CCFF" cellpadding="30">
  13. <td>
  14. <a href="delete.htm">Delete candidat</a> <br>
  15. <a href="afisare.php">Afisare candidati</a> <br>
  16. </td>
  17. </table>
  18. </body>
  19. </html>
  20.  
  21.  
  22. delete html
  23.  
  24. <html>
  25. <head>
  26. <title>FORM STERGERE</title>
  27.  
  28. </head>
  29.  
  30. <body>
  31. <form action="delete.php" method="post">
  32. Id candidat de sters: <input type="text" name="id">
  33. <input type="submit" value="Sterge">
  34. <input type="reset" value="Reseteaza">
  35. </form>
  36. </body>
  37. </html>
  38.  
  39.  
  40. delete php
  41.  
  42.  
  43. <html>
  44. <head>
  45. <title>STERGERE</title>
  46.  
  47. </head>
  48.  
  49. <body>
  50. <?php
  51. $id=$_POST['id'];
  52. mysql_connect("localhost","root") or die ("Nu s-a efectuat conectarea");
  53. mysql_select_db("test") or die ("Nu se poate deschide bd");
  54. $check=mysql_query("select * from candidati where id=$id");
  55. $c=mysql_fetch_row($check);
  56. if(isset($c[0]))
  57. $query=mysql_query("delete from candidati where id=$id");
  58. else echo"Persoana cautata nu exista in baza de date!";
  59. mysql_close();
  60. ?>
  61. <br>
  62. <a href="index.htm">INAPOI LA MENIU</a>
  63. </body>
  64. </html>
  65.  
  66.  
  67. afisare.php
  68.  
  69. <html>
  70. <head>
  71. <title>Afisare</title>
  72.  
  73. </head>
  74.  
  75. <body>
  76. <?php
  77. mysql_connect("localhost","root") or die ("Nu s-a efectuat conectarea");
  78. mysql_select_db("test") or die ("Nu se poate deschide bd");
  79. $query=mysql_query("select * from Candidati");
  80. echo "<table border='2'>";
  81. echo "<tr>";
  82. echo "<th> ID </th>";
  83. echo "<th> NUME </th>";
  84. echo "<th> MEDIA BAC </th>";
  85. echo "<th> MEDIA MULTIANUALA </th>";
  86. echo "</tr>";
  87. while($row=mysql_fetch_row($query)) {
  88. echo " <tr> ";
  89. foreach($row as $value)
  90. echo "<td> $value </td>";
  91. echo "</tr>";
  92. }
  93. $bac=mysql_query("SELECT MIN(media_bac) AS min FROM Candidati");
  94. $n=mysql_fetch_row($bac);
  95. echo " <h3> Cea mai mica medie la bacalaureat este $n[0] </h3>";
  96.  
  97. $mate=mysql_query("SELECT MIN(media_mate) AS min FROM Candidati");
  98. $m=mysql_fetch_row($mate);
  99. echo " <h3> Cea mai mica medie multianuala la mate este $m[0] </h3>";
  100.  
  101. mysql_close();
  102. ?>
  103. </body>
  104. </html>
  105.  
  106. lab3->>>>>>>>>>>>>>>> SQL
  107.  
  108. //meniu html
  109. <body>
  110. <form method="GET"
  111. action="http://localhost/introducere_studenti.php">
  112. <table border="3" align=”center” BGCOLOR="Silver">
  113. <tr>
  114. <td>Marca:</td>
  115. <td><input type="text" name="marca_form"></td>
  116. </tr>
  117. <tr>
  118. <td>Nume:</td>
  119. <td><input type="text" name="nume_form"></td>
  120. </tr>
  121. <tr>
  122. <td>Prenume:</td>
  123. <td><input type="text" name="prenume_form"></td>
  124. </tr>
  125. <tr>
  126. <td>An studiu:</td>
  127. <td>
  128. <select name="an_form">
  129. <option value="1">An 1</option>
  130. <option value="2">An 2</option>
  131. <option value="3">An 3</option>
  132. <option value="4">An 4</option>
  133. </option>
  134. </select>
  135. </td>
  136. </tr>
  137. <tr>
  138. <td colspan="2" align="center">
  139. <input type="SUBMIT" value="Add">
  140. <input type="RESET" value="Reset">
  141. </td>
  142. </tr>
  143. </table>
  144. </form>
  145. </body>
  146. </html>
  147.  
  148. //conexiune php
  149. <body>
  150. <?php
  151. mysql_connect("localhost","root","") or die ("Nu se poate
  152. conecta la serverul MySQL");
  153. mysql_select_db("facultate") or die("Nu se poate selecta baza
  154. de date");
  155.  
  156. ?>
  157. </body>
  158. </html>
  159.  
  160. //inserare php
  161. <body>
  162. <?php
  163. include ("conexiune.php");
  164.  
  165. $marca=$_GET['marca_form'];
  166. $nume=$_GET['nume_form'];
  167. $prenume=$_GET['prenume_form'];
  168. $an=$_GET['an_form'];
  169.  
  170. $query=@mysql_query("select count(*) from studenti_ac where Marca=’$marca’");
  171. $row=@mysql_fetch_row($query);
  172. $nr=$row[0];
  173. if ($nr==0){
  174. $query1=@mysql_query("insert into studenti_ac values('$marca','$nume','$prenume',$an)");
  175.  
  176. header("Location: afisare.php");
  177.  
  178. }
  179. else{
  180. echo"<center>";
  181. echo "Studentul respectiv exista deja in baza de date!";
  182. echo"</center>";
  183. }
  184. mysql_close();
  185. ?>
  186.  
  187. </body>
  188. </html>
  189.  
  190. //afisare php
  191. <body>
  192. <?php
  193. include ("conexiune.php");
  194.  
  195. $query2=@mysql_query("select * from studenti_ac ");
  196.  
  197. //calculeaza nr. de inregistrari returnate prin interogare
  198. $nr_inreg=@mysql_num_rows($query2);
  199.  
  200. if ($nr_inreg>0){
  201. echo "<table border='2' align='center'>";
  202. $coln=mysql_num_fields($query2); //nr. de campuri
  203. echo"<tr bgcolor='silver'>";
  204.  
  205. // realizare automata a capului de tabel (continând toate câmpurile)
  206. for ($i=0; $i<$coln; $i++){
  207. //numele câmpurilor ca si cap de tabel
  208. $var=mysql_field_name($query2,$i);
  209. echo "<th> $var </th>";
  210. }
  211. echo"</tr>";
  212.  
  213. // afiseaza inregistrarile gasite in urma interogarii
  214. while($row=mysql_fetch_row($query2)){
  215. echo"<tr>";
  216. foreach ($row as $value){
  217. echo "<td>$value</td>";
  218. }
  219. echo"</tr>";
  220. }
  221. echo"</table>";
  222. }
  223. else{
  224. echo"<center>";
  225. echo "Nu s-a gasit nici o inregistrare!!!";
  226. echo"</center>";
  227. }
  228.  
  229. ?>
  230.  
  231. </body>
  232. </html>
  233.  
  234. //stergere html
  235. <body>
  236. <form method="POST" action="http://localhost/stergere_studenti.php">
  237. <table border="3" align="center" bgcolor="silver">
  238. <tr>
  239. <td>Marca:</td>
  240. <td>
  241. <input type="text" name="marca_form">
  242. </td>
  243. </tr>
  244. <tr>
  245. <td colspan="2" align="center">
  246. <input type="SUBMIT" value="Sterge">
  247. <input type="RESET" value="Anulare">
  248. </td>
  249. </tr>
  250. </table>
  251. </form>
  252. </body>
  253. </html>
  254.  
  255. //steregere studenti php
  256. <body>
  257. <?php
  258.  
  259. include ("conexiune.php");
  260.  
  261. @$marca=$_POST['marca_form'];
  262.  
  263. // cautare dupa câmpul nume a înregistrarilor care vor fi sterse
  264. $query=mysql_query("select * from studenti_ac where Marca='$marca' ");
  265.  
  266. //calculeaza nr. de inregistrari returnate prin interogare
  267. $nr_inreg=mysql_num_rows($query);
  268.  
  269. if ($nr_inreg>0){
  270. echo "<center>";
  271. echo "S-au gasit " . $nr_inreg . " inregistrari";
  272. echo"</center>";
  273.  
  274. // creare tabela de afisare rezultate
  275. echo "<table border='3' align='center'>";
  276. //numarare campuri
  277. $coln=mysql_num_fields($query);
  278. echo"<tr bgcolor='silver'>";
  279. // realizare automata a capului de tabel (continând toate câmpurile)
  280. for ($i=0; $i<$coln; $i++){
  281. //numele câmpurilor ca si cap de tabel
  282. $var=mysql_field_name($query,$i);
  283. echo "<th> $var </th>";
  284. }
  285. echo"</tr>";
  286. // extragere informatii si afisare
  287. while (list ($marca,$nume,$prenume,$an) =mysql_fetch_row($query)){
  288. print ("<tr>" . " <td>$marca</td>" . " <td>$nume</td>" . " <td>$prenume</td>" . " <td>$an</td>" . " </tr>");
  289. }
  290. echo"</table>";
  291.  
  292. // Apelarea scriptului de stergere efectiva/anulare (cu transmitere mai departe
  293. // a parametrilor de intrare, în cazul de fata ‘nume’ dupa care se face cautarea)
  294.  
  295. echo "<form method='POST' action='http://localhost/stergere2.php'>";
  296.  
  297. // ”pasare”, transmitere mai departe a parametrului nume ($nume)
  298. //sub numele ‘ nume1’
  299.  
  300. echo "<input type='hidden' name='marca1_form' value= ".$_POST['marca_form'].">";
  301. echo "<input type='SUBMIT' value='Stergere efectiva'>";
  302. echo "</form>";
  303. // link pt. revenire la pagina de start si anulare stergere
  304. echo "<a HREF='http://localhost/stergere.html'>Renunt si revin...</a>";
  305. }
  306. else
  307. die("Nu gasesc nici o inregistrare ...");
  308. mysql_close();
  309. ?>
  310.  
  311. </body>
  312. </html>
  313.  
  314.  
  315. //stergere 2 php
  316. <body>
  317. <?php
  318. include ("conexiune.php");
  319. @$marca1=$_POST['marca1_form'];
  320. // stergere efectiva
  321. $query =mysql_query("DELETE FROM studenti_ac where Marca='$marca1'");
  322. mysql_close ();
  323. ?>
  324.  
  325. </body>
  326. </html>
  327.  
  328. //cautare html
  329. <body>
  330. <form method="POST" action="http://localhost/Update1_Studenti.php">
  331. <table border="3" align="center" bgcolor="Silver">
  332. <tr>
  333. <td>Nume:</td>
  334. <td><input type="text" name="nume_form"></td>
  335. </tr>
  336. <tr>
  337. <td>Prenume:</td>
  338. <td><input type="text" name="prenume_form"></td>
  339. </tr>
  340. <tr>
  341. <td colspan=”2” align=”center”>
  342. <input type="SUBMIT" value="Cauta">
  343. <input type="RESET" value="Anulare">
  344. </td>
  345. </tr>
  346. </table>
  347. </form>
  348.  
  349. </body>
  350. </html>
  351.  
  352. //update 1 php
  353. <body>
  354. <?php
  355. include ("conexiune.php");
  356. $nume=$_POST['nume_form'];
  357. $prenume=$_POST['prenume_form'];
  358.  
  359. // cautarea înregistrarii care va fi modificata
  360. $query=@mysql_query("select * from studenti_ac where nume='$nume' and prenume=$'prenume'");
  361.  
  362. $nr_inreg=@mysql_num_rows($query);
  363.  
  364. if ($nr_inreg>0){
  365. echo "<center>";
  366. echo "S-au gasit " . $nr_inreg . " inregistrari";
  367. echo"</center>";
  368.  
  369. echo "<table border='2' align='center'>";
  370. echo"<tr bgcolor='silver'>";
  371. $coln=mysql_num_fields($query);
  372.  
  373. for ($i=0; $i<$coln; $i++){
  374. $var=mysql_field_name($query,$i);
  375. echo "<th> $var </th>";
  376. }
  377. echo"</tr>";
  378.  
  379. $nr_val=0; // contor indice array
  380. while ($row = mysql_fetch_row($query)){
  381. echo"<tr>";
  382. foreach ($row as $value) {
  383. echo "<td BGCOLOR='Yellow'> $value</td>";
  384. // memorare într-un sir (array) a datelor din articolul gasit
  385. $sir[$nr_val]=$value;
  386. $nr_val++;
  387. }
  388. echo "</tr>";
  389. }
  390. echo "</table>";
  391.  
  392. // Rezolvarea este valabila pentru o singura înregistrare gasita
  393. // Pentru mai multe înregistrari gasite, modificarile efectuate se aplica asupra tuturor
  394. echo '<br><hr>'; // trasarea unei linii
  395.  
  396. // apel script pentru modificarea efectiva
  397. echo "<form method='POST' action='http://localhost/Update2_Studenti.php'>";
  398.  
  399. // transfer (ascuns) spre script a parametrilor de cautare
  400. echo "<input type='hidden' name='nume2_form' value=".$sir[1].">";
  401. echo "<input type='hidden' name='prenume2_form' value=".$sir[2].">";
  402.  
  403. // transfer spre script ca parametrii a datelor care pot fi modificate
  404. echo "<table>";
  405. echo "<tr>";
  406. echo "<td>";
  407. echo "<input type='text' name='marca1_form' value=".$sir[0].">";
  408. echo "<input type='text' name='nume1_form' value=".$sir[1].">";
  409. echo "<input type='text' name='prenume1_form' value=".$sir[2].">";
  410. echo "<input type='text' name='an1_form' value=".$sir[3].">";
  411. echo "</td>";
  412. echo "</tr>";
  413. echo "<tr>";
  414. echo "<td>";
  415. echo "<input type='SUBMI' value='Modifica!' >";
  416. echo "</td>";
  417. echo "</tr>";
  418. echo "</table>";
  419. echo "</form>";
  420.  
  421. // link de revenire si renuntare la modificare
  422. echo '<a HREF="http://localhost/cautare.html"> Renunt si revin...</a>';
  423. }
  424. else
  425. die ("Nu gasesc nici o inregistrare ...");
  426. mysql_close();
  427. ?>
  428. </body>
  429. </html>
  430.  
  431. //update 2 php
  432. <body>
  433. <?php
  434. include ("conexiune.php");
  435. echo $nume2=$_POST['nume2_form'];
  436. echo $prenume2=$_POST['prenume2_form'];
  437. echo $marca1=$_POST['marca1_form'];
  438. echo $nume1=$_POST['nume1_form'];
  439. echo $prenume1=$_POST['prenume1_form'];
  440. echo $an1=$_POST['an1_form'];
  441. // modificare efectiva
  442. $query =mysql_query("update studenti_ac set marca='$marca1',nume='$nume1', prenume='$prenume1',an_studiu='$an1' where nume='$nume2' and prenume='$prenume2'");
  443.  
  444. // afisare mesaj de eroare pentru date incorect introduse (daca se doreste)
  445. $var=mysql_error();
  446. echo $var;
  447. echo "OK, am modificat!";
  448. mysql_close ();
  449. ?>
  450. </body>
  451. </html>
  452. *****************************************************************************************************************
  453.  
  454. lab4->>>>>>>>>>>>>>>>>>>>>>>>>>> oracle
  455.  
  456. ----meniu
  457. <body>
  458. <a href="http://localhost/lab4/inserare.html">inserare </a>
  459. <hr>
  460. <a href="http://localhost/lab4/stergere.html">stergere </a>
  461. <hr>
  462. <a href="http://localhost/lab4/imprumut.html">imprumut_carte </a>
  463. <hr>
  464. <a href="http://localhost/lab4/afisare.php">afisare_carti</a>
  465.  
  466. </body>
  467. </html>
  468.  
  469.  
  470. ---inserare html
  471. <body>
  472. <form method="POST"
  473. action="http://localhost/lab4/inserare.php">
  474. <table border=”3” align=”center” BGCOLOR="Silver">
  475. <tr>
  476. <td>Cod_ISBN:</td>
  477. <td><input type="text" name="Cod_isbn"></td>
  478. </tr>
  479. <tr>
  480. <td>Titlu_carte:</td>
  481. <td><input type="text" name="Titlu_carte"></td>
  482. </tr>
  483. <tr>
  484. <td>Autor_carte:</td>
  485. <td><input type="text" name="Autor_carte"></td>
  486. </tr>
  487. <tr>
  488. <td>Editura:</td>
  489. <td><input type="text" name="Editura"></td>
  490. </tr>
  491. <tr>
  492. <td>Nr_exemplare:</td>
  493. <td><input type="text" name="Nr_exemplare"></td>
  494. </tr>
  495. <tr>
  496. <td>Anul_aparitiei:</td>
  497. <td><input type="text" name="Anul_aparitiei"></td>
  498. </tr>
  499. <tr>
  500. <td colspan=”2” align=”center”>
  501. <input type="SUBMIT" value="Add">
  502. <input type="RESET" value="Reset">
  503. </td>
  504. </tr>
  505. </table>
  506. </form>
  507. </body>
  508. </html>
  509. ------------inserare php
  510. <body>
  511. <?php
  512. $connection=OCI_connect("student", "student", "xe");
  513.  
  514. $cod_isbn=$_POST['Cod_isbn'];
  515. $titlu_carte=$_POST['Titlu_carte'];
  516. $autor_carte=$_POST['Autor_carte'];
  517. $editura=$_POST['Editura'];
  518. $nr_exemplare=$_POST['Nr_exemplare'];
  519. $anul_aparitiei=$_POST['Anul_aparitiei'];
  520.  
  521. $stmt=OCI_Parse($connection,"SELECT count(*) FROM Evidenta_carti where cod_isbn='$cod_isbn'");
  522. OCI_Execute($stmt);
  523. $row=OCI_Fetch_row($stmt);
  524. $nr=$row[0];
  525. if ($nr==0){
  526.  
  527.  
  528. $stmt1=OCI_Parse($connection, "insert into Evidenta_carti values('$cod_isbn', '$titlu_carte', '$autor_carte', '$editura', $nr_exemplare, $anul_aparitiei) ");
  529. OCI_Execute($stmt1);
  530. @OCI_Free_Statement($stmt1);
  531.  
  532. }
  533. else{
  534. echo "Cartea exista deja!";
  535. }
  536. OCI_Free_Statement($stmt);
  537. OCI_close($connection);
  538. ?>
  539.  
  540. </body>
  541. </html>
  542. ----afisare
  543. <body>
  544. <?php
  545. $connection=OCI_connect("student", "student", "xe");
  546. $stmt=OCI_Parse($connection,"SELECT * FROM Evidenta_carti");
  547. OCI_Execute($stmt);
  548.  
  549. echo "<table border='4' align='center'>";
  550. echo "<tr>";
  551. echo "<th>COD_ISBN</th>";
  552. echo "<th>TITLU_cARTE</th>";
  553. echo "<th>AUTOR_cARTE</th>";
  554. echo "<th>EDITURA</th>";
  555. echo "<th>NR_EXEMPLARE</th>";
  556. echo "<th>ANUL_APARITIEI</th>";
  557. echo "</tr>";
  558. while($row=OCI_Fetch_row($stmt))
  559. {
  560. print("<tr>\n".
  561. "<td>$row[0]</td>\n".
  562. "<td>$row[1]</td>\n".
  563. "<td>$row[2]</td>\n".
  564. "<td>$row[3]</td>\n".
  565. "<td>$row[4]</td>\n".
  566. "<td>$row[5]</td>\n".
  567. "</tr>\n");
  568. }
  569. OCI_Free_Statement($stmt);
  570. OCI_close($connection);
  571. ?>
  572. </body>
  573. </html>
  574.  
  575. ---------------stergere html
  576. <body>
  577. <form method="GET"
  578. action="http://localhost/lab4/stergere.php">
  579. <table border=”3” align=”center” BGCOLOR="Silver">
  580. <tr>
  581. <td>Carte_de_sters:</td>
  582. <td><input type="text" name="Carte_de_sters"></td>
  583. </tr>
  584. <tr>
  585. <td colspan=”2” align=”center”>
  586. <input type="SUBMIT" value="Sterge">
  587. <input type="RESET" value="Reset">
  588. </td>
  589. </tr>
  590. </table>
  591. </form>
  592. </body>
  593. </html>
  594. --------------stergere php
  595. <body>
  596. <?php
  597. $connection=OCI_connect("student", "student", "xe");
  598. $numecarte=$_GET['Carte_de_sters'];
  599. $stmt=OCI_Parse($connection,"SELECT count(*) FROM Evidenta_carti where titlu_carte='$numecarte' ");
  600. @OCI_Execute($stmt);
  601. @$row=OCI_Fetch_row($stmt);
  602. $nr=$row[0];
  603. if ($nr==0){
  604. echo "Cartea nu exista !";
  605. }
  606. else
  607. {
  608. $stmt=OCI_Parse($connection,"DELETE from Evidenta_carti where titlu_carte='$numecarte' ");
  609. OCI_Execute($stmt);
  610. }
  611. OCI_Free_Statement($stmt);
  612. OCI_close($connection);
  613. ?>
  614. </body>
  615. </html>
  616. ----------------update html
  617. <body>
  618. <form method="GET"
  619. action="http://localhost/lab4/imprumut.php">
  620. <table border=”3” align=”center” BGCOLOR="Silver">
  621. <tr>
  622. <td>Carte_de_imprumutat:</td>
  623. <td><input type="text" name="Carte_de_imprumutat"></td>
  624. </tr>
  625. <tr>
  626. <td colspan=”2” align=”center”>
  627. <input type="SUBMIT" value="Imprumuta">
  628. <input type="RESET" value="Reset">
  629. </td>
  630. </tr>
  631. </table>
  632. </form>
  633. </body>
  634. </html>
  635.  
  636. -----------update php
  637. <body>
  638. <?php
  639. $connection=OCI_connect("student", "student", "xe");
  640. $carteimprumutat=$_GET['Carte_de_imprumutat'];
  641. $stmt=OCI_Parse($connection,"SELECT count(*) FROM Evidenta_carti where titlu_carte='$carteimprumutat'");
  642. @OCI_Execute($stmt);
  643. @$row=OCI_Fetch_row($stmt);
  644. $nr=$row[0];
  645. if ($nr==0){
  646. echo "Cartea nu exista !";
  647. }
  648. else
  649. {
  650. $stmt=OCI_Parse($connection,"UPDATE Evidenta_carti SET nr_exemplare=nr_exemplare-1 WHERE titlu_carte='$carteimprumutat' ");
  651. OCI_Execute($stmt);
  652. echo "Nr de exemplare a fost decrementat!";
  653. }
  654. OCI_Free_Statement($stmt);
  655. OCI_close($connection);
  656. ?>
  657. </body>
  658. </html>
  659.  
  660. ___________________________________************************************************************************8888888
  661.  
  662. subiect test
  663.  
  664.  
  665.  
  666.  
  667. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  668. <html>
  669. <head>
  670. <title>Meniu</title>
  671. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  672. </head>
  673.  
  674. <body>
  675. <div class="menubar">
  676. <a href="update.php">Update</a>
  677. <a href="afisare.php">afisare</a>
  678. <a href="stergere.php">stergere</a>
  679. <a href="afisare2.php">afisare2</a>
  680. </div>
  681. </body>
  682. </html>
  683.  
  684.  
  685.  
  686.  
  687. ORACLE---------------
  688.  
  689. afisare
  690.  
  691. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  692. <html>
  693. <head>
  694. <title>afisare2</title>
  695. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  696. </head>
  697.  
  698. <body>
  699. <?php
  700. $connection=OCI_connect("localhost", "root", "root");
  701. $stmt=OCI_Parse($connection,"SELECT * FROM candidati where media_bac='10'");
  702. OCI_Execute($stmt);
  703.  
  704. echo "<table border='4' align='center'>";
  705. echo "<tr>";
  706. echo "<th>id</th>";
  707. echo "<th>nume</th>";
  708. echo "<th>prenume</th>";
  709. echo "<th>adresa</th>";
  710. echo "<th>media_bac</th>";
  711. echo "<th>media_multianuala</th>";
  712. echo "</tr>";
  713. while($row=OCI_Fetch_row($stmt))
  714. {
  715. print("<tr>\n".
  716. "<td>$row[0]</td>\n".
  717. "<td>$row[1]</td>\n".
  718. "<td>$row[2]</td>\n".
  719. "<td>$row[3]</td>\n".
  720. "<td>$row[4]</td>\n".
  721. "<td>$row[5]</td>\n".
  722. "</tr>\n");
  723. }
  724. OCI_Free_Statement($stmt);
  725. OCI_close($connection);
  726. ?>
  727. </body>
  728. </html>
  729.  
  730.  
  731. stergere
  732.  
  733. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  734. <html>
  735. <head>
  736. <title>Untitled Document</title>
  737. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  738. </head>
  739.  
  740. <body>
  741. <body>
  742. <form method="GET"
  743. action="http://localhost/stergere.php">
  744. <table border=”3” align=”center” BGCOLOR="Silver">
  745. <tr>
  746. <td>Student_de_sters:</td>
  747. <td><input type="text" name="Student_de_sters"></td>
  748. </tr>
  749. <tr>
  750. <td colspan=”2” align=”center”>
  751. <input type="SUBMIT" value="Sterge">
  752. <input type="RESET" value="Reset">
  753. </td>
  754. </tr>
  755. </table>
  756. </form>
  757. <?php
  758. $connection=OCI_connect("localhost", "root", "root");
  759. $cnp=$_GET['Student_de_sters'];
  760. $stmt=OCI_Parse($connection,"SELECT count(*) FROM candidati where cnp='$cnp' ");
  761. @OCI_Execute($stmt);
  762. @$row=OCI_Fetch_row($stmt);
  763. $nr=$row[0];
  764. if ($nr==0){
  765. echo "Studentul nu exista !";
  766. }
  767. else
  768. {
  769. $stmt=OCI_Parse($connection,"DELETE from candidati where cnp='$cnp' ");
  770. OCI_Execute($stmt);
  771. }
  772. OCI_Free_Statement($stmt);
  773. OCI_close($connection);
  774. ?>
  775. </body>
  776. </html>
  777. </body>
  778. </html>
  779.  
  780.  
  781.  
  782. SQL------------------
  783.  
  784.  
  785. conexiune
  786.  
  787. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  788. <html>
  789. <head>
  790. <title>conexiune</title>
  791. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  792. </head>
  793.  
  794. <body>
  795. <?php
  796. mysql_connect("localhost", "root", "") or die ("nu se poate conecta la server");
  797. mysql_select_db("admitere") or die("nu se poate conecta la baza de date");
  798. ?>
  799. </body>
  800. </html>
  801.  
  802.  
  803. afisare
  804.  
  805. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  806. <html>
  807. <head>
  808. <title>afisare</title>
  809. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  810. </head>
  811.  
  812. <body>
  813. <?php
  814. include ("conexiune.php");
  815. $queryCandidati = @mysql_query("select * from candidati");
  816.  
  817. $nr_inreg = @mysql_num_rows($queryCandidati);
  818.  
  819. if($nr_inreg>0){
  820. echo "<table border='2' align 'center'>";
  821. $coln=mysql_num_fields($queryCandidati);
  822. echo "<tr bgcolor='silver'>";
  823.  
  824. for($i=0; $i<$coln; $i++)
  825. {
  826. //numele campurilor ca si cap de tabel
  827. $var=mysql_field_name($queryCandidati, $i);
  828. echo"<th> $var</th>";
  829. }
  830. echo "</tr>";
  831.  
  832. //afisare inregistrari gasite in urma interogarii
  833. while($row = mysql_fetch_row($queryCandidati)){
  834. echo"<tr>";
  835. foreach ($row as $value){
  836. echo"<td>$value</td>";
  837. }
  838. echo "</tr>";
  839. }
  840. echo"</table>";
  841. }
  842. else{
  843. echo"<center>";
  844. echo "Nu s au gasit inregistrari";
  845. echo"</center>";
  846. }
  847. ?>
  848.  
  849.  
  850. </body>
  851. </html>
  852.  
  853.  
  854.  
  855. update1
  856.  
  857. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  858. <html>
  859. <head>
  860. <title>Update</title>
  861. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  862. </head>
  863.  
  864. <body>
  865. <?php
  866. include ("conexiune.php");
  867. $id=$_POST['id'];
  868.  
  869. // cautarea înregistrarii care va fi modificata
  870. $query=@mysql_query("select * from candidati where id='$id' ");
  871.  
  872. $nr_inreg=@mysql_num_rows($query);
  873.  
  874. if ($nr_inreg>0){
  875. echo "<center>";
  876. echo "S-au gasit " . $nr_inreg . " inregistrari";
  877. echo"</center>";
  878.  
  879. echo "<table border='2' align='center'>";
  880. echo"<tr bgcolor='silver'>";
  881. $coln=mysql_num_fields($query);
  882.  
  883. for ($i=0; $i<$coln; $i++){
  884. $var=mysql_field_name($query,$i);
  885. echo "<th> $var </th>";
  886. }
  887. echo"</tr>";
  888.  
  889. $nr_val=0; // contor indice array
  890. while ($row = mysql_fetch_row($query)){
  891. echo"<tr>";
  892. foreach ($row as $value) {
  893. echo "<td BGCOLOR='Yellow'> $value</td>";
  894. // memorare într-un sir (array) a datelor din articolul gasit
  895. $sir[$nr_val]=$value;
  896. $nr_val++;
  897. }
  898. echo "</tr>";
  899. }
  900. echo "</table>";
  901.  
  902. // Rezolvarea este valabila pentru o singura înregistrare gasita
  903. // Pentru mai multe înregistrari gasite, modificarile efectuate se aplica asupra tuturor
  904. echo '<br><hr>'; // trasarea unei linii
  905.  
  906. // apel script pentru modificarea efectiva
  907. echo "<form method='POST' action='http://localhost/update2.php'>";
  908.  
  909. // transfer (ascuns) spre script a parametrilor de cautare
  910. echo "<input type='hidden' id='id2_form' value=".$sir[1].">";
  911.  
  912. // transfer spre script ca parametrii a datelor care pot fi modificate
  913. echo "<table>";
  914. echo "<tr>";
  915. echo "<td>";
  916. echo "<input type='text' name='media_bac1' value=".$sir[0].">";
  917. echo "<input type='text' name='media_multianuala1' value=".$sir[1].">";
  918.  
  919. echo "</td>";
  920. echo "</tr>";
  921. echo "<tr>";
  922. echo "<td>";
  923. echo "<input type='SUBMI' value='Modifica!' >";
  924. echo "</td>";
  925. echo "</tr>";
  926. echo "</table>";
  927. echo "</form>";
  928.  
  929. else
  930. die ("Nu gasesc nici o inregistrare ...");
  931. mysql_close();
  932. ?>
  933. </body>
  934. </html>
  935.  
  936.  
  937. update2
  938.  
  939. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  940. <html>
  941. <head>
  942. <title>Untitled Document</title>
  943. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  944. </head>
  945.  
  946. <body>
  947. <?php
  948. include ("conexiune.php");
  949. echo $id2=$_POST['id2'];
  950. echo $media_bac1=$_POST['media_bac1'];
  951. echo $media_multianuala1=$_POST['media_multianuala1'];
  952.  
  953. // modificare efectiva
  954. $query =mysql_query("update candidati set id='$id1',media_bac='$media_bac1', media_multianuala='$media_multianuala1' where id='$id2'");
  955.  
  956. // afisare mesaj de eroare pentru date incorect introduse (daca se doreste)
  957. $var=mysql_error();
  958. echo $var;
  959. echo "OK, am modificat!";
  960. mysql_close ();
  961. ?>
  962. </body>
  963. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement