Jump to content

jdavidbakr

Members
  • Posts

    271
  • Joined

  • Last visited

Everything posted by jdavidbakr

  1. So ... is there a file at /home/bob/public_html/mysite/profiles/write.php?
  2. Here is where your error is: if (!empty($_POST['event2'])) { $event[] = $_POST['event']; } if (!empty($_POST['event2'])) { $event[] = $_POST['event']; } You're checking event2 twice and assigning it to the undefined 'event' value.
  3. You want to store the content of the pages in a single column in the database? You can do that, but it's really not any different than using flat files. Actually, flat files would be far easier to manage. The responses above are the correct way to use MySQL with a database, put elements into the database that you then use to build the pages. If your site doesn't need that level of complexity, you're probably better off just using flat files and combining a wrapper file with content files in PHP or something of that nature.
  4. No, you don't need (or want) to auto-increment, just do a query before the insert to get the maximum value of cat_order for that user and add one to it when you insert the new one. If there isn't a category for that user yet, when you add one to it you'll get '1'.
  5. Does the school server have MySQL running on it and have the connection credentials you are trying to connect to on it? If you echo mysql_error() after the failed connection it will tell you exactly why it's not working.
  6. Maybe build an 'in' clause - i.e. $i = the remainder $statement = "select * from ads where id in (".(($i+1)%20).",".(($i+2)%20).",".(($i+3)%20).",".(($i+4)%20).")";
  7. One troubleshooting step I do if I get an incorrect count in an aggregate query like that is to remove the group and do a select * in phpMyAdmin. Then I look to see what is causing the additional row(s) that the count is returning. Once you get the select * query to return the correct number of rows if you count them manually, then add the 'group by' and the count() column.
  8. When I have something like this, I query all the options, then loop through the results, either deleting the row if the checkbox doesn't exist or replace (or insert, which if you have constraints to prevent duplicates would prevent you from overriding the existing rows if there is data there that you don't want to have to recreate).
  9. You don't happen to have an 'if($row['album_cover'] = 1)' statement between your fetch and your dump, do you?
  10. Off the top of my head, not sure this will work but maybe this will get you started in the right direction. (Or maybe it will get you started in the wrong direction...) select if(modification.field = 'product_name' and modification.value is not NULL, modification.value, product.product_name) product_name, if(modification.field = 'manufacturer' and modification.value is not NULL, modification.value, product.manufacturer) manufacturer from product left join modification on (modification.product_sku = product.product_sku and modification.table = 'product') group by product.id I'm assuming you're linking the modification to the product and product_vendor tables via the product_sku; the price table would be a bit more complex but not too much, if the above query works it shouldn't be too hard to extend it to work for the price table.
  11. Look at what the error says. "output started at /home/site/public_html/private/file.php:446" - this error means that you attempted to send headers on line 570 (probably session_start) but you've already echoed something at line 446. You can't send headers (session_start() sends headers) after you've sent something to the browser.
  12. You're welcome, glad you figured it out. That's the danger of typing code without running it first. Or I could say I didn't want to give you the solution without you having to figure it out
  13. Do you have shell access? The DNS resolves for me, so it's not an issue with the site. There are a number of reasons why it wouldn't resolve, if you're on a shared server it does seem very odd to me. If it's a dedicated server it may have something messed up with the DNS settings. I don't know offhand of any settings in PHP that would break DNS.
  14. Whoops, my bad, you need an $i++ in the while loop
  15. if $_POST['click_php'] is not set when the script starts, it will never get set, and $i will never increment, which will result in an endless loop. You need to set a <input type="hidden"...> element in your form, and set it to $i+5, and use that posted value to initiate $i at the beginning of your script, defaulting to 0. Something like echo '<form name="PHP" action="'.$PHP_SELF.'" method="POST" />'; if (isset($_POST['next_start'])) { $i = $_POST['next_start']; } else { $i = 0; } $end = $i + 5; while ($i < $end) { echo "<p>$i</p>"; } echo '<input type="hidden" name="next_start" value="$end" />'; echo '<input type="submit" name="click_php" value="PHP form" />'; echo '</form>';
  16. "Couldn't resolve host 'pbboard.com'" seems to imply that you may have a DNS issue.
  17. Are you still getting this error? This means that you have started sending content at messages.php line 58 before you called session_start(). You can't output anything to the browser before you call session_start()
  18. if you have access to iptables you can set up an iptables recent rule to prevent more than a certain number of requests from any IP in a given amount of time. It's not entry-level iptables stuff but it's not too terribly difficult (just be careful that you don't lock yourself out )
  19. Each time the user hits 'submit' you are creating a new connection to your webserver. Remember that PHP is not an interactive language - the web is stateless, so you have to send a complete page. You have to build the form so that when the user submits it then you have what you need to generate the next page.
  20. Something like this? select ourscore, theirscore, if(ourscore > theirscore, 'WIN', if(theirscore > ourscore, 'LOSS', 'TIE')) calc;
  21. <option value=$eng_name> will fail if there are spaces in $eng_name - you want to enclose this is quotes for sure.
  22. Are you echoing $message_content? I.e, this works: <? $message_content = 'This is a test: <a href="test.php">Test</a>'; $pattern='/<a href="([^\"]*)">/'; $replace='<a href="\\1" onclick="return confirm(\'You are being redirected to \\1. Proceed?\')">'; $message_content = preg_replace($pattern, $replace, $message_content); echo $message_content; ?>
  23. I think sasa's answer is what you want - do a union of the two queries.
  24. Sanitize your input - $title = mysql_real_escape_string($_GET['title']);
  25. If it's just those characters, then I'm kind of confused as to why htmlentities() isn't giving you a string that you can display. Can you isolate the section of the string that's causing the issue? Are you just echoing the data or are you using something like DomDocument do draw it?
×
×
  • 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.