RE: [PHP] Assigning a value from another value
| From: | Don Read | Date: | Sun, 13 Apr 2003 19:39:46 +0000 |
| Subject: | RE: [PHP] Assigning a value from another value | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-143687@lists.php.net to get a copy of this message | ||
On 13-Apr-2003 Hunter, Jess wrote:
> I hope I can present this properly in simple terms.
>
> I have a form that when submitted is actually creating a new record in
> one
> table and updating a record in another table.
>
> In one table the field is a number while in the other it is a text.
>
> So if a person selects "yes" on the form, it will input yes, into one
> field,
> while it will add a "1" in the other.
>
> so in a nutshell:
>
> If textlabel='yes' then insert a '1' into fieldname, else insert
> '0'
>
$qry="INSERT INTO tbl ... ('$textlabel' = 'yes') ...";
-- or --
$qry=sprintf("INSERT INTO tbl ... %d ...",
... ($textlabel == 'yes' ? 1 : 0) ...);
Regards,
--
Don Read dread@texas.net
-- It's always darkest before the dawn. So if you are going to
steal the neighbor's newspaper, that's the time to do it.