clarification

A

Anonymous

Guest
my problem, I created two tables one "book" and the other "students" each of these tables has a column with primary key (IdClient and Reflivre).
I have a third "loan" table having included the foreign keys.
I am trying to retrieve the ClientId student table and RefLivre via the command
$ con = mysqli_connect ("localhost", "fred", "poseidon", "class");
$ sql = mysqli_query ($ con, "SELECT ClientID From students");
$ row = mysqli_num_rows ($ sql);
while ($ row = mysqli_fetch_array ($ sql)) {
echo "<option value = '". $ row ['IdClient']. "'>". $ row [' IdClient ']. "</option>";
}
with the command I can't do it despite having no error messages.
$ conn = mysqli_connect ("localhost", "fred", "poseidon", "class") or die (mysqli_error ());
$ BookRef = $ _ POST ['BookRef'];
$ IdClient = $ _ POST ['IdClient'];
$ exit_date = $ _ POST ['exit_date'];
$ render_date = $ _ POST ['render_date'];
$ req = "INSERT INTO loan (BookRef, CustomerId, output_date, rendering_date) VALUES ('$ BookRef', '$ CustomerID', '$ output_date', $ rendering_date ')";
$ res = mysqli_query ($ conn, $ req);

I'm new and my files pretty simplistic.
Thank you very much in advance.
 
Back
Top