I tried converting mysql to mysqli below and am getting the following errors on the mysql. Do you know what the proper syntax would be for these mysqli classes?
I am very new to mysql.
Warning: mysqli_escape_string() expects exactly 2 parameters, 1 given on line 14
Warning: mysqli_query() expects at least 2 parameters, 1 given on line 15
Warning: mysqli_error() expects exactly 1 parameter, 0 given on line 17
<?php
ini_set('max_execution_time', 60000);
include_once('dbopen.php');
// mysqli_select_db($database, $connect);
$file_handle = fopen("csvs/County names.csv", "r");
$tbname = "deposits_counties";
$i = 0;
while (!feof($file_handle) ) {
$county = fgetcsv($file_handle, 1024);
if ($i != 0 && $county){
$sql="insert into ".$tbname." (county_no, county_name) values($county[0], '".mysqli_escape_string($county[1])."')";
$result=mysqli_query($sql);
if (!$result) {
echo mysqli_error();
echo "<br/>";
}else{
echo "County " . $county[0] . " inserted";
echo "<br/>";
}
}
$i++;
}
fclose($file_handle);
include('dbclose.php');
?>