Whilst working on my first MYSQL, i came accross this error, and even with a friend who is a pretty good coder and we couldn't work it out

<?php
$con=mysql_connect("mysql3.000webhost.com","a2778852_556875", "pendolino390");

//CREATE DATABASE
	mysql_create_db("personal_experience", $con);
			 
	//CREATE TABLE 
	$con=mysql_select_db('Personal_experiences',$con);
	
	if($con) {
	$sql="CREATE DATABASE personal_ex
		(
			Additioncode int NOT NULL AUTO_INCREMENT,
			PRIMARY KEY(Additioncode),
			Personalexperiences text,
			Sex tinyint,
			Age int,
			Sexuality tinyint,
		)";
		
		mysql_query($sql,$con);
		$sql="insert into personal_ex(Personalexperience,Sex,Age,Sexuality) values ('$post[Personalexperience]','$post[Sex],$post[Age]','$post[Sexuality]')";

//insert record	
mysql_query($sql,$con); 
        echo "Added to records";
        mysql_close($con);
?>

Can anyone here help me?

Missing single quotes on line 22.

Missing single quotes on line 22.

Changed it to single quotes then gave me an "T_VARIABLE" error

$sql="insert into personal_ex(Personalexperience,Sex,Age,Sexuality) values ('$post[Personalexperience]','$post[Sex],$post[Age]','$post[Sexuality]')";

What is the '$post[]' ? Is it the php array or the HTTP_POST_VAR ? The correct use of the HTTP_POST_VAR is '$_POST' or '$_REQUEST'.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.