Menu:

View Harold Carey's profile on LinkedIn

This weeks Quotes:

If you're going to create, create a lot. Creativity is not like playing the slot machines, where failure to win means you go home broke. With creativity, if you don't win, you're usually no worse off than if you hadn't played
Scott Adams

Invest yourself in everything you do. There is fun in being serious.
Wynton Marsalis


Hello... I'm Harold Carey Jr. I have helped numerous Internet-only and bricks-and-mortar businesses to succeed in their offices and online for over 20 years, as well as helping larger businesses to effectively use the web to reduce costs and save both time and money.

 

PHP Tutor Date and Time

07/23/08
Wed, July 23rd
Wednesday, July 23rd 2008
10:44 PM
Wed, 23 Jul 2008 22:44:49 -0400
10:44:49 PM Wed, July 23rd 2008

 

PHP MySQL Tutor

Connecting to a MySQL Database and getting data.

Connected successfully

10:44:49 PM Wed, July 23rd 2008
Id First Name Last Name Phone
3 Carmine Dioxide 555-1234
4 Luke Warm 555-6584
5 Rusty Steele 555-6852
6 Wilma Butfit 555-5842
7 Art Majors 555-9854
8 Philip Harmonic 555-5681
9 Bjorn Liar 555-6582
10 Hope Anna Prayer 555-6584
11 Lauren Order 555-3584
12 Bill Shredder 555-9874
13 Neil Down 555-5874

The php Code

<?php
$dbhost = "localhost";
$dbuser = "username";
$dbpass = "password";
$dbname = "hccarey_test";
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn )
{
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully <br><br>';

mysql_select_db($dbname);
$query = "SELECT * FROM members";
$result = mysql_query($query);
?>
<table border="1">
<tr>
<td><strong>Id</strong></td>
<td><strong>First Name</strong></td>
<td><strong>Last Name</strong></td>
<td><strong>Phone</strong></td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row ['id']; ?></td>
<td><?php echo $row ['firstname']; ?></td>
<td><?php echo $row ['lastname']; ?></td>
<td><?php echo $row ['phone']; ?></td>
</tr>
<?php } while($row = mysql_fetch_array($result, MYSQL_ASSOC)); ?>
</table>

<p>
<?php mysql_close($conn);?>


Date and time
<?php
$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 A",$b) . "<br>";
print date("r",$b) . "<br>";
print date("g:i:s A D, F jS Y",$b) . "<br>";
?>

Wednesday 23rd of July 2008 10:44:49 PM

PHP include file
<?php include("menu1.php"); ?>