Re: [SLUG] {SPAM?} Help with PHP,HTML and MySql

From: ethan zimmerman (lists@ethanzimmerman.com)
Date: Sat Aug 21 2004 - 19:26:16 EDT


this was done super quick but it should get you started....

<? php
$host=""; // This is probably 'localhost'
$username=""; // MySQL user name to log in as
$password=""; // MySQL user's password
$database=""; // Database you want to query
$query=""; // SQL query to run
                // (i.e. SELECT * FROM cards WHERE color='red')
$i=0; // Just a counter

mysql_connect($host,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();

while ($i < $num)
{
  $first=mysql_result($result,$i,"first");
  echo "<p>First Name: $first</p>";
  $last=mysql_result($result,$i,"last");
  echo "<p>Last Name: $last</p>";
  $date=mysql_result($result,$i,"date");
  echo "<p>Date of Occurrence: $date</p>";
}
?>

-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 15:06:37 EDT