Jump to content

Vegas1

Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by Vegas1

  1. and for what it's worth I figured out how to do it which is what was being asked originally and my solution was <td>".$rows['part_condition']."</td><td><img src='".$rows['part_image']."'height='50' width='50'/></td> and you can see from my original link posted above that it works and look at that no path in there anywhere huh? it pulls the path from the database which both Drumlegend and I were asking how!
  2. Jessica you're very arrogant and your answers are not helpful at all, especially to a person like Drumlegend who states he's never done anything like this before and he's trying to learn. I know I'll never come back to this forum ever again!
  3. of course it's not complicated to someone that works with PHP all the time, but for most of the beginners that come here looking for help it is a huge complication some times. I've searched this topic for weeks and tried maybe 15 or 20 examples from other forums and tutorials with no success. I have limited experience using PHP and understand that PHP will echo html but it's not a simple as you put it, since both of us are pulling the path from MySQL what you have given as an example will not work. <td>".$rows['id']."</td><td>".$rows['part_number']."</td><td>".$rows['model_number']."</td><td>".$rows['serial_number']."</td><td>".$rows['part_manufacture']."</td><td>".$rows['part_available']."</td><td>".$rows['part_quantity']."</td><td>".$rows['part_condition']."</td><td>".$rows['part_image']."</td> with my line of code above I have tried every example I have found with using a relative path for my images to various versions of the code below with no success. <img src="<?php echo $imageSrc; ?>" /> I appreciate you taking the time to offer your input to assist in this matter, every bit of input is helpful. And Drumlegend I apologize for hijacking your thread that wasn't my intentions, I was merely attempting to clarify your question by using my issue as a visual example.
  4. he is asking how to get the image path stored in his MySQL database to display the image on his search result page. Drumlegend I am fighting with this same scenario as well. I have my images uploaded to a folder and the path to the folder stored in MySQL and when I do a search it comes up like this, http://jemtechnv.com/portal/inventory/inventory_search.php Instead of the image being displayed at the end of each row it displays the path to the image.
  5. Thanks for your help mac_gyver, I renamed all my colums and changed my variable names as well and now it all works. Thanks for the link to the key words, I was wondering if I was using something that was reserved.
  6. So I added the echo MySQL_error(); and here is what it outputs: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'condition, availability, reason, notes, warranty_date, purchase_date, location, ' at line 1The file ampwhite_cat3.jpg has been uploaded, and your information has been added to the directory I've checked the 7 listed values and there is no difference them and the other 9 values. other than the other values have an underscore, so part_number, serial_number and so on? do I need to keep using that format in my values?
  7. Ok so I though the problem was resolved, well the original of the image path being stored in MySQL is solved but after doing 2 submissions with the add_new.html form it just stops working. No errors whatsoever, the script continues to process the input form, it will take the image and move it to the correct folder on the server and post a success reply saying the name of the image and that it's been uploaded but none of the data is posted in MySQL, nothing, not the image path, image name nor any of the other data from the form. it just stops posting to MySQL. I thought this may be a problem with my test server and xampp so I tried it on 2 production servers with the same results. So, I'm stumped, is it a problem with the html form or is it in the PHP code?
  8. Never mind I figured it out right after posting this, the $pic variable has to be removed from the values field and $target put in it's place and it will post the image path in the image field of MySQL otherwise with both of them in the value they bump heads and nothing gets posted to the db and no error is displayed either.
  9. So here is my problem, I'm developing this for my business and what I'm doing is in an inventory form I display the image of the item in inventory, when I add a new item to the inventory the image is uploaded to the server stored in a folder and ideally the path to the image is stored in MySQL, well I had it working with the current script I'm using, I was even able to display the image in a search page. Put now it doesn't work, the image is still uploaded to the server and put in the correct folder but the path won't post in MySQL, as a matter of fact nothing posts to the database at all. Originally I was able to get the script to upload the image and move it to the permanent folder but it was only posting the form content and the name of the image not the path. I realized that the $target variable needed to be included in the INSERT function so I added $target to the values and it was working but now it's stopped, all I get is a confirmation that the image was posted and I can see it's in the folder but nothing gets posted to the database. I'm not sure if this is a problem with the code or if I have some issues with xampp so I broke the script down into a basic 6 input page and tried it with the $target variable not in the INSERT field and it will post the data but only the image name not the path but it does move the image to the correct folder. what am I doing wrong? Note that I never get any type of errors from my PHP script at all, every time I get a confirmation that the file with the image name has been uploaded and the image does in fact upload to the correct folder but I get no errors at all unless I force an error by wrong password or such or create a parse error or something along that lines so I know the script is working. here is my html: <head> <style type="text/css"> .auto-style1 { font-family: "Baskerville Old Face"; font-size: x-large; color: #FF0000; } </style> </head> <span class="auto-style1">ADD NEW ITEM</span><form method="post" action="process_original.php" enctype="multipart/form-data"> <p> Serial Number: </p> <input type="text" name="s_number"> <p> Part Number: </p> <input type="text" name="p_number"> <p> Model Number: </p> <input type="text" name="m_number"> <p> Please Upload a Photo in gif, png, or jpg format. </p> <p> Photo: </p> <input type="file" name="p_image" size=35 > <p> Description: </p> <textarea cols="35" name="description" style="height: 35px"> </textarea> <p> Manufactur: </p> <input type="text" name="manufacture" size=30 > <br> <br> <input TYPE="submit" title="Add data to the Database" value="Submit"> </form> and here is my PHP code: <?php //This is the directory where images will be saved $target = "uploads/images/"; $target = $target . basename( $_FILES['p_image']['name']); //This gets all the other information from the form $var1=$_POST['description']; $var2=$_POST['p_number']; $pic=($_FILES['p_image']['name']); $var3=$_POST['m_number']; $var4=$_POST['s_number']; $var5=$_POST['manufacture']; // Connects to your Database mysql_connect("localhost", "root", "xxxxx") or die(mysql_error()) ; mysql_select_db("test") or die(mysql_error()) ; //Writes the information to the database mysql_query("INSERT INTO test (description,p_number,p_image,m_number,s_number,manufacture) VALUES ('$var1', '$var2', '$pic', '$var3', '$var4', '$var5')") ; //Writes the photo to the server if(move_uploaded_file($_FILES['p_image']['tmp_name'], $target))<----I'm pretty sure this needs to be in the values but how? { //Tells you if its all ok echo "The file ". basename( $_FILES['p_image']['name']). " has been uploaded, and your information has been added to the directory"; } else { //Gives and error if its not echo "Sorry, there was a problem uploading your file."; } ?>
×
×
  • 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.