Has anyone written routines for insert/update/delete for MySQL records?
I would prefer not to use Spry or other third-party methods. I'm comfortable with coding, so that's not an issue. Thanks!
I would prefer not to use Spry or other third-party methods. I'm comfortable with coding, so that's not an issue. Thanks!
I don't know what I'm doing wrong, but I cannot connect with my database by plugging my variables into the PDO connection script you gave me. I need to study up on the PDO or SQLi syntax, because I don't understand the -> and => commands. I can't even get the connection failure message to appear. I appreciate your help, but I have so far had no success.
=> is used to assign a value to an associative array key, like this:
$fruit =array("apple"=>"braeburn","pear"=>"bartlet");
-> is used in OO to taken an action on an object. That's my on-the-fly definition. On the left is the object name and on the right is what to do. For instance, you may be setting a property or running a method.
In the connection script, you don't even need to understand what's going on. You just need to set the variables in the first three lines . . .then, your queries must always refer to the connection object. Since I use $dbh as the connection object name, a query would be like this:
$sql=$dbh->prepare("SELECT * FROM fruit WHERE fruit_type=:fruit_type");
$sql->bindValue("fruit_type", "apples");
$sql->execute();
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.