|
Posted by user on 01/23/07 16:34
Norman,
Thanks for the try. I had tried this and many many other syntax's. I
think most people are forgetting what I feel is the main issue.
The file with the query in it is added to the php file with a require
function. It is not actually in the php file. As previously stated when
the query is actually in the php it works fine. However, when the query
is in the external file and brought in with the 'require' function the
variable substitution does not work.
Norman Peelman 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.
>
>
> Try:
>
> $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";
>
> If $cccb_id has a value in it it will show up in the output. Notice I
> removed the single quotes from around cccb and member as they are not
> needed. Use backticks (`) if you must. Always remember, to include
> variables whithin strings the entire string must be enclosed in double
> quotes or the variables won't get parsed.
>
> Norm
[Back to original message]
|