[thelist] problem connecting to mySQL server

Burhan Khalid burhankh at hotmail.com
Sun Dec 2 21:04:05 CST 2001


Hey Dave :

  I'm going to use a sample table(mytable) with the following fields :
  name, email, for this example.

  Here is some sample code to connect to m.e.o :

   $mysql_host="localhost";
   $mysql_user="username";
   $mysql_pwd="password";
   $mysql_db="username";
   $connectID = mysql_connect($mysql_host,$mysql_user,$mysql_pwd);
   mysql_select_db($mysql_db);

  From here, you can start querying your database :

   $strQuery = "SELECT * FROM mytable LIMIT 1";
   $intQID = mysql_db_query($mysql_db, $strQuery);

  Here is an example to retrieve your data :

   $results = mysql_fetch_assoc($intQID);
   $myname  = $results["name"];
   $email   = $results["email"];


Hope this helps.
Burhan Khalid
members.evolt.org/burhankhalid


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp





More information about the thelist mailing list