1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Dismiss Notice
Welcome to our Education website, plz like our page facebook to support us. Thank You and wish you good navigation

Affichage des données d'une table en PHP

abdelouafiOct 4, 2016

    1. abdelouafi

      abdelouafi Administrator Staff Member

      Messages:
      180
      Likes Received:
      9
      Trophy Points:
      18
      Joined
      Sep 13, 2016
      Affichage des données en PHP 4:
      [CODE]<?php
      header("Content-Type:text/html;charset=ISO-8859-1");
      $str=$_POST["str"];
      mysql_connect("localhost","root","");
      mysql_select_db("ensa");
      $res=mysql_query("select * from inscription where nom like '$str%'");
      while($tab=mysql_fetch_array($res)){
      $id=$tab["id"];
      $date=$tab["date"];
      $nom=$tab["nom"];
      $prenom=$tab["prenom"];
      echo "$id - $date - $nom - $prenom <br>";
      }
      ?>[/CODE]

      Insertion dans une tables en PHP 4
      Code:
      <?php
      header("Content-Type:text/html;charset=ISO-8859-1");
      $a=$_POST["a"];
      $b=$_POST["b"];
      mysql_connect("localhost","root","");
      mysql_select_db("ensa");
      mysql_query("insert into inscription (nom,prenom) values('$a','$b')");
      
      mysql_connect("localhost","root","");
      mysql_select_db("ensa");
      $req=mysql_query("select * from inscription");
      while($tab=mysql_fetch_array($req)){
      $id=$tab["id"];
      $date=$tab["date"];
      $nom=$tab["nom"];
      $prenom=$tab["prenom"];
      echo "$id - $date - $nom - $prenom <br>";
      }
      ?>
       
      Last edited: Dec 24, 2016
      Loading...

Share This Page

Share