RE: [PHP-DB] localhost versus remote
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
Re: [PHP-DB] localhost versus remote
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=textyour search returned .$total. matches/span; print table border=1\n; print trtd class=greyIcao/tdtd class=greyName (Location)/tdtd class=greyCountry/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 [EMAIL PROTECTED] wrote in message 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
Re: [PHP-DB] localhost versus remote
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().brSQL: $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=textyour search returned .$total. matches/span; print table border=1\n; print trtd class=greyIcao/tdtd class=greyName (Location)/tdtd class=greyCountry/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 [EMAIL PROTECTED] wrote in message 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 BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] localhost versus remote
$ton is my AND/OR field. I'll change my error code and post it, thanx, Jacco -- http://seabird.jmtech.ca Attitude is Everything! But Remember, Attitudes are Contagious! Is Yours worth Catching Peter Beckman [EMAIL PROTECTED] wrote in message news:20021027151406.T64513-10;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().brSQL: $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=textyour search returned .$total. matches/span; print table border=1\n; print trtd class=greyIcao/tdtd class=greyName (Location)/tdtd class=greyCountry/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 [EMAIL PROTECTED] wrote in message 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 BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ -- - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] localhost versus remote
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 [EMAIL PROTECTED] wrote in message news:20021027151406.T64513-10;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().brSQL: $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=textyour search returned .$total. matches/span; print table border=1\n; print trtd class=greyIcao/tdtd class=greyName (Location)/tdtd class=greyCountry/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 [EMAIL PROTECTED] wrote in message 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 BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ -- - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] localhost versus remote
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 You need some ANDs between each of your field LIKE '%%' clauses. WHERE field1 LIKE '%%' and field2 LIKE '%%' ... ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] localhost versus remote
It seems to me you have no idea what you are doing. You really need to learn how to troubleshoot your code, as this is a very simple problem to fix. It's not your code. The variables you put in your SQL are empty. Your code: $query = SELECT * FROM $table WHERE Field1 LIKE '%$icao%' $ton Field2 LIKE '%$name%' $ton Field3 LIKE '%$country%' ORDER BY $sort; Problem: $ton should equal AND or OR but it doesn't equal anything. In fact, all of your variables are either empty or not set. You are trying to get: Select * from table where field1 like '%something%' AND field2 like '%something%' AND field3 like '%something%' order by field1 But since $ton is empty you are executing this: select * from airline_a where field1 like '%%' field2 like '%%' field3 like '%%' order by Which is COMPLETELY INVALID. Notice no AND statements between fields? I won't publicly flog you, but please don't respond. I believe this list is for help with more advanced issues, not how to properly write an SQL command and troubleshoot your code for you. Peter On Sun, 27 Oct 2002, Seabird wrote: 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 [EMAIL PROTECTED] wrote in message news:20021027151406.T64513-10;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().brSQL: $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=textyour search returned .$total. matches/span; print table border=1\n; print trtd class=greyIcao/tdtd class=greyName (Location)/tdtd class=greyCountry/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 [EMAIL PROTECTED] wrote in message 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 BeckmanSystems
Re: [PHP-DB] localhost versus remote
Hi Peter I understand your frustration, but how come that it works fine on my localhost, prosessing the exact same code?? I thought it worked because it works fine locally What is the differense in my code posted locally and remote? Jacco -- http://seabird.jmtech.ca Attitude is Everything! But Remember, Attitudes are Contagious! Is Yours worth Catching Peter Beckman [EMAIL PROTECTED] wrote in message news:20021027172628.I64513-10;thermonuclear.org... It seems to me you have no idea what you are doing. You really need to learn how to troubleshoot your code, as this is a very simple problem to fix. It's not your code. The variables you put in your SQL are empty. Your code: $query = SELECT * FROM $table WHERE Field1 LIKE '%$icao%' $ton Field2 LIKE '%$name%' $ton Field3 LIKE '%$country%' ORDER BY $sort; Problem: $ton should equal AND or OR but it doesn't equal anything. In fact, all of your variables are either empty or not set. You are trying to get: Select * from table where field1 like '%something%' AND field2 like '%something%' AND field3 like '%something%' order by field1 But since $ton is empty you are executing this: select * from airline_a where field1 like '%%' field2 like '%%' field3 like '%%' order by Which is COMPLETELY INVALID. Notice no AND statements between fields? I won't publicly flog you, but please don't respond. I believe this list is for help with more advanced issues, not how to properly write an SQL command and troubleshoot your code for you. Peter On Sun, 27 Oct 2002, Seabird wrote: 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 [EMAIL PROTECTED] wrote in message news:20021027151406.T64513-10;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().brSQL: $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=textyour search returned .$total. matches/span; print table border=1\n; print trtd class=greyIcao/tdtd class=greyName (Location)/tdtd class=greyCountry/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 [EMAIL PROTECTED] wrote in message 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
Re: [PHP-DB] localhost versus remote
I also provide my searchform here. The problem I have is that everything works when run on my localhost (which is my testing location before upload. I have the exact same code local and remote. My searchform should pass the code. here it comes: form method=GET action=aviation/result.php target=frameData table tr td width=122/td td /td /tr tr td class=textIcao code:/td td input name=icao type=text class=search size=3 maxlength=3 /td /tr tr td class=text Airline name:/td td input type=text name=name class=search br /td /tr tr td class=text Country:/td td select name=country class=search ?PHP $query = SELECT DISTINCT(Field3) FROM $table ORDER BY Field3; $result = mysql_query($query) or die(Error in query); while($row = mysql_fetch_assoc($result)) { print option.$row['Field3']./option\n; } ? /select /td /tr tr td class=text Search Criteria:/td td select name=ton option value=ANDAND/option option value=OROR/option /select /td /tr tr tdspan class=textSort by:/span /td td select name=sort option value=Field1Designator/option option value=Field2Name/option option value=Field3Country/option /select /td /tr tr bgcolor=#FF td/td td input type=submit value=Search these criteria /td /tr tr bgcolor=#CC td colspan=2 class=grey div align=center class=signature***no wildcards permitted***/div/td /tr /table /form Thanx, and excuse my newbie ignorance, Jacco -- http://seabird.jmtech.ca Attitude is Everything! But Remember, Attitudes are Contagious! Is Yours worth Catching John W. Holmes [EMAIL PROTECTED] wrote in message news:002601c27e08$680a2a50$7c02a8c0;coconut... 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 You need some ANDs between each of your field LIKE '%%' clauses. WHERE field1 LIKE '%%' and field2 LIKE '%%' ... ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] localhost versus remote
Please stop responding to the list. Your problems are far to simple to bother everyone on the list. I have no idea what you mean when you say locally or remote. Basically your problem is that your script does not see any of the variables. They are empty or not set. They are not getting passed from the form. Who knows. php.ini configured differently locally than remotely. I assume that Server1 is local and server2 is remote. The problem is that server2 probably hasn't got register_globals turned on. Do this: Change all your variables that you don't define in your script to this: $GLOBALS[icao] $GLOBALS[name] $GLOBALS[country] $GLOBALS[sort] etc. Also, to see if they even exist, use this: echo pre; print_r($_GET); // or use print_r($_POST) if you are using a POST instead of a GET method for your form echo /pre; This prints out all the variables stored. I would also see if the variables are empty (which they are from what you show). Put this line in your script: if (empty($ton)) die(variable ton is empty ($ton). Global: ({$GLOBALS[ton]}) POST ({$_POST[ton]}) GET ({$_GET[ton]})); If it dies there, it will print out the Global, Post and Get variables of ton to see if they exist there. If they do, then you know you have to change the variables in your script to those variables in order to get this to work. Do you know what version of PHP you are using locally and remotely? If remotely is not above 4.0.0, then there is different values for _POST and _GET. Peter On Sun, 27 Oct 2002, Seabird wrote: Hi Peter I understand your frustration, but how come that it works fine on my localhost, prosessing the exact same code?? I thought it worked because it works fine locally What is the differense in my code posted locally and remote? Jacco -- http://seabird.jmtech.ca Attitude is Everything! But Remember, Attitudes are Contagious! Is Yours worth Catching Peter Beckman [EMAIL PROTECTED] wrote in message news:20021027172628.I64513-10;thermonuclear.org... It seems to me you have no idea what you are doing. You really need to learn how to troubleshoot your code, as this is a very simple problem to fix. It's not your code. The variables you put in your SQL are empty. Your code: $query = SELECT * FROM $table WHERE Field1 LIKE '%$icao%' $ton Field2 LIKE '%$name%' $ton Field3 LIKE '%$country%' ORDER BY $sort; Problem: $ton should equal AND or OR but it doesn't equal anything. In fact, all of your variables are either empty or not set. You are trying to get: Select * from table where field1 like '%something%' AND field2 like '%something%' AND field3 like '%something%' order by field1 But since $ton is empty you are executing this: select * from airline_a where field1 like '%%' field2 like '%%' field3 like '%%' order by Which is COMPLETELY INVALID. Notice no AND statements between fields? I won't publicly flog you, but please don't respond. I believe this list is for help with more advanced issues, not how to properly write an SQL command and troubleshoot your code for you. Peter On Sun, 27 Oct 2002, Seabird wrote: 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 [EMAIL PROTECTED] wrote in message news:20021027151406.T64513-10;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().brSQL: $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
Re: [PHP-DB] localhost versus remote
First off, use quotes. If you are going to be a good coder, always use quotes in your HTML and your PHP. form method=GET action=aviation/result.php target=frameData In PHP: $table=aviation_a; // NOT $table=aviation_a; Sure, they both work, but they can cause problems in the future, and it is considered BAD CODING. USE QUOTES. Fix all your input tags with quotes. The problem is that PHP on the remote end probably doesn't have register_globals set. Change your code according the email I just sent. Peter On Sun, 27 Oct 2002, Seabird wrote: I also provide my searchform here. The problem I have is that everything works when run on my localhost (which is my testing location before upload. I have the exact same code local and remote. My searchform should pass the code. here it comes: form method=GET action=aviation/result.php target=frameData table tr td width=122/td td /td /tr tr td class=textIcao code:/td td input name=icao type=text class=search size=3 maxlength=3 /td /tr tr td class=text Airline name:/td td input type=text name=name class=search br /td /tr tr td class=text Country:/td td select name=country class=search ?PHP $query = SELECT DISTINCT(Field3) FROM $table ORDER BY Field3; $result = mysql_query($query) or die(Error in query); while($row = mysql_fetch_assoc($result)) { print option.$row['Field3']./option\n; } ? /select /td /tr tr td class=text Search Criteria:/td td select name=ton option value=ANDAND/option option value=OROR/option /select /td /tr tr tdspan class=textSort by:/span /td td select name=sort option value=Field1Designator/option option value=Field2Name/option option value=Field3Country/option /select /td /tr tr bgcolor=#FF td/td td input type=submit value=Search these criteria /td /tr tr bgcolor=#CC td colspan=2 class=grey div align=center class=signature***no wildcards permitted***/div/td /tr /table /form Thanx, and excuse my newbie ignorance, Jacco -- http://seabird.jmtech.ca Attitude is Everything! But Remember, Attitudes are Contagious! Is Yours worth Catching John W. Holmes [EMAIL PROTECTED] wrote in message news:002601c27e08$680a2a50$7c02a8c0;coconut... 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 You need some ANDs between each of your field LIKE '%%' clauses. WHERE field1 LIKE '%%' and field2 LIKE '%%' ... ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php