Bonjour à tous,

Je suis entrain de réaliser un formulaire php qui encode un « contact » et différentes « références ».
Dans ma base de données, j’ai donc une table « contact » [avec différents colonnes : « nom », « prenom », « coordonnees »…] et une table référence [avec les colonnes « reference », « contact_id »
Dans ma page php, j’ai 3 input « reference »
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<tr>
                    <td height="1" colspan="2">R&eacute;f&eacute;rence</td>
                    <td colspan="4"><input name="reference_01" type="text" id="reference"  size="10" maxlength="8">                        
(ex: ../.....) </td>
                  </tr>
                  <tr>
                    <td height="0" colspan="2">&nbsp;</td>
                    <td colspan="4"><input name="reference_02" type="text" id="reference_01"  size="10" maxlength="8">
(ex: ../.....) </td>
                  </tr>
                  <tr>
                    <td height="-1" colspan="2">&nbsp;</td>
                    <td colspan="4"><input name="reference_03" type="text" id="reference_012"  size="10" maxlength="8">
(ex: ../.....) </td>
                  </tr>
                  <tr>
Dans mes 3 pages de formulaires, je passe les infos par variable et par Session :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
 
$_SESSION["reference_01"] = htmlspecialchars($_POST['reference_01']);
$_SESSION["reference_02"] = htmlspecialchars($_POST['reference_02']);
$_SESSION["reference_03"] = htmlspecialchars($_POST['reference_03']);
 
$reference_01 = $_SESSION['reference_01'];
$reference_02 = $_SESSION['reference_02'];
$reference_03 = $_SESSION['reference_03'];
Mais je ne sais pas comment insérer dans ma table ‘reference’ de ma db 3 lignes ayant « contact_id » identique et la « référence » différente ?
Mon code est ci-dessous, comment dois-je l’adapter ?

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
 
// Insertion dans ma table "reference"
  $insertSQL5 = sprintf("INSERT INTO reference_contact (contact_id, reference) VALUES (%s, %s)",
                    $contact_id,
      GetSQLValueString($_SESSION['reference'], "text"));
 
  mysql_select_db($database_connect, $connect);
  $Result5 = mysql_query($insertSQL5, $connect) or die(mysql_error());
D’avance je vous remercie pour l’aide que vous pourrez m’apporter !
Golfinha