Can I mix MySQL APIs in PHP? -
i have searched net , far have seen can use mysql_
, mysqli_
meaning:
<?php $con=mysqli_connect("localhost", "root" ,"" ,"mysql"); if( mysqli_connect_errno( $con ) ) { echo "failed connect"; }else{ echo "connected"; } mysql_close($con); echo "done"; ?>
or
<?php $con=mysql_connect("localhost", "root" ,"" ,"mysql"); if( mysqli_connect_errno( $con ) ) { echo "failed connect"; }else{ echo "connected"; } mysqli_close($con); echo "done"; ?>
are valid when use code is:
connected warning: mysql_close() expects parameter 1 resource, object given in d:\************.php on line 9 done
for first , same except mysqli_close()
. second one.
what problem? can't use mysql_
, mysqli
together? or normal? way can check if connections valid @ all? (the if(mysq...)
)
no, can't use mysql
, mysqli
together. separate apis , resources create incompatible 1 another.
there mysqli_close
, though.
Comments
Post a Comment