Jump to content

Alex

Staff Alumni
  • Posts

    2,467
  • Joined

  • Last visited

Everything posted by Alex

  1. Use RAND() Ex: SELECT col_name FROM table ORDER BY RAND() LIMIT 10
  2. You can just do: file_put_contents('details/horselistfile.txt', $horsearray . file_get_contents('details/horselistfile.txt')); file_get_contents() and file_put_contents() do the same thing as fopen(), fread()/fwrite and fclose(), they just make things easier for you.
  3. Probably because of the syntax error, a missing ), try: $allowedTypes = array( "image/jpeg", "image/jpg", ); if(!in_array($uploaded_type,$allowedTypes)) { echo "You may only upload jpg picture files.<br>"; }
  4. If public_html was your previous root directory then the contents of public_html should be placed into htdocs/
  5. The undefined functions could be the result of a lot of things, like forgetting to include files. As for the other undefined function, unless that's a custom function there is no built in function called MySQLError(), it's mysql_error().
  6. Just upload the contents of your previous root directory into your new root directory. In your specific case public_html was your previous root, and C:\xampp\htdocs is the root dir for xampp.
  7. Are you actually running the query (mysql_query())?. If so, double check your column names. It's also usually not a good idea to preform functions like strip_tags() on passwords that will be encrypted. If users decide to use tags in their passwords (don't know why they would..) it would confuse them by changing their password, and although this scenario is unlikely there is no disadvantage because anything possibly malicious would be rendered harmless after an md5 encryption. Another good security measure is utilizing a salt.
  8. You can only do the latter if you're trying to access a static method, meaning that you can't just do $instance::method();. So the circumstances in which either would be used are totally different. Assuming that static methods are properly named so the speed of execution will be about the same, if they're not properly marked the execution time will be ~double (Note: This is referring to just calling a function, not taking any additional processing into account).
  9. Np Happens to everyone. Just make sure to mark the topic as solved, there's a button on the bottom left to do so.
  10. While this is true and perhaps somewhat hypocritical it's not like we actually trace back and understand much of our ancestry. If you go back just 20 generations there are over 1,000,000 people that make up your DNA, do you know even a small fraction of them? There's a point where it becomes unnecessary to track back where your ancestors are from and just consider yourself a natural citizen of that location (most people do it just by where they were born, not even referencing ancestors). Otherwise technically we're all just African immigrants.
  11. if(empty($rname)) should work. Are you sure you're using the correct name to access the value? You're telling us something is wrong, but you're not telling us what's happening.
  12. What is happening then? empty() should work.
  13. Whoops, forgot to address your second problem You're gonna want to use echo html_entity_decode(). Ex: echo html_entity_decode($clean_content[0]); Because if you look at their source they use html entities for the quotes inside the a tag.
  14. I'm not really familiar with the structure, and it's hard to decipher someone else's code but the easiest solution would be just to use strip_tags. $super_clean_name = strip_tags($super_clean_name_1[1]);
  15. Looks like you want to do something like this? if(isset($_POST['submit'])){ for ($i = 0; $i < count($_POST['box']); $i++){ ${'box_' . $i} = $_POST['box'][$i]; echo ${'box_' . $i}; } Variables will then be like $box_0, $box_1, etc..
  16. Or $savelocation="./upload/{$horseid}test.jpg";
  17. It's not all to secure with a session either, generally to clear their session all they need to do is restart their browser.
  18. Being discriminated on for any reason would surely vary for different areas in the US, it's really too large to consider it as a whole. The US is pretty diverse and in general you really don't have much to worry about in that department. However, communication skills are another thing. Although depending on the specific job, good communication skills are usually an essential.
  19. You're looking for mod_rewrite
  20. -> is used to access methods and properties of an object in PHP OOP. There are plenty of examples there to help you understand. The reserved variable $this is used to access methods and properties of a class from within one of it's methods.
  21. PHP CLI is running PHP from the command line. You can also compile PHP into stand-alone executables though.
  22. You're talking about PHP CLI right? echo "Guess a word?:"; $word = fread(STDIN, 80); echo $word;
  23. Actually, you're limited by the size of a TEXT field in a MySQL database. That's 65534 bytes, I think. Of course you're gonna be limited by something.. but I was referring to small limits, like the 1000 character limit he was referring to.. Who's going to write a 65534 byte post?
×
×
  • 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.