php - Simple MySQL query won't work -
i'm trying run simple php script browser won't work. seems connects database can't complete mysql query. anyway query works fine phpmyadmin. seems problem?
<?php // db $db_hostname = "localhost"; $db_username = "********"; $db_password = "********"; $db_database = "vladbl0m_eshop"; // create connection $con=mysqli_connect($db_hostname, $db_username, $db_password, $db_database); // check connection if (mysqli_connect_errno($con)) { echo "failed connect mysql:" . mysqli_connect_error(); } else echo "connected " . $db_database; // mysql query // execute query. $result = $link->query("insert oc_test set text ='12345'") or die("error in consult.." . mysqli_error($link)); ?>
there no $link
defined anywhere... use $con
instead of that.
replace $link
$con
, see doing wrong , since mapped connection wrongly , not able see proper errors.
Comments
Post a Comment