kenwvs Posted October 9, 2006 Share Posted October 9, 2006 I have a PHP form that I have created to store information for a work order. I have tables called workorder, parts, images, and employees.......I also have tables to JOIN information together called workorder_parts, workorder_images and workorder_employees. Below is the query's that I have created to put the data into the proper tables, but I am not able to figure out, as an example how to recall the information using the workorder_images table.The queries below are all working and the data is being stored in the database tables.Workorder Query[code]mysql_query("INSERT INTO workorder (work, name, sched, site, serial, hours, starts, issue, severity, resolution, assistance, safety) VALUES ('$work', '$name', '$sched', '$site', '$serial', '$hours', '$starts', '$issue', '$severity', '$resolution', '$assistance', '$safety')") or die(mysql_error());[/code] Images Query[code]if ($_FILES['upload']['error'][$i] == 0) { $uploaddir = '/home/forsa7/public_html/GE/GEUploads/'; $uploadfile = $uploaddir . basename($_FILES['upload']['name'][$i]); $file_name = basename($_FILES['upload']['name'][$i]); if (!move_uploaded_file($_FILES['upload']['tmp_name'][$i], $uploadfile)) { die("<br><br>File could not be uploaded."); } // After each file is successfully uploaded, record file name in DB mysql_query("INSERT INTO `image` (Upload) VALUES ('$file_name')")or die(mysql_error()); }[/code]I don't know how to get the auto incrementing number from the workorder and image tables into the workorder_image table.......or should I be doing it differently.The columns in the workorder_image table are workorder_work_id and image_image_id which are both autoincrementing columns Link to comment https://forums.phpfreaks.com/topic/23384-join-is-the-answer-i-think/ Share on other sites More sharing options...
fenway Posted October 9, 2006 Share Posted October 9, 2006 You already have an identical thread [url=http://www.phpfreaks.com/forums/index.php/topic,110810.0.html]here[/url]... just be patient. Link to comment https://forums.phpfreaks.com/topic/23384-join-is-the-answer-i-think/#findComment-106105 Share on other sites More sharing options...
Recommended Posts