I've been trying to spot the error in my database connection , I read several answers suggesting to make sure of the password grant full access ... I checked everything the problem is still appearing ...
My question is ... I understand mysqli is in this case better (from what I read) so ... if I replace mt $dbcon with
$dbcon = mysqli_connect("$host","$username","$password","$db_name") ;
will that fix the problem and if it does, how do I get rid of the never ending mysqli_error expects exactly 1 parameter, 0 given ... error
My php is
<?php
$host="****" ;
$username="****" ;
$password="****" ;
$db_name="****" ;
$tbl_name="courses" ;
$dbcon = mysql_connect("$host","$username","$password","$db_name") ;
if (!$dbcon) {
die('error connecting to database'); }
echo 'Courses successfully registerd , ' ;
// escape variables for security
$studentid = ( $_GET['studentid']);
$fname = $_POST["name"]; //echo $studentid;
$query=mysql_query("select * from courses where studentid='".$studentid."' ") or die(mysql_error());
$duplicate=mysql_num_rows($query);
if($duplicate==0)
{
$query1=mysql_query("insert into user values('".$studentid."')") or die(mysql_error());
}
else
{
echo'The ID you entered '.$studentid.' already registered, please wait 24 hours until you can register again';
}
// Get Cources
$name = $_GET['ckb'];
if(isset($_GET['ckb']))
{
foreach ($name as $courcess){
$cc=$cc. $courcess.',';
}
}
$sql="INSERT INTO courses (studentid, ckb, name)
VALUES ('$studentid', '$cc', $fname)";
if (!mysql_query($dbcon,$sql)) {
die('Error: ' . mysqli_error($dbcon));
}
echo " Thank you for using IME Virtual Registeration ";
mysql_close($dbcon);
?>