Do a screen dump of your SQL Statement (echo $SQL) and stop the execution of
your page at that point. Remember you are generating a string, you want to
generate the right string. Checking the manual (always a good idea) it
states that strings can be enclosed in single or double quotes. They
recommend that you enclose them in single quotes:
http://www.php.net/manual/en/printwn/language.types.string.php
This would mean that you must escape the quotes.
regards
David Cameron
nOw.b2b
dcameron@i...
> -----Original Message-----
> From: Jefferis Peterson [mailto:jefferis@p...]
> Sent: Saturday, 21 September 2002 6:37 AM
> To: sql language
> Subject: [sql_language] Something dumb
>
>
> Trying to set a default query from form post with the
> variable text input
> 'keysearch' from form. This query however stalls on output
> unless I put in
> a non variable in for keysearch...
> What am I doing wrong?
>
> > <?php require_once('Connections/jodenonline.php'); ?>
> > <?php
> > $keysearch_searchreturns = "%yellow%";
> > if (isset(keysearch)) {
> > $keysearch_searchreturns = (get_magic_quotes_gpc()) ? keysearch :
> > addslashes(keysearch);
> > }
> > mysql_select_db($database_jodenonline, $jodenonline);
> > $query_searchreturns = sprintf("SELECT * FROM `Catalog` WHERE
> > `Catalog`.keywords LIKE '$keysearch_searchreturns' AND
> `Catalog`.img_status
> > "1"", $keysearch_searchreturns);
> > $searchreturns = mysql_query($query_searchreturns, $jodenonline) or
> > die(mysql_error());
> > $row_searchreturns = mysql_fetch_assoc($searchreturns);
> > $totalRows_searchreturns = mysql_num_rows($searchreturns);
> >
> > ?>
> > <html>
> > <head>
> > <title>Search Display</title>
> > <meta http-equiv="Content-Type" content="text/html;
> charset=iso-8859-1">
> > </head>
> > <body bgcolor="black" text="#ffffcc" link="#ffffcc">
> >
> > <div align="center"> </div>
> > <p>First Next <?php echo $HTTP_POST_VARS['keysearch']; ?> <?php echo
> > urlencode($HTTP_POST_VARS['period']); ?> <?php echo
> $HTTP_POST_VARS['class'];
> > ?> <?php echo $HTTP_POST_VARS['type']; ?> </p>
> > <p> </p>
> > </body>
> > </html>
> > <?php
> > mysql_free_result($searchreturns);
> > ?>
> ~~~~~~~~~~~~
> Jefferis Peterson, Pres.
> Web Design and Marketing
> http://www.PetersonSales.net
> Tel . xxx-xxx-xxxx
> ICQ 19112253
>
> http://www.Slippery-Rock.com - 7,000 hits per year
>
>
>