PHP Programming > Beginners - Learning PHP

error

(1/2) > >>

ramcan:
Hello all
Im new to php and flowing a tutorial on youtube...
here is my code

<html>
<head>
   <title> TEST DATABASE </title>
</head>


<body>


--- PHP Code: ---<?php

$dbc = mysqli_connect ('localhost', 'root', '', "sampledatebase")
or die ('Error connecting to your database!!');
echo "got you";

$query = " INSERT INTO mydata (first_name, last_name, address, city, zip, phone_number)";
"VALUES ('Bob', 'Marshall', '123 Road', 'Hope BC','v0x 2l3' '888 2345')";

$result =($dbc, $query)   LINE !8
or die ('Error querrying your database');
myquli_close ($dbc);


?>
</body>

</html> 
--- End code ---




this is my result


//Parse error: syntax error, unexpected ',' in c:wamp\www\test_database.php on line 18


I really cant see where it is

thanks in advance bob

Noodles:
You add the ending to the query to early the values is part of it as well


--- PHP Code: ---
<?php

$dbc = mysqli_connect ('localhost', 'root', '', "sampledatebase") or die ('Error connecting to your database!!');
echo "got you";
$query = " INSERT INTO mydata (first_name, last_name, address, city, zip, phone_number)
VALUES ('Bob', 'Marshall', '123 Road', 'Hope BC','v0x 2l3' '888 2345')";
$result =($dbc, $query) or die ('Error querrying your database');
myquli_close ($dbc);
?>

</body></html>

--- End code ---

ramcan:
I'm sorry but that answer did not help me at all. I don't see why the , should not be there.

Noodles:
Did it not fix the problem ?


--- PHP Code: ---
$result =($dbc, $query) or die ('Error querrying your database');myqli_close 

--- End code ---
]


--- PHP Code: ---
$query = mysqli_query($dbc, $query) or die ($dbc, mysqli_error());
mysqli_close; 

--- End code ---

Noodles:

--- PHP Code: ---$query = "INSERT INTO mydata (first_name, last_name, address, city, zip, phone_number)VALUES ('Bob', 'Marshall', '123 Road', 'Hope BC', 'v0x 2l3', '888 2345')";
--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version