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

From: Date: Fri, 11 Feb 2005 17:12:08 +0000
Subject: Re: Creating a varable with a name held in a string
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-208538@lists.php.net to get a copy of this message
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

« previous php.general (#208538) next »