I'm working with PDO for the first time and have a couple of questions I haven't been able to phrase correctly on Google to return any good answers. Hoping someone here can help.
1. Some of my statments are really long - for example: $insertCustomer = $db->prepare(INSERT INTO CUSTOMERS (FirstName, MiddleName, LastName, Address, Address2, City, State, Zip, Phone, Email, DriversLicense, Birthday,Notes, EmergencyContact, EmergencyPhone, isCurrent, StartDate, PriceLevel, CanUseML, GetDiscount, CCW2, CCW)
- when I add the values this makes for a very long line. Is there away to do this multi-line for easier readability?
2. I'm putting my prepared statments in my config.php file, along with my database connection string - like this:
$database = "mydb";
$username = "myusername";
$password = "mypassword";
$db = new PDO("mysql:host=localhost;dbname=$database", $username, $password);
// CUSTOMER PREPARED STATMENT (all Prepared statments the rest of the file)
$insertCustomer = $db->prepare
Is this the correct way to use prepared statements in PDO?
Thanks for your help!!!