Re: localhost versus remote

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



My error came out like this:

MySQL Error: You have an error in your SQL syntax near 'Field2 LIKE '%%'
Field3 LIKE '%%' ORDER BY ' at line 2
SQL: SELECT * FROM airline_a WHERE Field1 LIKE '%%' Field2 LIKE '%%' Field3
LIKE '%%' ORDER BY

Why does it not do this at my localhost?? I have the % around my code so
that it searches correctly.... right? Or should I clean up my code??
Jacco


--
http://seabird.jmtech.ca

Attitude is Everything!
But Remember, Attitudes are Contagious!
Is Yours worth Catching????
"Peter Beckman" <beckman@purplecow.com> wrote in message
20021027151406.T64513-100000@thermonuclear.org">news:20021027151406.T64513-100000@thermonuclear.org...
> That's some nasty code....
>
> Two things:
>
> 1. What is $ton in your query?
>
> 2. Change your mysql_query row to this:
>
>   $result = mysql_query($query) or die("MySQL Error:
".mysql_error()."<br>SQL: $query");
>
>    So when your query dies, you'll know why.
>
> Peter
>
> On Sun, 27 Oct 2002, Seabird wrote:
>
> > sorry for my "furry" message before.
> >
> > I search a DB in multiple search fields and my result code looks like
this:
> >
> > <?PHP
> > $db=test;
> > $table=airline_a;
> >
> > if (! $link)
> >  die( "couldn't connect");
> > mysql_select_db($db)
> >  or die ("won't open test:".mysql_error() );
> >
> >
> > $db_res=mysql_list_dbs($link);
> > $num=mysql_num_rows($db_res);
> > for($x=0; $x<$num; $x++)
> >
> >
> > $db_res=mysql_list_tables("$db",$link);
> > $num=mysql_num_rows($db_res);
> > for($x=0; $x<$num; $x++)
> >
> >
> >
> > $count = mysql_query("SELECT * FROM $table");//selects all rows
> > $total = mysql_num_rows ($count);//counts the selected rows
> >
> > $query = "SELECT * FROM $table WHERE Field1 LIKE '%$icao%' $ton
> >     Field2 LIKE '%$name%' $ton
> >     Field3 LIKE '%$country%'
> >     ORDER BY $sort";
> > $result = mysql_query($query) or die("Error in
> > query");//////////////////////////so this is the error I
> > get/////////////////
> > $total = mysql_num_rows ($result);//counts the selected rows
> > print "<span class=text>your search returned ".$total." matches</span>";
> >
> > print "<table border=1>\n";
> > print "<tr><td class=grey>Icao</td><td class=grey>Name
(Location)</td><td
> > class=grey>Country</td></tr>";
> > while($row = mysql_fetch_assoc($result)){
> >  print "<tr>\n"
> >           ."<td class=white>" . $row['Field1'] . "</td>\n"
> >    ."<td class=white>" . $row['Field2'] . "</td>\n"
> >    ."<td class=white>" . $row['Field3'] . "&nbsp</td>\n"
> >    ;
> > }
> >
> > print "</tr></table>";
> > ?>
> >
> >
> > The problem I have is that my setup on my localhost and my remote are
> > identical (I think) and the files are the same. So where does it go
wrong.
> > All I get as error is 'Error in query' which doesn't tell me much.
Please
> > help me...
> >
> > Jacco
> > --
> > http://seabird.jmtech.ca
> >
> > Attitude is Everything!
> > But Remember, Attitudes are Contagious!
> > Is Yours worth Catching????
> > "John W. Holmes" <holmes072000@charter.net> wrote in message
> > 002801c27dc0$844bfb00$7c02a8c0@coconut">news:002801c27dc0$844bfb00$7c02a8c0@coconut...
> > > > Hi everyone,
> > > > I'm using a MySQL DB and a search form. Eveery thing works fine, but
> > > when
> > > > I
> > > > upload, it has a Error in query. I checked all the little details
but
> > > > can't
> > > > find out why? Any ideas are welcome.
> > > >
> > > > Jacco
> > >
> > > This one is an easy problem to fix. All you have to do is find the
error
> > > and correct what's causing the problem.
> > >
> > > Hope that helps.
> > >
> > > ---John Holmes...
> > >
> > > PS: If you found my answer worthless, it was about as helpful as your
> > > question. What error? What versions of PHP and MySQL? What's your
> > > code???
> > >
> > >
> >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
> --------------------------------------------------------------------------
-
> Peter Beckman            Systems Engineer, Fairfax Cable Access
Corporation
> beckman@purplecow.com
http://www.purplecow.com/
> --------------------------------------------------------------------------
-
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux