Re: naming conventions
| From: | Paul Burney | Date: | Sun, 30 Mar 2003 15:19:17 +0000 |
| Subject: | Re: naming conventions | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-26719@lists.php.net to get a copy of this message | ||
on 3/30/03 9:52 AM, Charles Kline at ckline@rightcode.net appended the
following bits to my mbox:
> i was just wondering if there are any naming conventions when creating
> database connections. most of my books use
>
> $sql = "SQL STRING";
>
> and
>
> $sth = $db->query() or $result = $db->query()
>
> I have no idea what sth stands for in this case, but was curious how
> others name stuff.
I usually just use $query or $q for "query," $res or $r for "result," $row
or $s for the returned array, and $dbh for the database connection. I got
the latter from the standard Perl database connection, "dbh -> Data Base
Handle."
If I recall correctly, the $sth also comes from the standard perl examples.
The standard PHP example, from http://www.php.net/manual/en/ref.mysql.php ,
uses $link for the connection, $query for the query, and $line for the
returned record array.
A lot of database classes use $db as the new object.
Hope that helps.
Sincerely,
Paul Burney
<http://paulburney.com/>
<?php
while ($self != "asleep") {
$sheep_count++;
}
?>