Hello,
I have started learning php and mysql recently, and I have run into problems. I received this code: *
Parse error: syntax error, unexpected 'average_user' (T_STRING)* and the problem is that I granted SELECT to average_user in the databse, but it is coming up with an error. What is with it? The code looked like this : <?php
$dsn= 'mysql :host=localhost; dbname=my_store";
$username='average_user';
$password='password';
try{ $db=new PDO ($dsn,$username,$password)} catch (PDOexception $e){$error_message=$e->get_message();
include (database_error.php);
exit();}?>
Anything stick out? Thanks
vivosmith
27
Newbie Poster
Recommended Answers
Jump to Post@vivosmith
Parse error: syntax error, unexpected 'average_user' (T_STRING)* and the problem is that I granted SELECT to average_user in the databse, but it is coming up with an error. What is with it?
<?php $dsn= 'mysql:host=localhost; dbname=my_store"; $username='average_user'; $password='password'; try{ $db=new PDO ($dsn,$username,$password)} catch (PDOexception …
Jump to PostLine 2 and 3 belong together:
$dsn = 'mysql:host=localhost;dbname=my_store';
All 6 Replies

LastMitch
pritaeas
2,179
¯\_(ツ)_/¯
Moderator
Featured Poster
vivosmith
27
Newbie Poster
pritaeas
2,179
¯\_(ツ)_/¯
Moderator
Featured Poster
vivosmith
27
Newbie Poster
vivosmith
27
Newbie Poster
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.