Need Programming Assignment Help?

Get Help with Programming Assignment in Java, C/C++, Dot Net, PHP, Database and UML Diagrams

All posts in PHP Programming

MySQL Handler in PHP

MySQL Handler in PHP This class can save and retrieve PHP session data in MySQL. It registers its functions as PHPsession handle so the current PHP user session is saved. <?php class MySQLHandler { // Change these variables to your own database settings var $DATABASE = ‘mysql’; var $USERNAME = . . . Read more

Mysql Escape String in PHP

MySQL Escape String in PHP Program A MySQL connection is required before using MySql escape string() otherwise an error of level E WARNING is generated, and FALSE is returned. If link identifier isn’t defined, the last MySQL connection is used. <?php function mysql_escape_string($s) { $sl=strlen($s); for ($a=0;$a<$sl;$a++) { $c=substr($s,$a,1); switch(ord($c)) . . . Read more

MySQL Report generation in PHP

MySQL Report generation in PHP Programming MySQL Report generation is a PHP class that Generates customizable HTML reports with data from the result set of any MySQL SELECT query. <?php  define(‘FPDF_FONTPATH’,’yourdirectorypath/FPDF/font/’); require(‘yourdirectorypath/FPDF/fpdf.php’); class PDF extends FPDF { var $tablewidths; var $headerset; var $footerset; function _beginpage($orientation) { $this->page++; if(!$this->pages[$this->page]) // solved . . . Read more

Palindrome Checker in PHP

Palindrome Checker in PHP Palindrome Checker : PHP Palindrome check If String Is A Palindrome. This function, as the name suggests, willcheck to see if a given string is a palindrome. That is, it reads the same backwards, as it does forwards. <html> <head> <title>Palindrome Checker</title> </head> <body> <?php $str_reversed = strrev($str); . . . Read more

Bucket Sort in PHP

Bucket Sort in PHP A sample program that I wrote to sort a series of numbers using PHP using bucket sortalgorithm. <?php error_reporting(0); $a= $_POST[‘val_1’]; $b= $_POST[‘val_2’]; $c= $_POST[‘val_3’]; $d= $_POST[‘val_4’]; $e= $_POST[‘val_5’]; if(isset($_POST[‘clear’])) { $a=””; $b=””; $c=””; $d=””; $e=””; $display_original=””; $process_results=””; } ?> <html> <head> <title>Bucket in PHP</title> <style> . . . Read more

Bubble Sort in PHP

Bubble Sort in PHP Bubble Sort, it compare each pair of adjacent items and swapping them if they are in the wrong order. Then the list is repeated until no swaps are needed, which indicates that the list is sorted. This algorithm use array as a data structure so that . . . Read more

Merge Sort in PHP

Merge Sort in PHP Merge sort was invented by John Von Neumann, a big name in computer science history. It is a divide and conquer algorithm. It sorts arrays by dividing them recursively into halves (divide) and then sorting and merging them back together (conquer). <?php error_reporting(0); $a= $_POST[‘val_1’]; $b= . . . Read more

MySQL Dump to Database

MySQL Dump to Database The MySQL Dump command is used to create textfile “dumps” of databases managed by MySQL. <?php // open the .sql file $fp = @fopen(“mysql.sql”, “r”); $file = fread($fp, 80000); fclose($fp); $lines = explode(‘;’, $file); // split the .sql into sepearte queries $cnt = count($lines); // count array . . . Read more

MySQL Select Associative Array

MySQL Select Associative Array MySQL Select Associative Array- This will fetch a result row as a numeric and an Associative Array from MySQL result handle. <?php $conn = mysql_connect(“localhost”, “mysql_user”, “mysql_password”); if (!$conn) { echo “Unable to connect to DB: ” . mysql_error(); exit; } if (!mysql_select_db(“mydbname”)) { echo “Unable . . . Read more

Error Checking MySQL Code in PHP

Error Checking MySQL Code in PHP Error Checking MySQL Code – This simple PHP Programming code returns the text of the error message from previous MySQL operation. <?php mysql_connect(“localhost”, “mysql_user”, “mysql_password”); mysql_select_db(“nonexistentdb”); echo mysql_errno() . “: ” . mysql_error(). “\n”; mysql_select_db(“kossu”); mysql_query(“SELECT * FROM nonexistenttable”); echo mysql_errno() . “: ” . . . . Read more