error

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

TEST DATABASE

[php]<?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);

?>

[/php]

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

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

[php]

<?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); ?> [/php]

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

Did it not fix the problem ?

[php]
$result =($dbc, $query) or die (‘Error querrying your database’);myqli_close
[/php]]

[php]
$query = mysqli_query($dbc, $query) or die ($dbc, mysqli_error());
mysqli_close;
[/php]

[php]$query = “INSERT INTO mydata (first_name, last_name, address, city, zip, phone_number)VALUES (‘Bob’, ‘Marshall’, ‘123 Road’, ‘Hope BC’, ‘v0x 2l3’, ‘888 2345’)”;[/php]

do you write your name
ram
can
or do you write it ramcan the query is all in one not split in the sections

You need to write the function names to the function you perform and also spell them correctly

Sponsor our Newsletter | Privacy Policy | Terms of Service