Jump to content


Photo

query won't execute


  • Please log in to reply
4 replies to this topic

#1 cheryl

cheryl
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 10 April 2006 - 09:37 AM

$search_participant = "SELECT * FROM " .$clientCode. "m WHERE memName 
                              LIKE '%$namesearch%' ORDER BY memCode";

is this query won't execute. is there a problem with joining the .$clientCode. to the m?


#2 willpower

willpower
  • Members
  • PipPipPip
  • Advanced Member
  • 296 posts
  • LocationWarrington, Cheshire, UK

Posted 10 April 2006 - 10:31 AM

I think its because you have double quotes around $clientCode. try changing it to

$search_participant = "SELECT * FROM ' .$clientCode. 'm WHERE memName
LIKE '%$namesearch%' ORDER BY memCode";

...and whats the m for...is this just a typo? and add single quotes around memName 'memName'

Try that and see
Wait...I've got it...Bollocks, it's gone again!

If at first you don't succeed....stop using ASP and get onto PHP

#3 cheryl

cheryl
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 10 April 2006 - 10:46 AM

the query still won't execute.

by the way, the m isn't a typo. the $clientCode is suppose to join to the m to get $clientCodem table.

[!--quoteo(post=363250:date=Apr 10 2006, 05:31 AM:name=willpower)--][div class=\'quotetop\']QUOTE(willpower @ Apr 10 2006, 05:31 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
I think its because you have double quotes around $clientCode. try changing it to

$search_participant = "SELECT * FROM ' .$clientCode. 'm WHERE memName
LIKE '%$namesearch%' ORDER BY memCode";

...and whats the m for...is this just a typo? and add single quotes around memName 'memName'

Try that and see
[/quote]


#4 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,017 posts

Posted 10 April 2006 - 07:15 PM

I suggest you add some error trapping code

$search_participant = "SELECT * FROM " .$clientCode. "m WHERE memName
                              LIKE '%$namesearch%' ORDER BY memCode";

$result = mysql_query($search_participant) or die (mysql_error() . ' <br>' . $search_participant );

and what error do you get.
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#5 cheryl

cheryl
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 11 April 2006 - 01:21 AM

[!--quoteo(post=363404:date=Apr 10 2006, 02:15 PM:name=Barand)--][div class=\'quotetop\']QUOTE(Barand @ Apr 10 2006, 02:15 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
I suggest you add some error trapping code

$search_participant = "SELECT * FROM " .$clientCode. "m WHERE memName
                              LIKE '%$namesearch%' ORDER BY memCode";

$result = mysql_query($search_participant) or die (mysql_error() . ' <br>' . $search_participant );

and what error do you get.
[/quote]

the error is Couldn't execute query.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users