RE: Error connecting to MySQL Database

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



the function call mysql_connect() returns

1. Resource (link identifier) if succesful
2. False if NOT successful

fix
--------------
if( $Connection != FALSE ){
		//I am connected to the data base...

---------------

--
Gerardo S. Rojas
mailto: grojas@strategicinc.com


-----Original Message-----
From: Yosvel Reyes [mailto:khronos@fastmail.fm]
Sent: Monday, October 27, 2003 9:31 AM
To: PHP Windows
Subject:  Error connecting to MySQL Database


Hi All:

I'm a PHP beginner and just I am trying to connect using PHP to a MySQL
Database with the following code

<?php 
  	$Connection = mysql_connect("server", "login", "pwd");
	
	if($Connection == TRUE){
		//I am connected to the data base...
		
		$id = mysql_query("select * from publication");
		
		if($id != FALSE){
			//now fetch the results...
			while(($result = mysql_fetch_row($id))){
				echo $result[0];
				echo " --- ";
				echo $result[1];
				echo " --- ";
				echo $result[2];
				echo "<br/>";	
			}
		}
		else{
			echo "Cant execute the SQL statement";
		} 
	}
	else
		echo "Cant connect to database";
  ?>

and when I try to execute this code got the following error:

Fatal error: Call to undefined function: mysql_connect() in C:\Program
Files\Apache Group\Apache2\htdocs\Yosvel\TMP4oqwenf8u5.php on line 27

I Assume that there must be an error on my PHP installation or I have to
include some other php file

Any suggestion??? 
Thanks in advance...



==========================================
Lic. Yosvel Reyes Fonfria 
khronos@fastmail.fm
tel: (053)42 205428

Who try and try again, triumph!!!
==========================================

-- 
http://www.fastmail.fm - A no graphics, no pop-ups email service

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux