wesmith4 Posted November 22, 2013 Share Posted November 22, 2013 The code based on chapter ten is available through this link. I am attempting to INSERT INTO a database table a record that would contain such items as a date and the key from another table in the MySQL database. In fact, one table is a table of households. The key of a record in the household table is passed to a script to record attendance information of this household in the attendance table. So one column in the attendance table is to contain a key from the household table. The edit_user.php script in Larry's book sends such a key to a script that contains a "select query". I can get that one to work very well. But then I am trying to use the same ideas to send such a unique key to a script that contains a "INSERT INTO" query. I can not get it to work. If anyone has a suggestion about what I am doing wrong, please know that I need your assistance. Thank you. Wes Smith Link to comment Share on other sites More sharing options...
Larry Posted November 22, 2013 Share Posted November 22, 2013 I'm not really following what the problem is here. How about you post the relevant code here and explain how/why it's not working? Link to comment Share on other sites More sharing options...
Duke Posted December 4, 2013 Share Posted December 4, 2013 wessmith4....Here is a thought from a newbie..I just used this,,,,,,. If you want to add a new random key to the attendees in place of your #34.....use php mt_rand() + current timestamp and grab x numbers......ie(-$attendee_id = substr(time().mt_rand(1,100000),6, 9);-).....then use the variable($attendee_id) in your INSERT query....or if you want to use id from household($_SESSION['household']).... try -$attendee_id=$_SESSION['household'];-then use the variable($attendee_id) in your INSERT query.....hope this helps Link to comment Share on other sites More sharing options...
Recommended Posts