Show time and date in php
Show time and date in p...
This code shows you how to pull in the date and time in php. print date("d-M-Y"); echo "<br>"; print time(); echo "<br>"; $b = time (); print date("m/d/y",$b) . "<br>"; print date("D, F jS",$b) . "<br>"; print date("l, F jS Y",$b) . "<br>"; print date("g:i...
Generate a random number in php
Generate a random numbe...
This will generate a random number between 0 and 4000 in php. srand(time()); $form_id = (rand()%4000); echo "$form_id"; SHARETHIS.addEntry({ title: "Generate a random number in php", url: "http://code.netexceed.com/php/random-function-in-php/" });
Taking data from a php form and inserting into mysql
Taking data from a php ...
This allow you to take form data and post it to a mysql database, poll it by the form id, and return the database identifier. <form id=”form1″ name=”form1″ method=”post” action=”form.php?pid=1″> <table width=”574″...
Update statement with PHP
Update statement with P...
This shows you how to update a sql query in php. <?php include 'dbloc.php'; $query = “UPDATE address SET name = ‘SQLTEST’ WHERE db_id = 2339″; mysql_query($query) or die(’Failed to update’); ?> SHARETHIS.addEntry({ title: "Update statement...
Read from database with PHP
Read from database with...
How to read a sql query from mysql using php. <?php include 'dbloc.php'; $query = "SELECT name, phone FROM address"; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo  "Name: {$row['name']} <br>” . “Phone: {$row['phone']}...
Insert into mysql database with PHP
Insert into mysql datab...
Insert data into mysql from php. <?php include 'dbloc.php'; $query = "INSERT INTO address (name, phone) VALUES ('Purell', '999')"; mysql_query($query)  or die('<b>Error: </b>' . mysql_error()); ?> SHARETHIS.addEntry({ title: "Insert into mysql database with PHP",...
Connect to a database, and select table with PHP
Connect to a database, ...
Here’s how to connect to a mysql database with php <?php $username = "username“; $password = “password“; $hostname = “database_hostname“;  $dbh = mysql_connect($hostname, $username, $password)  or die(”Unable to connect to MySQL”); $selected...
Sending HTML email with PHP
Sending HTML email with...
Below is how to send HTML emails from PHP. <?php $to = 'email_address‘; $subject = ‘subject‘; $random_hash = md5(date(’r', time())); $headers = “From: email_address\r\nReply-To: email_address“; $headers .= “\r\nContent-Type: multipart/alternative;...