Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MySQLi issues

Status
Not open for further replies.

stenk

Technical User
May 20, 2002
48
NZ
I seem to have a problem getting mysql 4.1.5 to work with php 5.0.3.

I have installed Apache 2.0.x on my Windows XP Home SP1 PC.
I have installed MySQL 4.1.5
Also I have installed PHP 5.0.3 as a Module and seems to work fine with Apache

<?php
phpinfo();
?>

I have created a DB called world and imported the .sql file into MySQL (From MySQL website if anyone wants the World DB to test)

this is the code I used to test......

PHP:
<?php 

/* Connect to a MySQL server */ 
$link = mysqli_connect( 
            'localhost',  /* The host to connect to */ 
            'user',       /* The user to connect as */ 
            'password',   /* The password to use */ 
            'world');     /* The default database to query */ 

if (!$link) { 
   printf("Can't connect to MySQL Server. Errorcode: %s\n", mysqli_connect_error()); 
   exit; 
} 

/* Send a query to the server */ 
if ($result = mysqli_query($link, 'SELECT Name, Population FROM City ORDER BY Population DESC LIMIT 5')) { 

    print("Very large cities are:\n"); 

    /* Fetch the results of the query */ 
    while( $row = mysqli_fetch_assoc($result) ){ 
        printf("%s (%s)\n", $row['Name'], $row['Population']); 
    } 

    /* Destroy the result set and free the memory used for it */ 
    mysqli_free_result($result); 
} 

/* Close the connection */ 
mysqli_close($link); 
?>

But comes up with a fatal error....

Fatal error: Class 'mysqli' not found in C:\.....

I have added the php_mysql.dll to Windows\System32 but I could not find a 'libmysqli.dll' only libmysql.dll'

I had an earlier version of php 5.0.2 that did include the libmysqli.dll.

I have no idea what I can do to get mysql to work with php5. It was I remeber so easy to set up.

Any help would be great.

Many thanks for you time.

Sten
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top