开发者

Why won't my php script connect to mysql?

开发者 https://www.devze.com 2023-02-15 14:35 出处:网络
Hey guys, I\'m trying to make a full-text search bar and already my script wont work... My php script is this...

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消