Jump to content

Jessica

Staff Alumni
  • Posts

    8,968
  • Joined

  • Last visited

  • Days Won

    41

Everything posted by Jessica

  1. There is no real right or wrong, but out of the three the first is the worst. The second two are at least clear that there are multiple items. The third is most descriptive depending on what other variables you might have. I think $arrAnswers or $answersArr is kind of annoying honestly but I might be the only one. Actually, all of them are wrong, because you've made them a function using a variable string. Functions end in (), variables start with $. While it's possible to do $answer();, what you're doing is calling a function with the name stored in $answer. So it could be $answer = 'bob'; $answer(); and it would be the same as bob();
  2. So is this the code that did not work? What happens when you attempt it?
  3. both Psycho and I did address that in the previous post, and I believe he posted an actual example of how to do it.
  4. On your last line, you don't need the variable in quotes. I assume the shrug means you didn't get what you expected. you need to provide more info.
  5. You'll need to post the code for delete.php then. And yes you will need a unique ID.
  6. You'd either use AJAX or load a new page.
  7. No, you'll echo it after you've put everything into it. Just try a simple version of your original project. I assume your product has a name, try adding each name to the string $first_html .= " ".$row['product_name']; //Make this the right variable for your db. Then outside of the loop, echo that string.
  8. I just realized I was making it even more difficult than it needs to be. <?php $featured_results = mysql_query("SELECT * FROM products LEFT JOIN product_images ON products.product_id=product_images.product_id WHERE products.product_featured='1' AND products.product_active='1' AND thumb='1'"); $first_html = ''; $second_html = ''; while($row = mysql_fetch_assoc($featured_results)) { //Put your HTML into the strings in here. } ?> What are you lost on? Try using this and editing it for your code. you'll also want to turn your SQL into a join at some point, to really cut down on queries. But for now just see if you can get this working.
  9. Yes. Here's a bit to get you started. <?php $featured_results = mysql_query("SELECT * FROM products LEFT JOIN product_images ON products.product_id=product_images.product_id WHERE products.product_featured='1' AND products.product_active='1' AND thumb='1'"); $results = array(); while($row = mysql_fetch_assoc($featured_results)) { $results[] = $row; } $first_html = ''; $second_html = ''; foreach($results AS $result){ //Put your HTML into the strings in here. } ?>
  10. Try doing what I said, and I'll help you fix any problems. What I said can be easily converted into psuedo code at least.
  11. Considering these forums are not supposed to be used to get your homework coded, perhaps you should take your own advice regarding reading. The forum rules also speak about asking for work to be done urgently. Demanding help and calling names is probably the *least* effective way to actually get help.
  12. Rather than attempting to query your database twice to get the same set of data, you should select the data out into an array, then loop through the array. You could also avoid doing two loops by having one loop which builds your two different sets of HTML (into strings), then echoing the HTML separately.
  13. The way you have described makes sense to me. Why don't you try it and see how it goes?
  14. Yeah IE does that with the files, I always go and do a shift refresh in Fx. Glad you got it working.
  15. If you're talking about in the form, most people would just select the text out of the box and delete it, or you can use the reset. If you're talking about deleting an existing comment, you would delete it from the database. Either way, I don't see anything having to do with delete in your code. When you say you tried it, what did you try.
  16. I just asked if you know how to do select and you said yes. Now you say you don't. Maybe this is a language barrier issue, but you're being fairly unclear. You really should talk to your teacher, if you're giving us the true story.
  17. true, I was just trying to provide a jumping off point. I kind of expected him to come back and go "now how do I do it for more arrays" :-P
  18. You said in your first post that your queries fail, elaborate. What fails, what error do you get? I don't see any select statements in your posted code, only an insert.
  19. Start with the first part, selecting the data. do you know how to do SQL queries?
  20. If I do your homework do I get a gold star on my report card? You need to post a specific problem and question, with specific code. Your request is too general IMO. If you're that concerned about it, go to your teacher and be honest that you need more time and help.
  21. You'll need to either create it as a javascript function (I have no idea what you're attempting is possible in JS), or use AJAX to submit the code to your PHP page. Either way, you'll need javascript help. The third option I see is instead of doing it onclick, make the page submit, use PHP to clean it up, then refill the form with the corrected content.
  22. You're mixing PHP and javascript. They don't work like that.
  23. Which browser are you using? Once you have that file open, try a shift refresh while viewing it. I know this is the most frustrating thing with CSS, I've had the same problem.
×
×
  • 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.