In datasource I use myodbc.dll in another language to connect to MySQL, I just don't know how in PHP. The username is ODBC. I currently have PHP running successfully with Xitami. I know MySQL is installed correctly because I'm using it with another programming language.
How do I get my PHP program to connect with MySQL?
You need to use the mysql_connect function to connect to the database
here is a sample Php script
$DBhost = "Your-MySQL-servers-IP-or-domainname";
$DBuser = "your user name";
$DBpass = "Your Password";
$DBName = "The Name of the Database";
$table = "Your Table";
mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable toconnect to database");
@mysql_select_db("$DBName") or die("Unable to select database $DBName"); $sqlquery = "SELECT * FROM $table'";
$result = mysql_query($sqlquery);
$number = mysql_numrows($result);
where the $result would have your records and the $number has the count of the number of rows returned...
Reply:Use the mysql_pconnect function. You can read about it on php.net website.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment