Jump to content

pcbguy

Members
  • Posts

    48
  • Joined

  • Last visited

    Never

Everything posted by pcbguy

  1. I have a script for a photo gallery that I downloaded and am trying to make fit into our site. I am having some trouble because I simply just don't know enough about php. I really wanna change the background and have done so but it only changes it on the top section. So frustrating. I have gone through all the css and cannot find another place to change it. Is there any way anyone could give me a hand with this? I really appreciate it. I'm sure it will take someone about 60 seconds to figure out what I'm doing wrong.
  2. I had an extra " at the end between </b> and <br>. I am going to try it now without that. It worked. Thanks.
  3. I have a form that puts a picture with year, make, model and description into a database. When I output it I want the year, make and model to appear bold. What is the best way to do this? Not sure if I should put the bold at the form that uploads, or have it bold the script that inserts the info into the database. I hope this makes sense. I can explain further if I need to. I tried to put the <b> in the output script and it didn't work. Thanks Here is the part of the output script: Echo $info['year']."<br>"; Echo $info['make']."<br>"; Echo $info['model']."<br>"; Echo $info['price']."<br>"; Echo $info['description']."<br>";
  4. Any ideas. I found this http://www.dynamicdrive.com/dynamicindex17/rsspausescroller/ But I want to use an RSS feed off another site and not sure where to put that in.
  5. I want to put it into a ticker or scroll of some sort. I know where a couple of xml feeds are. Can it be done with just PHP or do I have to use it with the AJAX and Java?
  6. Wondering how the best way to do this is. I have found several tutorials that involve AJAX and Javascript. Is there any way to do it without these and just use PHP?
  7. I changed the server to a MySQL 5.0 database. I still cannot get it to work. I get "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 'SET year='2006', make='Mercedes', model='" Any ideas? <?php //This is the directory where the images will be saved $target="images/"; $target=$target.basename($_FILES['picture']['name']); //This gets all the other information from the form $position=$_POST['position']; $year=$_POST['year']; $make=$_POST['make']; $model=$_POST['model']; $price=$_POST['price']; $description=$_POST['description']; $picture=($_FILES['picture']['name']); //Connects to Database include "connect.php"; //Writes the information to the database $query = "INSERT INTO forsale (position,year,make,model,price,description,picture) VALUES ('$position','$year','$make','$model','$price','$description','$picture') ON DUPLICATE KEY UPDATE SET year='$year', make='$make', model='$model', price='$price', description='$description', picture='$picture'"; mysql_query($query) || die(mysql_error()); //Writes photo to the server if(move_uploaded_file($_FILES['picture']['tmp_name'],$target)) { //Tells you if its all okay echo "The file" .basename($_FILES['uploadedfile']['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."; } ?>
  8. I found it. It is a MySQL 4.0 database. I believe the "ON DUPLICATE..." only works on 4.1 and up. I am setting up a new one with a 5.0 database. Hopefully that will solve the problem.
  9. I seem to vaguely remember picking MySQL 4.0 when I set up the database on my host. Not sure why I would have picked 4.0 but I think I did. Maybe I need to redo it with a 5.0.
  10. Like this? $query = "INSERT INTO for_sale (position,year,make,model,price,description,picture) VALUES ('$position','$year','$make','$model','$price','$description','$picture') ON DUPLICATE KEY UPDATE SET year='$year', make='$make', model='$model', price='$price', description='$description', picture='$picture'"; mysql_query($query) || die(mysql_error()); Got same error. "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 'ON DUPLICATE KEY UPDATE SET year='2007',"
  11. Where do I look on phpmyadmin to see the version of MySQL?
  12. I get : "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 'ON DUPLICATE KEY UPDATE year='2007', mak" Do I have the wrong MySQL version?
  13. I tried to use it and it gives me the "file has been uploaded message" from the bottom but when I check my database nothing has changed. The help here has been awesome. Thanks everyone for your help so far. The 'position' is the only unique key and is also the primary key. <?php //This is the directory where the images will be saved $target="images/"; $target=$target.basename($_FILES['picture']['name']); //This gets all the other information from the form $position=$_POST['position']; $year=$_POST['year']; $make=$_POST['make']; $model=$_POST['model']; $price=$_POST['price']; $description=$_POST['description']; $picture=($_FILES['picture']['name']); //Connects to Database include "connect.php"; //Writes the information to the database $query = "INSERT INTO for_sale (position,year,make,model,price,description,picture) VALUES ('$position','$year','$make','$model','$price','$description','$picture') ON DUPLICATE KEY UPDATE year='$year', make='$make', model='$model', price='$price', description='$description', picture='$picture'"; mysql_query($query); //Writes photo to the server if(move_uploaded_file($_FILES['picture']['tmp_name'],$target)) { //Tells you if its all okay echo "The file" .basename($_FILES['uploadedfile']['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."; } ?>
  14. The key is the 'position' field. I thought it would automatically look for a duplicate in a key or unique field and use that. 'Position' is the only unique field.
  15. That is what I want to do. I just started another thread.
  16. I thought I figured out how to do this but I am getting an error on the line that starts with ON DUPLICATE KEY.....Tells me unexpected T_String. What did I do wrong? Thanks <?php //This is the directory where the images will be saved $target="images/"; $target=$target.basename($_FILES['picture']['name']); //This gets all the other information from the form $position=$_POST['position']; $year=$_POST['year']; $make=$_POST['make']; $model=$_POST['model']; $price=$_POST['price']; $description=$_POST['description']; $picture=($_FILES['picture']['name']); //Connects to Database include "connect.php"; //Writes the information to the database mysql_query("INSERT INTO for_sale (position,year,make,model,price,description,picture) VALUES ('$position','$year','$make','$model','$price','$description','$picture')"); ON DUPLICATE KEY UPDATE year=VALUES($year), make=VALUES($make), model=VALUES($model), price=VALUES($price), description=VALUES($description), picture=VALUES($picture)'' //Writes photo to the server if(move_uploaded_file($_FILES['picture']['tmp_name'],$target)) { //Tells you if its all okay echo "The file" .basename($_FILES['uploadedfile']['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."; } ?>
  17. That will delete it? I put that at the beginning of the script?
  18. Maybe some sort of If statement that says if position=? then it replaced all the other columns with the current information.
  19. Can it be written into the same script so that it will automatically delete the old entry if someone puts in the same 'position'?
  20. I have the below form that calls the below php script. The 'position' entry is the primary key and is what I use to call each record. How can I input another record with the same 2 digit position number and have it over write the previous entry? Thanks. <html> <head> <title>Form to Add Car For Sale</title> </head> <body> <form enctype="multipart/form-data" method="post" action="add.php"> Position<br> <input type="Text" name="position" size="2"><br> Year<br> <input type="Text" name="year" size="25"><br> Make<br> <input type="Text" name="make" size="25"><br> Model<br> <input type="Text" name="model" size="40"><br> Price<br> <input type="Text" name="price" size="25"><br> Description<br> <input type="text" name="description" size="200"><br> Picture<br> <input type="File" name="picture" size="40"><br><br> <input type="hidden" name="MAX_FILE_SIZE" value="30000"> <input type="submit" name="submit" value="Upload"> </form> </body> </html> <?php //This is the directory where the images will be saved $target="images/"; $target=$target.basename($_FILES['picture']['name']); //This gets all the other information from the form $position=$_POST['position']; $year=$_POST['year']; $make=$_POST['make']; $model=$_POST['model']; $price=$_POST['price']; $description=$_POST['description']; $picture=($_FILES['picture']['name']); //Connects to Database include "connect.php"; //Writes the information to the database mysql_query("INSERT INTO for_sale (position,year,make,model,price,description,picture) VALUES ('$position','$year','$make','$model','$price','$description','$picture')"); //Writes photo to the server if(move_uploaded_file($_FILES['picture']['tmp_name'],$target)) { //Tells you if its all okay echo "The file" .basename($_FILES['uploadedfile']['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.