Jump to content

Maq

Administrators
  • Posts

    9,363
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Maq

  1. Is KCFeditor a WYSIWYG? If so, you shouldn't use them they produce awful code. How are you creating this page?
  2. Heh, that's pretty cool
  3. Stop hi-jacking threads. If you have a question please create your own, I didn't realize you weren't the OP. To answer your question, Read more here.
  4. Come on open source!
  5. array_combine() creates an associative array. So now you have your description and prices linked. For testing to make sure they're linked properly, this will give you an idea of how this function works: $n = array_combine($_POST['description'], $_POST['price']); print_r($n); For insertion use something like: $n = array_combine($_POST['description'], $_POST['price']); foreach($n AS $desc => $price) { $sql = "INSERT INTO table_name_here_break_down (description, price) VALUES ('$desc', '$price')" mysql_query($sql) or die (mysql_error()); echo "Query: " . $sql . " "; }
  6. Awesome, it's about time something like this came out...
  7. You can get the last inserted id with mysql_insert_id(). That way you can just update to the most recent row rather than create a new one.
  8. Use this: $n = array_combine($_POST['description'], $_POST['price']); foreach($n AS $desc => $price) { echo "description: " . $desc . " - Price: " . $price . " "; }
  9. That's not true, you can have an array of posted values.
  10. What exactly are you trying to do? There may be a better solution.
  11. Have you implemented our suggestions? If so, can you post your current code?
  12. You need to use $_POST for all your input fields from your form (i.e. $_POST['form_description']). The reason you get the success message is because you print out the success message no matter what happens after submission.
  13. This is a pretty big task. I suggest you read up on Database Normalization and follow this tutorial on Basic Pagination.
  14. Just get ideas from this forum, look for repeated questions and make a snippet/tutorial for it.
  15. PHP is just a hobby for me, although I am a full time software developer. I would like to get into larger freelance projects, right now I just do small side projects.
  16. I hope you're joking. I mean, I don't have experience with porn sites, but I highly doubt that.
  17. Why are you adding WHERE id = 1? That's your problem, ID should be an auto-increment datatype in your database. You don't need to include it in your query. If you do, you will be overwriting what you just put in, which is the problem you stated in your original post. My understanding of your problem is that every time someone finishes the quiz or w/e the results are stored in the database. That's what the INSERT will accomplish.
  18. Yes, that's because you have an unconditional INSERT and whenever $_POST == 'Bay'). Like samshel pointed out, you should do this in 1 query. In this example if the user chose Bay it will insert "horsecolors/Bay.jpg" if they don't chose that then it will give the Image a default (horsecolors/default.jpg). Don't forget, put 'Image' in the appropriate position in the query string. if($_POST[breed] == "none") { print "You forgot to select a breed!"; include "footer.php"; exit; } else { $color = $_POST['Color']=="Bay" ? "horsecolors/default.jpg" : "horsecolors/{$_POST['Color']}.jpg"; $sql="INSERT INTO horsedata (Image, Name, Owner, Height, Breed, Gender, Registrations, Exp, Points, Records, Speed, Scope, Power, Obedience, Sociability, Sire, Dam, Foals, Awards, Grading, Hay, Grain, Vet, Shoes, Exercise, Grooming, DOB, Endurance, Intelligence, Color, temperament, legs, back, neck, head, pedigree) VALUES ('$color', '$_POST[Name]','$id','$_POST[Height]','$_POST[breed]','$_POST[Gender]','Not Registered','0','0','none','15','15','15','15','15','The All Great One','The Phantom Mare','None yet','This horse has not won any awards','Not Graded','No','No','No','No','No','No','3','15','15','$_POST[Color]','$_POST[temperament]','$_POST[legs]','$_POST[back]','$_POST[neck]','$_POST[head]','$_POST[pedigree]' )"; mysql_query($sql) or die(mysql_error()); echo "</pre> <table class="'table'"> Congratulations Your horse has been purchased"; } ?> </
  19. You were updating the same record over and over again. The reason you got an error for when you tried the INSERT is because you were using a WHERE clause. Try this instead: $sql = "INSERT INTO lesson01 (Q01, Q02, Q03) VALUES ('$ques[0]' , '$Q02', '$Q03')";
  20. What do you mean? That's the only thing you tell it to INSERT. Try (I cleaned up your code a bit, it's essentially the same): if($_POST[breed] == "none") { print "You forgot to select a breed!"; include "footer.php"; exit; } $sql="INSERT INTO horsedata (Name, Owner, Height, Breed, Gender, Registrations, Exp, Points, Records, Speed, Scope, Power, Obedience, Sociability, Sire, Dam, Foals, Awards, Grading, Hay, Grain, Vet, Shoes, Exercise, Grooming, DOB, Endurance, Intelligence, Color, temperament, legs, back, neck, head, pedigree) VALUES ('$_POST[Name]','$id','$_POST[Height]','$_POST[breed]','$_POST[Gender]','Not Registered','0','0','none','15','15','15','15','15','The All Great One','The Phantom Mare','None yet','This horse has not won any awards','Not Graded','No','No','No','No','No','No','3','15','15','$_POST[Color]','$_POST[temperament]','$_POST[legs]','$_POST[back]','$_POST[neck]','$_POST[head]','$_POST[pedigree]' )"; mysql_query($sql) or die(mysql_error()); echo "</pre> <table class="'table'"> Congratulations Your horse has been purchased"; if($_POST[Color] == 'Bay') { $sql="INSERT INTO horsedata (Image) VALUES ('horsecolors/Bay.jpg')"; mysql_query($sql) or die(mysql_error()); } ?> </
  21. You're not performing mysql_query() on the query.
  22. As opposed to...?
  23. Do the same with page statistics.
  24. with the query method :S Query?
×
×
  • 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.