PHP HTTP Functions


Related Posts:
  • Convert CSV to PHP Every once in a while, I have a static list of values that I don't want to put into a database, but that I do want to use in my PHP application. That static data can come from a variety of sources, but often it's in a s… Read More
  • MySQL Database Using PHP <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">  <title>Wines</title>  </head> <body> <pre> <?php  // (1) Open the… Read More
  • Using mysql_fetch_array fanc we accessed attributes in order using the foreach loop statement. In many cases, you'll also want to access the attributes in another way, and this is usually best achieved by using the attribute names themselves. It's muc… Read More
  • Php Mysql Image upload <?php // 1. Gem modtagne formulardata i variabler: $navn = $_POST['navn']; $alder = $_POST['alder']; $postnr = $_POST['postnr']; $mail = $_POST['mail']; $billede = $_FILES['profilbillede']; $password = $_PO… Read More
  • MySQL Data on the Web Before we leap forward, it’s worth taking a step back for a clear picture of our ultimategoal. We have two powerful tools at our disposal: the PHP scripting languageand the MySQL database engine. It’s important to understand… Read More
  • Configuring the Connection Mysql <?phptry{$pdo = new PDO('mysql:host=localhost;dbname=ijdb', 'ijdbuser','mypassword');}catch (PDOException $e){$output = 'Unable to connect to the database server.';include 'output.html.php';exit();} $pdo->setAttribute(… Read More
  • Using Cookie Authentication PHP Store authentication status in a cookie or as part of a session. When a user logs insuccessfully, put their username in a cookie. Also include a hash of the username and a secretword so a user can't just make up an authentic… Read More
  • Php Directory Functions chdir — Change directory chroot — Change the root directory closedir — Close directory handle dir — Return an instance of the Directory class getcwd — Gets the current working directory opendir — Open directory handle read… Read More
  • PHP Data Types PHP provides four primitive data types: integers, floating point numbers, strings, and booleans. In addition, there are two compound data types: arrays and objects.  Integers Integers are whole numbers. The range… Read More
  • PHP Functions A function is a named sequence of code statements that can optionally accept parameters and return a value. A function call is an expression that has a value; its value is the returned value from the function. PHP provid… Read More
  • Create Dynamic Database Access Objects Some simple PHP that makes for a surprisingly robust script <?php require_once( "DB.php" ); $dsn = 'mysql://root:password@localhost/books'; $db =& DB::Connect( $dsn, array() ); if (PEAR::isError($db)) { die($db->g… Read More
  • PHP Web-Related Variables PHP automatically creates variables for all the data it receives in an HTTP request. This can include GET data, POST data, cookie data, and environment variables. The variables are either in PHP's global symbol table or … Read More
  • Advanced SQL 15.1 Exploring with SHOW The SHOW command is useful for exploring the details of databases, tables, indexes, and MySQL. It's a handy tool when you're writing new queries, modifying database structure, creating repor… Read More
  • Showing the Browser and IP Address Here is a simple page that prints out the browser string and the IP address of the HTTP request. Create a file with the following content in your web directory, name it something like example.php3, and load it in your bro… Read More
  • File Manipulation 11.3. File Manipulation There may be times when you don't want to store information in a database and may want to work directly with a file instead. An example is a logfile that tracks when your application can't co… Read More