Jump to content

F1Fan

Members
  • Posts

    1,182
  • Joined

  • Last visited

Everything posted by F1Fan

  1. Oh, no wonder. The problem is that you are posting to insert_comment.php like a traditional form (non-Ajax). Change your submit input types to button types. Also, "xmlhttp.open('GET','insert_comment.php?somevariable='+str,true);" will pass into the insert_comment.php file $_GET['somevariable'] witch will have whatever value your JS variable str happens to be.
  2. It doesn't look like you're actually sending the GET variables. This line: xmlhttp.open("GET","insert_comment.php",true); indicates that you are NOT passing those get variables, because you are just sending to "insert_comment.php" when you should be sending to something like "insert_comment.php?someVariable=someValue".
  3. You can always use $_REQUEST in place of $_POST and $_GET, because it will include both.
  4. Post your updated code. It sounds like you switched the wrong part of the code to get.
  5. I am aware of that. That's why I passed "this.value" in my first suggestion, and then passed "this" and used "this.value" in the JS function. Did you try my last suggestion?
  6. You could do a replace on both, just replace all double quotes with singles, again just for the compare. Really, you should just put this into a database. Then you could store the ID of the most recent chat in a hidden input, then add any new lines and update the latest ID. That would be faster yet, because you could then just add the new data to the field, rather than replacing the whole thing.
  7. If it's just a case thing, just convert both to all lowercase before comparing them.
  8. That doesn't seem right. Browsers don't inject HTML, they just display what you coded. Plus, if that was the case, the string length of <span id='test' style='color:red'> and <SPAN id=test STYLE="color:red"> are not the same, due to the missing single quotes around "test."
  9. Why don't you check if the string in the chat box is equal to the string in the text file?
  10. What is this? if (message != 2) That is causing it. You're calling the message function again in the function.
  11. JS: function goToSite(site){ if (site.value.length > 0){ if (confirm("Are you sure you want to go to "+site+"?")){ window.location = site.value; } else{ site.value = ""; } } } HTML: <select onchange="goToSite(this);"> <option value="">Select One</option> <option value="http://google.com/">Google</option> <option value="http://yahoo.com/">Yahoo</option> </select>
  12. $colours = array(); while ($row = mysql_fetch_array($result) { if (isset($colours[$row['field']])) { $colours[$row['field']]++; } else{ $colours[$row['field']] = 1; } } print_r($colours);
  13. I assume you meant you can't post, not you can. If that's the case, and you won't/can't post the errors, then you'll have to either figure it out on your own or hire someone. You can try posting to the freelance board.
  14. I don't understand why you're replacing ' and doing an escape string? Just do the escape, and you're done.
  15. Post ALL of the code, and post what errors you're getting.
  16. Not on the <option> tag, on the <select> tag. JS: function goToSite(site){ if (confirm("Are you sure you want to go to "+site+"?")){ window.location = site; } } HTML: <select onchange="goToSite(this.value);"> <option value="http://google.com/">Google</option> <option value="http://yahoo.com/">Yahoo</option> </select>
  17. What exactly are you trying to do? The reason you're getting \\\' is because you're escaping it, and I assume that it has already been escaped, so it's being double-escaped. Also, this line needs to be this way, if that's what you want: $body = str_replace("'", '', $body); or $body = str_replace('\'', '', $body);
  18. ignace, I think that's a great solution, and probably the one I would personally use, but PBD817 is so new to PHP (and possibly programming in general) that I think we should start him off a little slower than that. Splitting the queries up may help him understand the flow of PHP/MySQL syntax a little better. Maybe not.
  19. Whew, this code is tough to follow. It would be much easier to read if you added some new lines, and named your variables something that makes more sense. You are using incorrect function names, specifically "query_mysql" rather than the correct "mysql_query." As for the country count, I'm not sure how it's done in MySQL, but you can try the below, and if it's wrong, perhaps someone else will correct me. $buyerResult = mysql_query("SELECT count(*) FROM buyers"); $buyersRow = mysql_fetch_row( $buyerResult ); $buyersCount = $buyersRow[0]; $countryResult = mysql_query("SELECT count(DISTINCT(`Country`)) FROM buyers"); $countryRow = mysql_fetch_row($countryResult); $countryCount = $countryRow[0]; $supplierResult = mysql_query("SELECT count(*) FROM Suppliers"); $supplierRow = mysql_fetch_row($supplierResult); $supplierCount = $supplierRow[0]; $productResult = mysql_query("SELECT count(*) FROM Products"); $productRow = mysql_fetch_row($productResult); $productCount = $productRow[0];
  20. If you are looking to learn, follow the tutorial that I sent in my earlier post. If you need help with something specific, post the code you're referring to, and we can go from there. Be sure to include ALL relevant code, but be sure to exclude your DB host/user/pass.
  21. I didn't look to see how that site works, but jQuery's dialog would probably do what you're looking for: http://jqueryui.com/demos/dialog/
  22. As B0b demonstrated, you need to select the data, extract the row, and retrieve the column from the row and save it to those variable names. My example was assuming that you knew the basics of assigning values to variables. Please learn the basics of PHP before continuing to post. Otherwise, you're basically asking us to write your code for you. We are all glad to help users stuck on specific problems, or help them learn new techniques, but we try not to make a habit of just writing things for people.
  23. If you are so new that you are unfamiliar with even printing a variable on the screen, then you should really go through a tutorial. Here's a good one to get you started: http://www.w3schools.com/php/php_syntax.asp
  24. Are you brand-new to PHP programming? Unless I don't understand what you're asking, this seems like a really simple question. Get the counts from the tables, then echo them out. <table width="500" border="0"> <tr> <td width="62"># Buyers</td> <td width="110"><?php echo $buyersCount; ?></td> <td width="93"># Suppliers</td> <td width="55"><?php echo $suppliersCount; ?></td> <td width="111"># Products</td> <td width="43"><?php echo $productsCount; ?></td> </tr> </table>
  25. Just do a "SELECT count(*) FROM table" for each of them, and display the results.
×
×
  • 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.