jeudi 30 juillet 2015

Insert two values with same name to MySQL

I Have form where I want insert let's say:

  1. Who paid ? (user_id) in user database
    1. when (date) incomes database
    2. how much (sum) incomes database
    3. Who entering the data (user_id) in user database

and inserting script:

if(empty($_POST['user_id'])){
    $data_missing[] = 'User';

} else{
   $summa = trim($_POST['user_id']);   }
.......

$sql = "INSERT INTO incomes (user_id, date, sum, user_id)
VALUES ('$user_id','$date','$sum','$user_id')";

......

How I can solve to insert two times "user_id", and they may be different or same!




Aucun commentaire:

Enregistrer un commentaire