Speed up development with full-stack environments for every branch.

Learn More

Comments of a Mini-facebook ;) [PHP, MySQL and CSS]

Forked from mini chat.

610 Runs 1002 Views 221 Copies

<title>Comments of a Mini-facebook</title> $sql = 'SELECT * FROM tweet ORDER BY `id` DESC ';

Saved

Saved

N-BENZ 4

N-BENZ
published 2 years ago

<?php 
include('includes/connection.php');
?>
<!DOCTYPE HTML>
<HTML>
<head>
<meta charset="utf-8" />
<title>Comments of a Mini-facebook</title>
<link href="css/style.css" rel="stylesheet"/>
<link rel="icon" href="writer.ico" type="image/x-icon" />
</head>
<body>

  <div id="main">
  <img src="facebook.png"/><p>
   <h1> Mini-facebook</h1>
   </p>
   <hr>
   <h2> Poste à commenter: </h2>
   <form action="index.php" method="post">
  <table>
   <tr>
 <td> Name:</td> <td><input placeholder="Votre nom.." type="text" name="by" required/><td>
  </tr>
  
  <tr>
 <td> Commentaire:</td> <td> <textarea required placeholder="Votre commentaire.." rows=2 cols=20 id=post name=poste></textarea></td>
  </tr>
  
   <tr>
   <td></td>
   <td><input type=submit name=submit value=valider /></td>
   </tr>
   
   </table>
   </form>
   <hr>
   <h3>Les derniéres commentaires:</h3>
   
   <p > 
   <?php
   if(isset($_POST['by']) && isset($_POST['poste']))
   {
$sql = 'INSERT INTO tweet VALUES( "id" , "'.$_POST['by'].'" , "'.$_POST['poste'].' " )';
   mysql_query($sql)or die('ERREUR SQL\!'.$sql.'<br> '.mysql_error());
   } 
//hjvfhj

$sql = 'SELECT * FROM tweet ORDER BY `id` DESC  ';
   $rqt = mysql_query($sql);
   while($data = mysql_fetch_array($rqt))
   {
   echo '<strong>ID:</strong>   '.$data['id'].'<br/>';
   echo $data['poste'].'<br><strong> Par: </strong>'.$data['by'].'<table colapse=colapse><tr><td>';
   echo "<form action=modifier.php method=post><input type=submit value=modifier /></form></td><td> ";
   echo "<form action=index.php method=post><input type=submit  name=supprimer value=supprimer /></form></td></tr></table>";
   
     if(isset($_POST['supprimer'])) 
    {
   
   $sql='DELETE FROM tweet WHERE `by` = "'.$data['by'].'" ';
   mysql_query($sql)or die('ERREUR SQL\!'.$sql.'<br> '.mysql_error());
   }
   
    echo "<hr>";
   }
   
   mysql_free_result ($rqt);
   mysql_close();
?>
   </p>
   
   
  </div>


</body>
</HTML>
Please login/signup to get access to the terminal.

Your session has timed out.

Dismiss (the page may not function properly).