Trying to understand use of ->
Posted: Sun Dec 04, 2005 12:27 am
OK, this will certainly be the newbie award-winner of the week.
I have done some PHP development, but for some reason never encountered the use of -> in PHP before. I am trying to figure out just what it does? As in:
$sql = 'INSERT INTO user (username, passwordHash) VALUES (?, SHA1(?))';
$result = $db->query($sql, array($_POST['username'], $_POST['password']));
What exactly does the $db->query part of that code do? I searched and searched, went all through PHP.net documentation, and found no official explanation of "->" anywhere, although it is used extensively in example code, both in the documentation and in people's examples. I worked around my ignorance by just rewriting the sql insert to not use this array setup, but it's driving me crazy not knowing what such a fundamental syntax element does.
Any help is greatly appreciated.
I have done some PHP development, but for some reason never encountered the use of -> in PHP before. I am trying to figure out just what it does? As in:
$sql = 'INSERT INTO user (username, passwordHash) VALUES (?, SHA1(?))';
$result = $db->query($sql, array($_POST['username'], $_POST['password']));
What exactly does the $db->query part of that code do? I searched and searched, went all through PHP.net documentation, and found no official explanation of "->" anywhere, although it is used extensively in example code, both in the documentation and in people's examples. I worked around my ignorance by just rewriting the sql insert to not use this array setup, but it's driving me crazy not knowing what such a fundamental syntax element does.
Any help is greatly appreciated.