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
Sounds like your PHP configuration is not setup for mySQL. Try using the phpinfo()
function to see if it is.
精彩评论