jeudi 19 juillet 2018

Add usr with php

Hello 2 years when i was in high school they teached us with php 5 now as i goes to university im doing an internship so i needed to work with php 7 so can some one pls help with this little php code to make it suitable for php 7

<?php
    $mat=$_POST['T1'];
    $nom=$_POST['T2'];
    $pre=$_POST['T3'];
    mysql_connect('localhost','root','');
    mysql_select_db('dbrev4');

    $req=" select * from patient where mat='$mat' ";
    $res=mysql_query ($req);
    $nb= mysql_num_rows ($res)
    if ($nb>0)
    {
        echo "patient déja inscri";
    }
    else
    {
        $req="insert into patient values ('$mat','$nom','$pre')"
        $res=mysql_query ($req);
        $nb=mysql_affected_rows();
        if($nb>0) 
        {
            echo"succes";
        }
        else {echo "echec";}
    }

?>




Aucun commentaire:

Enregistrer un commentaire