Jump to content

AyKay47

Members
  • Posts

    3,281
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by AyKay47

  1. try $sql = "SELECT * FROM content WHERE `live` LIKE '0' AND `date` >= SUBDATE(CURRENT_DATE, 1) ORDER BY `date` DESC LIMIT 40";
  2. Also, post what error(s) you are receiving.
  3. error_reporting
  4. What does a view source show on the blank div?
  5. Oh the irony!
  6. 1. Do not use w3schools as a resource. Their material for the most part is outdated and misleading. Typically for email validation I like using the filter_var function with the FILTER_VALIDATE_EMAIL flag set.
  7. But a query doesn't output anything to the browser. So, as requinix already has asked, what code is actually outputting "Array"?
  8. This post makes little sense, and is downright wrong. Having the proper error reporting is imperative during the developmental stages, and since the OP has not specified what stage the site is in, I assume it's in development. Variable initialization is technically not required, but it should be exercised as good convention. Learning and exercising good practices from the beginning is very important in molding a "good programmer". OP, the errors you are being thrown are self explanatory. If you still cannot solve the issue after reviewing the code, post the updated code and we will be more than happy to help you further.
  9. Bubblychaz, I encourage you to study the code that you have been given so that you may find some of these errors yourself instead of asking as soon as you are thrown an error. Make sure that you have error_reporting() set to -1 and display_errors() set to 1 or 'on'. That way PHP will let you know when and where something goes wrong so you can debug the code yourself.
  10. Post the updated code.
  11. 1. Do not use w3Schools as a resource. They use outdated and flat out wrong coding procedures. 2. Have you tried googleing something like "PHP shopping cart tutorial"? This should link you to a number of resources on the subject.
  12. As barand has stated, we need more information pertaining to your issue in order to give you an adequate answer. However I do notice some things right off the bat: You are using the concatenation operator .= on $random_vid which does not yet exist. This will trigger an E_USER_NOTICE error. Why do you pick 2 random numbers when you are only using one?
  13. A note here; Verify files by their extension, as the server uses the extension of a file and not the MIME type to determine what to do with it.
  14. You are correct. However as a note, only use the die() function during development and not for production. Not very user friendly.
  15. The function you wrote really doesn't do anything helpful to your situation. What RegExp have you tried so far?
  16. I am on my way out the door, but I have come up with a possible solution to your issue. It is not pretty and I'm sure there is a much easier way to go about this, but this code will hopefully steer you in the right direction until someone else posts a better solution. $text = 'Lot Description|Flat|Yes;Lot Description|Adjoins Greenbelt|Yes;Lot Description|Wooded Lot|Yes;Lot Description|Irregular|Yes;Outside Features|Deck|Yes;Outside Features|Other - See Remarks|Yes;Outside Features|Utility Shed|Yes'; $arr = explode(';', $text); $lotArr = array(); foreach($arr as $val) { if(strpos($val, 'Lot Description') !== FALSE) { $i = str_replace('Lot Description|', '', $val); if(!isset($lotArr['Lot Description'])) $lotArr['Lot Description'] = array(); $lotArr['Lot Description'][] = $i; } if(strpos($val, 'Outside Features') !== FALSE) { $i = str_replace('Outside Features|', '', $val); if(!isset($lotArr['Outside Features'])) $lotArr['Outside Features'] = array(); $lotArr['Outside Features'][] = $i; } } foreach($lotArr['Lot Description'] as $key => $val) { if(strpos($val, '|Yes') !== FALSE) $lotArr['Lot Description'][$key] = str_replace('|Yes', '', $val); } foreach($lotArr['Outside Features'] as $key => $val) { if(strpos($val, '|Yes') !== FALSE) $lotArr['Outside Features'][$key] = str_replace('|Yes', '', $val); } print_r($lotArr); Results: Array ( [Lot Description] => Array ( [0] => Flat [1] => Adjoins Greenbelt [2] => Wooded Lot [3] => Irregular ) [Outside Features] => Array ( [0] => Deck [1] => Other - See Remarks [2] => Utility Shed ) ) As you can see, it splits the lot description properties and the outside features properties into two arrays. The above code assumes a number of things that need to be clarified. But again, this was done rather quickly and hopefully it will give you an idea.
  17. Good practices should be exercised from the very beginning of learning how to code in a certain language. In this particular case, any data that comes from a user and is used in a query needs to be properly sanitized using mysql_real_escape_string to prevent SQL Injection as noted earlier.
  18. There are numerous ip2long6 and ip2bin6 custom function definitions in the user contributed notes section of the documentation of the ip2long function.
  19. A side note, relying on a submit button value being passed with the form upon submission is unreliable. There are certain situations in certain browsers where the submit button value will not be passed when the form is submitted. I recommend either using $_SERVER['REQUEST_METHOD'] == 'POST' or a hidden input to check whether a form has been submitted.
  20. No, apply the advice in requinix post to your code. If you are still having issues with it post the updated code along with the issue(s) here.
  21. Using __FILE__ will allow you to delete files dynamically. unlink("somefile.php") will be static. May I ask why you are wanting to do this in the first place?
  22. What exactly is displayed in the index page? What debugging steps have you taken?
  23. We are all on the same team here. Can't we all just get along?
  24. Please mark this as solved.
  25. As a side note to the original code posted, from the PHP manual:
×
×
  • 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.