Stergerea unei baze de date

Stefanescu Mihai 3 years ago PHP
Acest articol face parte din cursul Toate lectiile PHP. Te poti inscrie la acest curs aici!

Daca nu mai aveti nevoie de o baza de date puteti sa o stergeti. Ca si in cazul anterior, putem folosi functia query pentru a sterge o baza de date.

$dbhost = 'localhost';
$dbuser = 'user';
$dbpass = 'parola';
$conn = new mysqli($dbhost, $dbuser, $dbpass);
if(! $conn ){
  die('Nu ma pot conecta: ' . $conn->error());
$sql = 'DROP DATABASE test_mike';

$retval = $conn->query( $sql );

if(! $retval ){
  die('Nu pot sterge baza de date: ' . $conn->error());
echo "Baza de date stearsa.\n";

Atentie: Stergerea unei baze de date este periculoasa. Asigurati-va ca stergeti ce trebuie si/sau ca aveti un backup.

Stergerea unui tabel

Ca si in cazul de mai sus, putem folosi functia query() pentru a sterge un tabel.

$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$dbdb = 'test_mike';
$conn = new mysqli($dbhost, $dbuser, $dbpass, $dbdb);
if(! $conn ){
  die('Nu ma pot conecta: ' . $conn->error());
$sql = 'DROP TABLE users';

$retval = $conn->query( $sql );

if(! $retval ){
  die('Nu pot sterge tabelul: ' . $conn->error());
echo "Tabel sters.\n";


Programator de ~8 ani, am lucrat la proiecte din mai multe industrstrii, de la eCommerce la telecomunicatii la automatizari. In acest timp am folosi diferite tehnologii, de la PHP, MySQL, PostgreSql, RabbitMq, Redis, Memcached si altele.

Get in touch
Pentru nelamuriri, dubii, comentarii si chestii de pe suflet ne putem auzi pe Discord, Reddit sau poti deschide o discutie noua pe forum

Are you spending money on Robux # 8 months ago Hi my loved one! I want to say that this article is amazing, nice written and come with almost all vital infos. I would like to look more posts like this .
amox-clav ordenado en España # 4 months ago Wonderful article! We will be linking to this particularly great article on our site. Keep up the great writing.
farmacia de fexofenadine # 4 months ago you are actually a excellent webmaster. The website loading speed is amazing. It seems that you're doing any distinctive trick. Moreover, The contents are masterwork. you have done a magnificent job in this matter!
Cumeaa # 3 months ago purchase fenofibrate pill <a href="">generic tricor 200mg</a> buy fenofibrate generic
prix cesia Maroc # 3 months ago Excellent beat ! I wish to apprentice while you amend your website, how can i subscribe for a weblog site? The account aided me a acceptable deal. I have been a little bit acquainted of this your broadcast provided vivid transparent concept
dostinex kopen in België # 3 months ago Link exchange is nothing else but it is only placing the other person's weblog link on your page at suitable place and other person will also do same for you.
Ruebrj # 3 months ago zaditor 1 mg pills <a href="">order geodon online</a> imipramine cost
Dxdlal # 3 months ago purchase minoxytop generic <a href="">flomax generic</a> where to buy over the counter ed pills
Lpqbaz # 3 months ago buy generic acarbose <a href="">buy acarbose 25mg sale</a> buy griseofulvin 250mg online cheap
Zhqide # 3 months ago buy aspirin generic <a href="">zovirax oral</a> order generic imiquad
aygestin te koop in België # 3 months ago It's awesome in favor of me to have a website, which is beneficial in favor of my knowledge. thanks admin
Landon # 3 months ago It's really very difficult in this full of activity life to listen news on Television, so I simply use web for that reason, and obtain the hottest information.
Landon # 3 months ago It's really very difficult in this full of activity life to listen news on Television, so I simply use web for that reason, and obtain the hottest information.
Claude # 3 months ago Thank you for some other informative website. Where else may I get that type of info written in such an ideal approach? I have a mission that I'm just now working on, and I have been on the glance out for such info.
Spgenp # 3 months ago order duphaston 10 mg generic <a href="">order empagliflozin</a> buy empagliflozin 25mg sale
Fkzzdv # 3 months ago brand florinef 100 mcg <a href="">buy generic imodium over the counter</a> buy imodium
Iewbjn # 3 months ago etodolac 600 mg generic <a href="">buy cilostazol 100 mg without prescription</a> cilostazol 100 mg tablet
Sudfdt # 3 months ago prasugrel 10 mg cost <a href="">prasugrel pills</a> buy tolterodine 2mg for sale
Ihtkvj # 3 months ago order ferrous 100mg <a href="">oral ascorbic acid 500mg</a> betapace cost
Yzylha # 2 months ago purchase mestinon generic <a href="">cheap pyridostigmine</a> maxalt 5mg pills
Plviqk # 2 months ago order vasotec <a href="">order casodex online cheap</a> duphalac ca
Lsskso # 2 months ago where to buy latanoprost without a prescription <a href="">buy rivastigmine 6mg online cheap</a> exelon 6mg oral
Ngnajd # 2 months ago buy betahistine for sale <a href="">order latanoprost online cheap</a> order benemid generic
Ryczzj # 2 months ago micardis 20mg price <a href="">order micardis 20mg online cheap</a> molnupiravir 200 mg sale
Qbiumw # 2 months ago order cenforce 50mg online cheap <a href="">aralen cheap</a> aralen 250mg for sale
Jhvyfx # 2 months ago roulette casino <a href="">order lasix 40mg generic</a> buy lasix generic
Mlrhde # 2 months ago free online blackjack <a href="">order stromectol 3mg pill</a> stromectol buy uk
Oreggi # 2 months ago order amantadine 100mg generic <a href="">oral avlosulfon</a> buy dapsone cheap
Rdhcgc # 2 months ago clomid price <a href="">cheap clomiphene</a> imuran 50mg without prescription
Acjscq # 2 months ago methylprednisolone 16mg oral <a href="">aristocort pills</a> aristocort 4mg ca
Etiexr # 1 month ago buy generic perindopril 4mg <a href="">purchase desloratadine</a> allegra 120mg us
Hsafrb # 1 month ago buy generic dilantin <a href="">buy phenytoin without a prescription</a> ditropan cost
Feeauh # 1 month ago lioresal pills <a href="">endep 10mg generic</a> toradol 10mg drug
Qqnqdg # 1 month ago claritin buy online <a href="">order priligy</a> priligy ca
Izayqm # 1 month ago order generic baclofen 25mg <a href="">buy baclofen no prescription</a> toradol 10mg usa
Heyvfc # 1 month ago alendronate uk <a href="">order generic furadantin 100 mg</a> order macrodantin 100 mg online
Irujdw # 1 month ago glimepiride 1mg cost <a href="">order amaryl 1mg sale</a> order arcoxia 60mg generic
Glrrnh # 1 month ago order nortriptyline 25 mg online <a href="">paracetamol sale</a> buy paracetamol 500mg online cheap
Mxrusx # 1 month ago buy medex online cheap <a href="">medex over the counter</a> purchase maxolon online
Oqykfg # 1 month ago order orlistat 120mg <a href="">buy diltiazem 180mg without prescription</a> diltiazem buy online
Dlcwkx # 1 month ago buy pepcid 20mg online cheap <a href="">oral prograf 1mg</a> order tacrolimus online cheap
Jqlmqf # 1 month ago buy azelastine 10ml sprayer <a href="">cost irbesartan</a> buy irbesartan without prescription
Eikdvp # 1 month ago imitrex price <a href="">order generic imitrex 25mg</a> avodart pill
Evnpit # 1 month ago buy zyloprim 300mg online cheap <a href="">allopurinol 300mg uk</a> buy rosuvastatin 20mg without prescription
Tyhvtt # 1 month ago buy buspin pills for sale <a href="">order ezetimibe without prescription</a> cordarone 100mg canada
Kxaabw # 1 month ago motilium 10mg over the counter <a href="">domperidone oral</a> tetracycline 250mg generic
Imaafq # 1 month ago order spironolactone <a href="">buy valacyclovir</a> brand finpecia
Fojtep # 1 month ago help with term paper <a href="">editing essays</a> how to write an about me essay
Sgqeqp # 1 month ago order fluconazole 100mg without prescription <a href="">buy ampicillin generic</a> order cipro 500mg generic
Uqlfoe # 1 month ago aurogra canada <a href="">aurogra cheap</a> purchase estradiol generic
Pmdehj # 4 weeks ago buy generic lamotrigine <a href="">vermox price</a> order mebendazole 100mg sale
Lqzrao # 3 weeks ago buy cleocin 150mg online <a href="">erythromycin ca</a> pills for erection
Wwvjzg # 3 weeks ago tretinoin gel price <a href="">oral avana</a> buy avana online
Xpfgqd # 3 weeks ago nolvadex pills <a href="">cheap tamoxifen 20mg</a> symbicort cost
Jxckbb # 3 weeks ago buy cefuroxime 500mg generic <a href="">where can i buy lumigan</a> robaxin 500mg without prescription
Pislan # 2 weeks ago paperwriter <a href="">writing better essays</a> buy cefixime 100mg generic
Bttujt # 2 weeks ago order amoxicillin without prescription <a href="">clarithromycin 500mg for sale</a> buy clarithromycin tablets
Blvakv # 2 weeks ago cheap calcitriol 0.25 mg <a href="">generic fenofibrate</a> purchase fenofibrate sale
Tnayfl # 2 weeks ago catapres 0.1 mg generic <a href="">order clonidine without prescription</a> order tiotropium bromide 9 mcg for sale
Kvpkls # 2 weeks ago buy acne pills online <a href="">best acne treatment teen boys</a> trileptal 600mg canada
Wbofrw # 1 week ago order minocin 100mg sale <a href="">order generic requip 1mg</a> ropinirole 1mg pill
Otnmjl # 1 week ago buy sleeping tablets online uk <a href="">online pharmacies sleeping pills</a> strongest weight loss prescription
Qflmaq # 1 week ago tobacco cessation medications chart <a href="">dmard meds list</a> strongest pain killer list
Mrffow # 1 week ago medroxyprogesterone 10mg sale <a href="">buy hydrochlorothiazide 25mg online</a> hydrochlorothiazide 25 mg tablet
Ujvzjo # 1 week ago how are antiviral drugs used <a href="">diabetic drugs starting with b</a> lowest gli sugar for diabetics
Hdvtwo # 1 week ago cyproheptadine us <a href="">generic periactin 4mg</a> nizoral oral
Kopldu # 6 days ago antifungal cream for pediatric face <a href="">best hypertension medication combinations</a> antihypertensive tablet name
Tdzzuc # 4 days ago antibiotics to treat peptic ulcer <a href="">tricks to lower blood pressure instantly</a> otc pain relief for uti
Qafahp # 3 days ago buy promethazine cheap <a href="">buy ed medications</a> buy oral ivermectin
Fikdap # 3 days ago birth control online without insurance <a href="">pe and ed treatment</a> premature ejaculation pills review
Hfbpib # 1 day ago severe stomach paincaused by medication <a href="">nausea medicines over the counter</a> medications that cause foul smelling gas
Club-ul este dedicat membrilor si ofera access la mai multe zone ale website-ului.
Login Register

🔖 Bookmarks
✨ Pentru a sustine aceasta comunitate am sa te rog sa te autentifici sau sa te inregistrezi!

🌪️ Discord
Back to top
Folosim cookie-uri pentru a oferi functionalitatile critice ale aplicatiei Invata-Programare. Folosim cookie-uri si pentru a analiza traficul, pentru care e nevoie de consimtamantul dvs. explicit.