Jump to content

README: PHP Resources & FAQs


Philip

Recommended Posts

This topic is here for those looking for help on frequently asked questions, or just need some direction in where to find more information.

Resources

Table of Contents for FAQs


Link to comment
Share on other sites

Can you do / write _________ for me?

 

Sure, we could do it for you. But it is going to cost you, and better suited for the freelance forum. Instead, show us some code that you've tried or ask for guidance on what is the best way to go about something.

 

Otherwise, don't expect anything except for snarky replies! Remember, we are volunteering our time to help you. Help us help you by at least attempting to solve the problem on your own!

Link to comment
Share on other sites

Call to undefined function "mysql_connect"

 

This means your MySQL PHP library is not loaded. You should check to see if it is loaded by running phpinfo();. If it is not included, you need to check your php.ini configuration or contact your host for more information. It should be noted that mysql_ functions should be replaced with PDO library or the mysqli library

Link to comment
Share on other sites

I'm getting a "headers already sent error". What does that mean?

 

When you get this error, it means that you've already started to send content to the user and you're trying to send other header information that should be at the beginning of the request. Common situations include outputting content and trying to redirect the user later, or outputting content and then trying to set cookies. This works in javascript, because it is clientside. This doesn't work with php or other server-side languages, because cookies and redirects are sent in the header of a response, and the header goes at the beginning of the response, before content.

 

It's like trying to dial a number to call your friend when you already called them and are in the middle of talking to them. The only thing that happens is your friend starts wondering why you're pressing random numbers. IOW the browser will not do anything with headers sent after content has already started being sent. So for example, if you try and set a cookie after outputting content, it's not going to get set. So php outputs a warning to inform you of this.

 

So, how do you fix it? There are 2 ways; the first and preferred method, you can reorder your script so that you send the vital information (cookies, header redirects, etc.) before you send any content. The second would be to use output buffering. You can also read more about this in one of older, yet still relevant, resource topic.

Link to comment
Share on other sites

What is the point of MD5 / SHA1 / SHA256 / etc.? 

 

You should always, always, be hashing your users passwords. Note the word hashing and not encrypting (difference: hashing is one way and cannot be reversed.) These functions will hash a string with varying levels of security. The more processing power it takes (SHA512 will take more than MD5), the more secure it is likely to be.

 

It should be noted that MD5 really shouldn't be used for password hashing, and instead you should be using the crypt function with a more secure algorthym (like Blowfish). 

Link to comment
Share on other sites

  • 3 months later...

mysql* expects parameter 1 to be resource, boolean given

This means your query failed, for some reason or another. Remove any error suppressing (@), make sure you have error displaying enabled, and output mysqli_error to see specific information about your error!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • 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.