Re: Help...
| From: | Tim Hulen | Date: | Fri, 02 Jun 2000 19:30:41 +0000 |
| Subject: | Re: Help... | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-182@lists.php.net to get a copy of this message | ||
Thanks for the thoughts. $foo is coming from an input
form, were the user can input the depth (20-130).
I was using this example for Dive Location (Hawaii,
Honduras) and it would query the database
appropriately.
I'm using Access 2000 through an ODBC connection so
I'm using the appropriate odbc functions. I thought
by removing the quotes PHP would consider it an
integer value. Does it matter how the input form
handles it?
?>
<form>
<form method=post action='qrydb.php3'>
<input type='text' name='foo'>
<input type='submit' name='submit' value='Search'>
</form>
<?
Thanks for the help and info,
Tim
--- Carroll Barrett <cbarrett@inalt.com> wrote:
> Tim,
>
> A couple of thoughts:
>
> 1) Your error message says 'DiveDepth =', but your
> SQL statement says
> 'DiveDepth >='.
> Does your database support the '>=' operator?
>
> 2) Is $foo empty?
>
> Carroll Barrett
>
> -----Original Message-----
> From: Tim Hulen <thulen@yahoo.com>
> To: php-db@lists.php.net <php-db@lists.php.net>
> Date: Thursday, June 01, 2000 7:39 PM
> Subject: Re: [PHP-DB] Help...
>
>
> >That is what I thought, but I get this error>?
> >
> >Warning: SQL error: [Microsoft][ODBC Microsoft
> Access
> >Driver] Syntax error (missing operator) in query
> >expression 'DiveDepth ='., SQL state 37000 in
> >SQLExecDirect in
> >C:\WEBSHARE\WWWROOT\php\divedepthq.php on line 26
> >
> >
> >--- Matt McClanahan <cardinal@dodds.net> wrote:
> >> On Thu, 1 Jun 2000, Tim Hulen wrote:
> >>
> >> > I'm new to PHP and trying various test to
> >> demonstrate
> >> > to other the power of PHP. I also need to find
> a
> >> book
> >> > that has some good documentation for reference
> >> > especially when dealing with ODBC databases.
> >> >
> >> > I this example how do I pass foo to my query as
> an
> >> > integer instead of a string, do I can use the
> <,>
> >> as
> >> > part of the where statement.
> >> >
> >> > <?php
> >> > $db = ODBC_Connect("dive", "", "");
> >> > $res = ODBC_Exec($db, "SELECT * FROM
> >> tblDiveData
> >> > WHERE DiveDepth >= '$foo'");
> >>
> >> I think if you just take the quotes off of $foo,
> >> then SQL will consider it
> >> an integer.
> >>
> >> E.g, $res = ODBC_Exec($db, "SELECT * FROM
> >> tblDiveData WHWERE DiveDepth >=
> >> $foo");
> >>
> >> Matt
> >>
> >
> >
> >=====
> >"Hokey religions and ancient weapons can never
> compare to a
> > good blaster at your side, Kid."
> >
> >
> > May all your bubbles be external.
> >
> >__________________________________________________
> >Do You Yahoo!?
> >Send instant messages & get email alerts with
> Yahoo! Messenger.
> >http://im.yahoo.com/
> >
> >--
> >PHP Database Mailing List (http://www.php.net/)
> >To unsubscribe, e-mail:
> php-db-unsubscribe@lists.php.net
> >For additional commands, e-mail:
> php-db-help@lists.php.net
> >To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
> >
>
=====
"Hokey religions and ancient weapons can never compare to a
good blaster at your side, Kid."
May all your bubbles be external.
__________________________________________________
Do You Yahoo!?
Yahoo! Photos -- now, 100 FREE prints!
http://photos.yahoo.com