Re: Creating a varable with a name held in a string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ben Edwards (lists) wrote:
> I have the following code;_
>
> 	$sql = "select * from  text where id    = '$id' ";
>
> 	$row = fetch_row_row( $sql, $db );

You may also wish to consider:
list($img_loc, $text_type, $seq, $rec_type, $section, $code, $repeat,
$description, $text) = fetch_row_row($sql, $db);

This allows you to see more of the code's algorithm (if/else/while)
on-screen.

A good editor should allow you to not "wrap" this line and clutter up your
screen.  Or just buy a wider monitor :-)

This is a Religious Issue of Programming :-)

PS Using select * is also dangerous as you never know when somebody will
decide to add a new column in the database somewhere -- possibly one with
a *TON* of data that you don't need.  Better to name each field you want.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux