RSSAll Entries Tagged With: "function"

PHP fopen() Function

The fopen() function will open any valid file or url. If the function fails it will return false along with an error generated. You can hide the error message by adding an “@” in front of the function name. Syntax fopen(filename, mode, include_path, context); Parameters filename (String | Required) This specifies the URL or file [...]

PHP Pagination with Mysql

So you have a Mysql table you want to pull data from, but you don’t want to flood the page with everything in the table right! So you need some pagination to seperate all the content in the table into easy to open pages. So let’s say this is your mysql query: $sql = mysql_query(“SELECT [...]

PHP Date() Function

The date() function converts a given timestamp into a readable date format. Here is the syntax for this function: Syntax date(format,timestamp); Parameters: format This parameter determines the format and how the date will read. For example: “Saturday, Nov. 16th 2009” would be the following code: $timestamp = time(); date(“l, M. jS Y”,$timestamp); timestamp This parameter [...]

PHP Favicon Generator Script

I decided to make a free easy to use favicon generating script that uses PHP. The script has a few features and requirements when uploading your image to be converted to a favicon. First the script checks for a few things such as file type, file size, if the directory is writable, and the specified [...]

PHP error_reporting() Function

The error_reporting() function determines what errors are reported from the current script. Here is the syntax for this function: Syntax error_reporting(report_level); The report_level parameter is optional and specifies what report level to report for the current script. This can be set by its numeric value or its constant name, however for future versions of PHP [...]

PHP Global Variables with Functions

Here we’re going to take a look at variables inside and outside of PHP functions. It is very easy to make one error with a function and have it return the wrong value. We’re going to make a simple function named “func1” which we’ll tweak a bit to show how variables are used inside and [...]

PHP Switch Function

The function switch() in PHP is used to execute different codes based on a variable’s value. This is used in place of the IF/ELSE IF statements. A default value is optional and, if specified, is used when no other option is matched. You must include a break; after each case or the following cases will [...]

PHP Upload file from URL

Let’s say you have a form on a page with the input for URL to a file so you can upload it to your server. You can do this using PHP functions. Here is an example of a form to upload: <form action="upload.php" method="post"> Enter URL: <input type="text" name="url" size="35" /> <input type="submit" value="Submit" name="submit" [...]

The tutorials and scripts found on bgallz.org are for training purposes only, use to your discretion.