Jump to content

kenwvs

Members
  • Posts

    194
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

kenwvs's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. There was another pop up blocker working overtime to stop the pages from loading. I have this working properly again. Thanks for any thoughts on this.
  2. I am not sure this is the right place to ask this, but I will try I am using IE 7 and have been for a while now. Recently it has started acting strange in that if I try to open a link, and it is suppose to open in a new tab, sometimes it will open, but usually it wont work at all. If I right click and select open in new tab, most of the time it works, but again, sometimes it won't work unless i copy and paste the code into the explorer bar. I wasn't sure if it was IE or my computer, and I used firefox and it all works fine, didn't have any problems. Any ideas would be greatly appreciated. Ken
  3. I am not understanding how to get the auto-increment value.  As there could be 4 images (or seven parts), if I use the mysql_insert_id(); I will only get the last number, and be missing the ones generated earlier in the same query
  4. 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
  5. I have tried using the last script supplied, but for some reason it isn't sending an email.  I have also added the line [code=php:0]echo 'Email has been sent to'.$_POST[$ename];[/code] to see what it shows and it prints out the Email has been sent to, but there is no names in there. Am I missing a step as far as setting the email address of something for it to use it?  I am not really sure what I would need to change to make this actually send the email.  the rest of the form is being saved to the Db, so it is making a connection and not generating any errors. Any ideas or suggestions would be appreciated.  Would I need to save the names to a db table before it could send the email? Thanks, Ken
  6. Ok, I see what you are saying.  Thanks a bunch for the help.  It is starting to make sense now.  I appreciate your help. Ken
  7. I am sorry, but I am not following what you have just said. Ken
  8. I will try that.  I have no idea how to do this, as I am new at all of this.  I have never used the mail function, and this is the first DB project I have ever worked on.
  9. The dropdown box has a list of names (not email addresses) that it has gotten from the employee table of the database.  Once you select which names you want to send an email to, I need to get the email addresses from the employee table, to actually send the email.
  10. If I use an array and do this, I will end up with something like this.......... [code]<div>                                         <center><B>Send this form to:</B><BR>                                         <select name='emailname[]' multiple="multiple">                                         <?php     $result = mysql_query("SELECT * FROM employees") or die(mysql_error());     while ($row = mysql_fetch_assoc($result)) {         echo "<option>$row[name]</option>";     } $emailname=$_POST['emailname']; if ($emailname){ foreach ($emailname as $ename); }     ?></select></center>[/code] Would I then be able to do something like this to get the email addresses into the TO field of the email script: SELECT email from employees where $ename=name; email is the column name in the DB table and name is the column title where the name is found. Thanks, Ken
  11. I have developed a form that employees will fill out and then the results are saved in the mysql database.  I have a table called workorder, which stores most of the results.  I also have a table called parts, where the parts required are stored and an image table, where the images for this workorder are saved. I also have a workorder_image and workorder_parts table, to tie everything together.  I am not sure how to get the information into the JOIN tables.  The workorder, image and parts table all use a unique key, auto incrementing and I thought it would be these numbers that would tie it all together.  There could be up to 4 rows of images and 7 rows of parts for each workorder.  If I am trying to tie the images to the workorder table, would I be better off using the workorder number (which is the Month, Hour, Second format) and the image number, to tie them together? I hope this makes sense.......it is driving me crazy.  I had it all setup using one table and was advised this was bad as far as database normalization is concerned, so I have changed things around, but have gotten in over my head.  This is my first project using a database. Here is the queries I am using right now. [code]{   if (!empty($val))   {   $query = "INSERT IGNORE INTO parts (description,number) VALUES ('" . $description[$key] . "', '" . $val . "')"; mysql_query($query) or die(mysql_error().$query); } } 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()); //mysql_query("INSERT INTO workorder_parts (number, workorder_work_id) VALUES ('number[]', 'last_insert_id')")or die(mysql_error()); mysql_query("INSERT INTO workorder_image(image_image_id,workorder_work_id) VALUES ('$image_id', 'last_insert_id()')")or die(mysql_error()); } }[/code] this next one is for the images [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] Thanks, Ken
  12. I have a form that gets completed and then I want to email the results of the form to different people.  The person completing the form will choose who they want to send the results to.  I have a dropdown box, where the list of names used is obtained from the database. Is there a way, that when a person hilites multiple names that the email can be sent to these people. Here is what I have for the dropdown box. [CODE]<div>                                         <center><B>Send this form to:</B><BR>                                         <select name='tech' multiple>                                         <?php     $result = mysql_query("SELECT * FROM employees") or die(mysql_error());     while ($row = mysql_fetch_assoc($result)) {         echo "<option>$row[name]</option>";     }[/CODE] Once you have selected who the email goes to, and completed the form, I want to create a query that will send the email to these people when you press the submit button for the rest of the form.  The data is being saved in a database, but I don't have it set up to save the names of the people receiving an email (although I could if necessary.) Thanks for any help as this has me totally stumped. Ken
  13. Check with your host as to whether they allow CHMOD777.  My host (LunarPages) does not allow you to set your permissions to this.  I have been told by them to use 755 for folders and 644 for files.  Try these and see what happens.
  14. kenwvs

    Left Join

    I have gone through the database normalization process, and rewrote the queries in php to accomodate this, but now, in preparation for the next step, where the data can be retrieved, I need some help in understanding the LEFT JOIN. I had been advised that in the many=>many format, I should create a third table, but am now wondering if that was ONLY if my host supported INNODB table types. I have one table called workorder, where the basic information goes, and a second table where the part number and description of the parts required will go. The WorkOrder table has the following columns - work_id(primary key, auto-increment), work(work order number (in mmhhddss format), name, site, serial, severity, issue and sched(date) The Parts table has parts_id(primary key, autoincrement), number, description.  Do I need to add another column to the Parts Table that would have a field that is the same as the workorder table?  Perhaps the workorder # or use the primary key through the use of the mysql_insert_id().  Any direction on this would be appreciated. Ken
  15. Sorry to intrude here. What do you mean by escape everything being inserted into the database, and why do we do this?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.