aeafisme23 Posted August 4, 2006 Share Posted August 4, 2006 I am wanting to know how you assign the input text boxes below the particular SQL query since they are populating different tables in a database. I am assuming the code i need to insert is into the name? like name=[?php sql yadda yadda]. I have no clue :)[code]// Write the queries$sql = "INSERT INTO make(make_id, make) VALUES ('$make_id','$make')";$sql2 = "INSERT INTO model (model_id, model) VALUES ('$model_id','$model')";$sql3 = "INSERT INTO submodel(model_id, submodel) VALUES ('$model_id','$submodel')";// Execute the queriesmysql_query($sql) or die(mysql_error());mysql_query($sql2) or die(mysql_error());mysql_query($sql3) or die(mysql_error());[/code]and i have 3 input boxes:<INPUT TYPE=text NAME="make" ID="make" SIZE="25" MAXLENGTH="60"><INPUT TYPE=text NAME="model" ID="model" SIZE="45" MAXLENGTH="60"><INPUT TYPE=text NAME="submodel" ID="submodel" SIZE="60" MAXLENGTH="60">THANKS Quote Link to comment Share on other sites More sharing options...
HeyRay2 Posted August 4, 2006 Share Posted August 4, 2006 [quote][code]// Write the queries$sql = "INSERT INTO make(make_id, make) VALUES ('$make_id','$make')";$sql2 = "INSERT INTO model (model_id, model) VALUES ('$model_id','$model')";$sql3 = "INSERT INTO submodel(model_id, submodel) VALUES ('$model_id','$submodel')";// Execute the queriesmysql_query($sql) or die(mysql_error());mysql_query($sql2) or die(mysql_error());mysql_query($sql3) or die(mysql_error());[/code][/quote]LOL, that code looks familiar.Let me clarify what you are asking. Are you wanting to populate your input text boxes with values that already exist in the database, or are you wanting to know what "[b]name[/b]" each input box should have in order to run these queries?[code]// Write the queries$sql = "INSERT INTO make(make_id, make) VALUES ('$make_id','$make')";$sql2 = "INSERT INTO model (model_id, model) VALUES ('$model_id','$model')";$sql3 = "INSERT INTO submodel(model_id, submodel) VALUES ('$model_id','$submodel')";[/code] Quote Link to comment Share on other sites More sharing options...
aeafisme23 Posted August 4, 2006 Author Share Posted August 4, 2006 Hey its very good helping code i might add, it was just a pain to have to scroll that far. I do not have the values, this will be completely backend where a user will input all data into the form text boxes and will update somewhere else on the site (not relevant where). So as of right now the boxes have no value but a particular name of the text box that populates information to the appropriate tables in the database. Does this make more sense? Thank you again! Quote Link to comment Share on other sites More sharing options...
aeafisme23 Posted August 4, 2006 Author Share Posted August 4, 2006 After thinking about this and comparing it to other forms that update databases to one table, wouldnt it just work regardless without defining anything other than // Write the queries$sql = "INSERT INTO make(make_id, make) VALUES ('$make_id','$make')";$sql2 = "INSERT INTO model (model_id, model) VALUES ('$model_id','$model')";$sql3 = "INSERT INTO submodel(model_id, submodel) VALUES ('$model_id','$submodel')";// Execute the queriesmysql_query($sql) or die(mysql_error());mysql_query($sql2) or die(mysql_error());mysql_query($sql3) or die(mysql_error());because the value/name/id will match the SQL values so it will just update to the database? Is this logic correct. Quote Link to comment Share on other sites More sharing options...
aeafisme23 Posted August 4, 2006 Author Share Posted August 4, 2006 Fatal error: Allowed memory size of 18388608 bytes exhausted (tried to allocate 12 bytes) in /home2/admin/kindervision-www/anthonydwayne/add.php on line 15I just got this message when i inserted data into the input fields, i looked at my database and it's filled up by the same input thousands of times!!!!! woah!heres mysql connection crap:<?phpif ($submit) { // process form$db = mysql_connect("www.afdsfdfdasf.org", "asdf", "afdasdfasdfas");mysql_select_db("fasdfadfaf_org",$db);// Write the queries$sql = "INSERT INTO make(make_id, make) VALUES ('$make_id','$make')";$sql2 = "INSERT INTO model (model_id, model) VALUES ('$model_id','$model')";$sql3 = "INSERT INTO submodel(model_id, submodel) VALUES ('$model_id','$submodel')";// Execute the queriesmysql_query($sql) or die(mysql_error());mysql_query($sql2) or die(mysql_error());mysql_query($sql3) or die(mysql_error()); $result = mysql_query($sql); //could this be my problem because i dont have $sql2 and 3? wehres my exit too? require("add.php"); echo('thank you for your add');} else{ ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.