Daxo Question MySQL

I have created a database using 000webhost’s database manager. Now i want to insert data into the base but I am unable to do that. I have checked the username and password over and over again but getting the same error every time. I have read other posts on this forum but nothing is working.

1 Like

Select your database not information one.

1 Like

this is the code i am using to insert data.

$sql = "INSERT INTO personalData (name, email, age)
	VALUES ($name, $email, $age)";
	if (mysqli_query($conn, $sql)) {
		echo "New record created";
	}
	else {
		echo "error: " . $sql . "<br>" . mysqli_error($conn);

this is my code for connecting to db

 $servername = "localhost";
 $username = "id10868592_root";
 $password = "******";
 $conn = mysqli_connect($servername, $username, $password);

kindly point out any possible error(s) you see in this code

1 Like

PDO would be recommended.

If you are still to use mysqli you need to define hostname, username, database name and password.

1 Like