I’m attempting to insert a record into my openjobs table which is comprised of openjobid, jobid, DateOpened, DateFilled, isactive.
The goal is to have the user select one or more checkboxes for the job types they want to post and select the restaurant from the dropdown list. The submit button should execute the mysqli_prepare statement. The page loads correctly but no record is inserted. Here’s my code:
I made the change, and have been patterning my code using the manual example per your suggestion. After uploading the revised file, when I browse the page I now receive the following error:
The requested URL /Admin/<br /><b>Warning</b>: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, string given in <b>/home/tgitcorp/public_html/Admin/admin_index.php</b> on line <b>25</b><br />0 Row Inserted. was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
How about the fact that you’ve jam sandwiched this particular block of code into the middle of a form’s action attribute, and arnt echoing out anything resembling a URL?
I think perhaps you have bigger problems than your mysqli code not executing.
Could you elaborate further as to how I might remedy this? If the action attribute is not the appropriate place for this code block, should I create a separate file and reference that filename as the form’s action? Just needing some solid suggestions on ways to improve.
That is one way to do it, yes, or have the action point at the same page, and put the code block at the top of the page, nestled inside a if(isset($_POST[‘ddlStore’])) {}.
Despite adding $stmt as the first argument in the mysqli_stmt_bind_param, I still receive the following error when browsing the page:
The requested URL /Admin/<br /><b>Warning</b>: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, string given in <b>/home/tgitcorp/public_html/Admin/admin_index.php</b> on line <b>25</b><br />0 Row Inserted. was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Is there a better way to structure the $stmt variable?
This is now uploaded to the site, the associated error messages are as follows:
Warning: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, boolean given in /home/tgitcorp/public_html/Admin/admin_index.php on line 9
Warning: mysqli_stmt_execute() expects parameter 1 to be mysqli_stmt, boolean given in /home/tgitcorp/public_html/Admin/admin_index.php on line 12
Warning: mysqli_stmt_affected_rows() expects parameter 1 to be mysqli_stmt, boolean given in /home/tgitcorp/public_html/Admin/admin_index.php on line 13
0 Row Inserted.
Warning: mysqli_stmt_close() expects parameter 1 to be mysqli_stmt, boolean given in /home/tgitcorp/public_html/Admin/admin_index.php on line 14
It looks like the insertion is failing silently now. When I choose a restaurant and tick one or more checkbox, pressing the submit button yields the message -1 Inserted at top of the page.
I’m wondering if my database schema is a bit too complex?
The idea is to insert open jobs into the openjobs table. However, I also created a jobdesc table that contains the jobid, Title and description of each of the 4 positions.
My intial thought was to just get the insertion working into the openjobs table. Ultimately, the user needs to select which position they’re hiring, modify the existing job description and then insert into the openjobs table. The jobdesc table has jobid set as follows: 1=Server 2= Host/Hostess 3=Cook and 4=Bartender.
So, to streamline things and keep the end result in mind, I just added a jobdesc field varchar(200) to my openjobs table.
Should I restructure the form to allow retrieval of the canned job description as well as insertion of the new job? Or, is this trying to do too much in one form? If two forms are advisable, would the first form simply retrieve the canned description and the second form handle the insertion into openjobs?