|
Posted by Jerry Stuckle on 01/17/07 19:25
user wrote:
> Jerry Stuckle wrote:
>
>> user wrote:
>>
>>> Tried those already.....
>>>
>>> '$cccb_id' cccb.cccb_id = ('') order by memberError 1064
>>> .'$cccb_id'. gets cccb.cccb_id = (.''.) order by memberError 1064
>>> and $cccb_id and [cccb_id] and ........
>>>
>>>
>>>
>>> ZeldorBlat wrote:
>>>
>>>> user wrote:
>>>>
>>>>> Have require file with several query stings in it.
>>>>>
>>>>> Depending on user input one of strings is selected. Everything going
>>>>> along smoothly until I wanted to also input a variable in string. If I
>>>>> put string in program works ok, but, if I use string from require
>>>>> file I
>>>>> can not seem to insert string.
>>>>>
>>>>> $cccb_id is sting..... to be inserted into $query4 and changes
>>>>> depending
>>>>> on user input.
>>>>>
>>>>> $query4 = "select cccb.cccb_name as 'cccb', CONCAT(member_fname,'
>>>>> ',member_lname) as 'member' from member_cccb_lnk join member on
>>>>> (member.member_no = member_cccb_lnk.member_no) join cccb on
>>>>> member_cccb_lnk.cccb_id = cccb.cccb_id and cccb.cccb_id = "$cccb_id"
>>>>> order by member";
>>>>>
>>>>> output is: select cccb.cccb_name as 'cccb', CONCAT(member_fname,'
>>>>> ',member_lname) as 'member' from member_cccb_lnk join member on
>>>>> (member.member_no = member_cccb_lnk.member_no) join cccb on
>>>>> member_cccb_lnk.cccb_id = cccb.cccb_id and cccb.cccb_id = order by
>>>>> memberError 1064
>>>>>
>>>>> as you can see, "$cccb_id" is not in query string.
>>>>>
>>>>> any help will be appreciated.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Count your double quotes:
>>>>
>>>> $query4 = "select cccb.cccb ... and cccb.cccb_id = "$cccb_id" order by
>>>> member";
>>>>
>>>> So your $cccb_id isn't inside the quotes. You probably want to either
>>>> remove those quotes so the variable is inserted into the string
>>>> automatically or add .'s on both sides of $cccb_id.
>>>>
>>
>> Is $cccb_id a numeric value? If so, it shouldn't be in quotes.
>> Removing the double quotes around it will solve your problem.
>>
>> If it is not numeric, then you need single quotes around it, not double.
>>
> Nope but thanks anyway.
>
> $query4 = "select cccb.cccb_name as 'cccb', CONCAT(member_fname,'
> ',member_lname) as 'member' from member_cccb_lnk join member on
> (member.member_no = member_cccb_lnk.member_no) join cccb on
> member_cccb_lnk.cccb_id = cccb.cccb_id and cccb.cccb_id = '$cccb_id'
> order by member;";
>
> query4 is: select cccb.cccb_name as 'cccb', CONCAT(member_fname,'
> ',member_lname) as 'member'
> from member_cccb_lnk join member on (member.member_no =
> member_cccb_lnk.member_no) join cccb
> on member_cccb_lnk.cccb_id = cccb.cccb_id and cccb.cccb_id = '' order by
> member;
>
(Top posting fixed)
Whoops - I missed one important thing. It looks like $cccb_id is empty.
Try echoing this to the screen before you build your select statement.
P.S. Please don't top post. Thanks.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|