note 106933 deleted from language.types by tularis
| From: | tularis@php.net | Date: | Mon, 19 Dec 2011 19:41:55 +0000 |
| Subject: | note 106933 deleted from language.types by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-185162@lists.php.net to get a copy of this message | ||
Note Submitter: mister je:))
Reason: non-english
----
/////afisare toate cartile\\\\\\
<?php
$baza=mysql_connect('localhost','root','');
if($baza)
{ echo "conectat";
}
mysql_select_db('librarie');
$sql='select id_carte,titlu from carti';
$resursa=mysql_query($sql);
print"<table border=\'1\'>";
while($nr=mysql_fetch_array($resursa))
{
print"<tr><td>".$nr[0]."</td><td>".$nr[1]."</td></tr>";
}
print"</table>";
?>
//////////operatii de delete;\\\\\\\\\\\
<html>
<body>
<?php
mysql_connect('localhost','root','');
mysql_select_db('librarie');
$sql="delete from carti where titlu='dune'";
mysql_query($sql);
?>
<a href="toate_cartile.php">modificare</a>
</body>
</html>
//////////formular de adaugare\\\\\\\\\\
<html>
<head>
</head>
<body>
<form action="adaugare.php" method="post">
<input type="text" name="titlu">
<input type="submit" value="adauga">
</form>
</body>
</html>
//////formular de adaugare cu interogare a sql\\\\\\\\\
<html>
<body>
<?php
mysql_connect('localhost','root','');
mysql_select_db('librarie');
$sql="insert into carti (titlu)
values('".$_POST['titlu']."')";
mysql_query($sql);
?>
<a href="toate_cartile.php" >modicarea></a>
<a href="adaugare.html" >adaugare></a>
</body>
</html>
/////////stergere formular principal;\\\\\\\\\
<html>
<body>
<form action="stergere_act.php" method="post">
<select name='id_carte'>
<?php
mysql_connect('127.0.0.1','root','');
mysql_select_db('librarie');
$sql="select id_carte,titlu from carti order by titlu asc";
$sursa=mysql_query($sql);
while($row=mysql_fetch_array($sursa))
{
print"<option
value='".$row['id_carte']."'>".$row['titlu']."</option>";
}
?>
</select>
<input type="submit" value="stergere">
</form>
</body>
</html>
///////////stergerea efectiva;\\\\\\\\\\\\\
<html>
<body>
<?php
mysql_connect('localhost','root','');
mysql_select_db("librarie");
$sql="delete from carti where id_carte=".$_POST['id_carte'];
mysql_query($sql);
?>
<a href="toate_cartile.php" >modificarea</a>
<a href="stergere.php" >sterge inrgistrarea</a>
</body>
</html>
lista cu toate cartile arnjate dupa id_carte(vizualizare)
<html>
<body>
<form action="modifica.php" method="post">
<?php
mysql_connect('localhost','root','');
mysql_select_db('librarie');
$sql="select id_carte,titlu,descriere from carti";
$sursa=mysql_query($sql);
while($row=mysql_fetch_array($sursa))
{
print "<input type='radio' name='id_carte'
value='".$row['id_carte']."'><b>".$row['titlu']."</b><br><i>".$row['descriere']."</i><br><br>";
}
?>
<input type="submit"value="modifica">
</form>
</body>
</html>
//////////formular de modificare\\\\\\\\\\\\\\\\\\\
<html>
<body>
<form action="modifica_act.php" method="POST">
<?php
mysql_connect('localhost','root','');
$baza=mysql_select_db('librarie');
$sql="select titlu,descriere from carti where id_carte=".$_POST['id_carte'];
$sursa=mysql_query($sql);
while($row= mysql_fetch_array($sursa))
{
print'<input type ="text" name="titlu"
value="'.$row['titlu'].'"<br><textarea
nume="descriere">'.$row['descriere'].'</textarea><br>';
}
print'<input type="hidden" name="id_carte"
value="'.$_POST['id_carte'].'">';
echo"</table>";
?>
<input type="submit" value="modifica"></form>
</body>
</html>
///////////////modificarea efectiva ;)\\\\\\\\\\\\\\\\
<html>
<head><title>update</title></head>
<body>
<?php
mysql_connect('localhost','root','');
mysql_select_db('librarie');
$sql="UPDATE carti SET
titlu='".$_POST['titlu']."',descriere='".$_POST['descriere']."'
where id_carte=".$_POST['id_carte'];
mysql_query($sql);
?>
</body>
<a href="lista_carti.php" >lista cartii</a>
</html>