php - Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO -
php - Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO -
i new php , im trying connect database whith help of tube videos error
deprecated: mysql_connect(): mysql extension deprecated , removed in future: utilize mysqli or pdo instead in c:\wamp\www\db.php on line 7
please help ..i confused !!!
the problem stems wampserver's demo sql files include mysql_*
based functions code.
sidenote: should create note of or update demo files include test files containing mysqli_
and/or pdo code leave out confusion, since version of php comes 5.5.12, create sense.
i myself have installed wamp in 1 machines few weeks ago , faced same issue, yet remedied situation changing instances of mysql_
mysqli_
, setting db connection variable first parameter.
for illustration , taken http://php.net/manual/en/function.mysqli-connect.php
$result = mysqli_query($link, $query); // $link beingness connection variable
this demo sql code looks like:
<?php $link = mysql_connect('hostname','dbuser','dbpassword'); if (!$link) { die('could not connect mysql: ' . mysql_error()); } echo 'connection ok'; mysql_close($link); ?>
change next illustration , changing proper code own db:
<?php $link = mysqli_connect('hostname','dbuser','dbpassword','db_name'); if (!$link) { die('could not connect mysql: ' . mysqli_error($link)); } echo 'connection ok'; mysqli_close($link); ?>
for more info on mysqli_
, pdo, visit next pages:
additional links:
mysqli_*
prepared statements pdo prepared statements. which much improve , safer utilize when getting database work.
php mysql pdo mysqli
Comments
Post a Comment