Re: PHP database syntax/construct: can we make it better?
| From: | Monte Ohrt | Date: | Tue, 11 Jul 2000 21:25:38 +0000 |
| Subject: | Re: PHP database syntax/construct: can we make it better? | ||
| References: | 1 | Groups: | php.dev php.general |
| Request: | Send a blank email to php-dev+get-24226@lists.php.net to get a copy of this message | ||
Hi Rasmus,
I understand that the syntax given in the example is non-standards
compliant, I wouldn't suggest using that syntax in PHP itself. I can
make an SQL() function which performs the functionality in the example,
but its not too extensible beyond displaying the data row by row. I've
tried making my own classes & functions for this, but there isn't a way
to encapsulate functionality like so:
sql_start();
// do something here for each iteration
sql_end();
Just looking for other people's thoughts, or what they've done.
Thanks
Monte
rasmus@lerdorf.on.ca wrote:
>
> You are getting into templating again. Just create an SQL() function.
> I don't see why:
>
> <HOST = "my_host">
> <USER = "my_name">
> <PASS = "my_pass">
> <DB = "my_db">
>
> <SQL "select first,last,addr from my_table">
> $first, $last, $addr<br>
> </SQL>
>
> is any cleaner than:
>
> <?
> $HOST = "my_host";
> $USER = "my_name";
> $PASS = "my_pass";
> $DB = "my_db";
>
> SQL("select first,last,addr from my_table",
> '$first, $last, $addr<br>');
> ?>
>
> This is trivial to implement in user-space. And it is even
> DTD-friendly. Your <SQL> <HOST> stuff is an absolute nightmare from any
> sort of standards perspective.
>
> -Rasmus
>