Jump to content

Conditionare stergere tabel din baza de date?


Justdapz

Recommended Posts

Salut, am si eu o intrebare. Am intr-o baza de date urmatoarele coloane: $auth, $id, $acces si inca 3. Vreau sa mai creez o coloana $date care sa contina data, gen: 23/03/2016

In baza de date apare asa:

$id, $auth, $acces, $date
1     php     123       24/03/2016

Eu am nevoie de un script care verifica daca data din $date este egala cu data curenta si daca rezultatul este pozitiv sa stearga linia acces. Ma poate indruma cineva in acest sens?

Link to comment
Share on other sites

  • gaby changed the title to Conditionare stergere tabel din baza de date?
  • 5 weeks later...

<?php
$eroare_conectare = 'Ne pare rau dar exista o problema cu conexiunea';
mysql_connect('localhost', 'root', '') or die($eroare_conectare);
mysql_select_db('DATABASE') or die ($eroare_conectare);

if (empty($_POST) === false) {
	mysql_query("DELETE FROM `DATABASE` WHERE `data` = CURDATE()");
	echo'succes';
}	
?>
<form action="" method="post">
	<input type="submit" name="submit" class="btn btn-default" value="Submit">
</form>

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.