Sam
Sam

Reputation: 43

Why won't my php script connect to mysql?

Hey guys, I'm trying to make a full-text search bar and already my script wont work... My php script is this...

<?php

MySQL_connect("hostname", "username", "password"); 
MySQL_select_db("our_db"); 
$query = " 
    SELECT * FROM articles 
    WHERE MATCH(title, body) AGAINST ('PHP') 
"; 
$sql = MySQL_query($query); 
/* output results */ 
?>

And when I try to preview it, it comes up with:

Fatal error: Call to undefined function MySQL_connect() Error in line 12 (line 12: MySQL_connect("hostname", "username", "password"); ) Server Error in '/' Application. -------------------------------------------------------------------------------- HTTP Error 500 - Internal Server Error.

... if any of you guys can work it out it would be much appreciated... Thanks

Upvotes: 1

Views: 416

Answers (1)

steveo225
steveo225

Reputation: 11882

Sounds like your PHP configuration is not setup for mySQL. Try using the phpinfo() function to see if it is.

Upvotes: 2

Related Questions