Posted by:
JDelage
(---.hsd1.wa.comcast.net)
Hi,
I'm writing a user registration function in PHP PDO, and I have found that my query will only run fine if it is written like this:
<?php
$dbHost="localhost";
$dbName="project";
$dbUser="admin";
$dbPassword="abcd";
$dbh=new PDO("mysql:host=$dbHost;dbame=$dbName", $dbUser, $dbPassword);
$query=$dbh->prepare("INSERT INTO project.users (userName, userEmail) VALUES (?,?)"
;
.....
On the other hand, it will not run if I write:
...
$query=$dbh->prepare("INSERT INTO users (userName, userEmail) VALUES (?,?)"
;
...
Why is it that I need to precise "project.users"? Why isn't it enough to enter the table name, given that the db name itself is already in the PDO object?
Thank you!
JDelage