Re: Php/Mysql
| From: | David Robley | Date: | Sat, 13 Apr 2002 11:42:24 +0000 |
| Subject: | Re: Php/Mysql | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-92863@lists.php.net to get a copy of this message | ||
In article <INELIHOCKHFJNOPCOBKCMEBLDIAA.torkil.johnsen@stud.hibo.no>,
torkil.johnsen@stud.hibo.no says...
> Just a noob php/mysql question... (I suppose)
>
> When I try just putting php code in my insert queries, it goes like this:
>
> insert into mytable values('<?php echo "some string"; ?>')
>
> select * from mytable, returns:
> <?php echo "some string"; ?>Some string
>
> So the insert-query inserts both the code AND the string that the code
> echoes...
>
> Any help would be greatly appreciated!
You haven't given enough code to know excatly what your problem is.
However, for an educated guess, try something like:
$sql = "INSERT INTO mytable VALUES(" . $mystring . ")";
where of course $mystring is the correctly formatted set of values to
insert. Note that using this method you must have a value for each field
in the table, in the order in which the fields appear in the table.
--
David Robley
Temporary Kiwi!
Quod subigo farinam