PHP mysql_db_query being deprecated. Can't fix it
I'm getting th开发者_如何学JAVAe following error while connecting to my SQL database:
function mysql_query($query) {
$dbhost = "localhost";
$dbuser = "p39438_***";
$dbpass = "password";
$dbname = "p31417_***";
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname); }
Using mysql_query gives me this error:
Cannot redeclare mysql_query() in /home/p39438/domains/*/public_html/_/includes/functies.php on line 10
Try mysql_query()
not just query()
. Also, don't put POST variables directly into a SQL query. That's a very bad idea.
You haven't actually EXECUTED your query:
$sql = "....";
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_array($result);
The function is mysql_query
not query
. There's a theme with these mysql function names...
精彩评论