Cant seem to insert Data using php

I posted yesterday about having issues connecting to the database using php but thankfully someone helped me out then. but this time i am having issues inserting data into my database using php script.

This is the code i was doing to just test it out:


require_once 'connection.php';

$sql = "INSERT INTO test (f_name, l_name, phone_no) VALUES ('Jack', 'Harvey', '4551812626')";

if(mysqli_query($link, $sql)){

echo "Records inserted successfully. ";

} else{

echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);




But when i run this php script through my sub domain i get this error:

ERROR: Could not able to execute INSERT INTO test (f_name, l_name, phone_no) VALUES (‘Jack’, ‘Harvey’, ‘4551812626’).

Im not sure what is wrong exactly here as it should connect be able to insert the data.

This might be due to the wrong Mysql username, password and server host. WHat is your SQL server host?

Its okay. someone edited my code without even replying saying what he changed. but the edit did work for me.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.