Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old January 17th, 2007, 02:15 AM
user
Guest
 
Posts: n/a
Default php variable in sql string

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.
  #2  
Old January 17th, 2007, 02:35 AM
ZeldorBlat
Guest
 
Posts: n/a
Default Re: php variable in sql string


user wrote:
Quote:
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.

  #3  
Old January 17th, 2007, 03:25 AM
user
Guest
 
Posts: n/a
Default Re: php variable in sql string

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:
Quote:
user wrote:
>
Quote:
>>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.
>
  #4  
Old January 17th, 2007, 08:05 AM
iulian.ilea
Guest
 
Posts: n/a
Default Re: php variable in sql string


user wrote:
Quote:
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:
>
Quote:
user wrote:
Quote:
>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.
You can try this also:
$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";

or, I think this shoul work too:

$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";

  #5  
Old January 17th, 2007, 05:35 PM
Jerry Stuckle
Guest
 
Posts: n/a
Default Re: php variable in sql string

user wrote:
Quote:
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:
>
Quote:
>user wrote:
>>
Quote:
>>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.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
  #6  
Old January 17th, 2007, 05:35 PM
Carl Pearson
Guest
 
Posts: n/a
Default Re: php variable in sql string

user wrote:
Quote:
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.
You need to concatenate, i.e.
$query4 = "some stuff " . $cccb . " some more stuff";

Make sure you allow for adequate spacing where the different parts meet,
as the concatenation will literally attach whatever you put together
into one new string.
  #7  
Old January 17th, 2007, 08:25 PM
user
Guest
 
Posts: n/a
Default Re: php variable in sql string

Results below, had tried, none worked sorry to say, but thanks none the
less.

$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;

and

$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;






iulian.ilea wrote:
Quote:
user wrote:
>
Quote:
>>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:
>>
>>
Quote:
>>>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.
>>>
>
>
You can try this also:
$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";
>
or, I think this shoul work too:
>
$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";
Quote:
>
  #8  
Old January 17th, 2007, 08:55 PM
user
Guest
 
Posts: n/a
Default Re: php variable in sql string

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;

Jerry Stuckle wrote:
Quote:
user wrote:
>
Quote:
>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:
>>
Quote:
>>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.
>
  #9  
Old January 17th, 2007, 09:35 PM
Jerry Stuckle
Guest
 
Posts: n/a
Default Re: php variable in sql string

user wrote:
Quote:
Jerry Stuckle wrote:
>
Quote:
>user wrote:
>>
Quote:
>>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
==================
  #10  
Old January 18th, 2007, 01:55 AM
user
Guest
 
Posts: n/a
Default Re: php variable in sql string


variable is not empty. As explained earlier this same sql script runs
fine if placed inside the php program. It is just when it is located
within the require "db.inc" file that the variable substitution does not
work.

Appreciate your top post request, but refuse to join the flat earth society.

Jerry Stuckle wrote:
Quote:
user wrote:
>
Quote:
>Jerry Stuckle wrote:
>>
Quote:
>>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.
>
>
  #11  
Old January 18th, 2007, 05:05 AM
Jerry Stuckle
Guest
 
Posts: n/a
Default Re: php variable in sql string

user wrote:
Quote:
Jerry Stuckle wrote:
>
Quote:
>user wrote:
>>
Quote:
>>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
Quote:
> 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.
>>
>>
>
variable is not empty. As explained earlier this same sql script runs
fine if placed inside the php program. It is just when it is located
within the require "db.inc" file that the variable substitution does not
work.
>
Appreciate your top post request, but refuse to join the flat earth
society.
>
(Top posting fixed - again)

As I said - did you actually try to echo the variable to the screen to
see what's in it?

And if you don't follow normal usenet conventions, don't expect to get a
lot of help from this newsgroup. You're the one asking for help. You
should follow the established conventions.

So please don't top post. Or don't expect much for answers.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
  #12  
Old January 18th, 2007, 02:05 PM
Toby Inkster
Guest
 
Posts: n/a
Default Re: php variable in sql string

user wrote:
Quote:
variable is not empty. As explained earlier this same sql script runs
fine if placed inside the php program. It is just when it is located
within the require "db.inc" file that the variable substitution does not
work.
Google: scoping.
Quote:
Appreciate your top post request, but refuse to join the flat earth society.
Do you tell jokes punch-line first too?

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

  #13  
Old January 19th, 2007, 02:35 AM
Norman Peelman
Guest
 
Posts: n/a
Default Re: php variable in sql string

user wrote:
Quote:
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
  #14  
Old January 19th, 2007, 02:25 PM
user
Guest
 
Posts: n/a
Default Re: php variable in sql string

Jerry,

Read posts and reply or don't. That is your decision.

P.S. For you and Inkster. THE EARTH IS NOT FLAT!!! REALLY!! Any you
saying it is does not make it so!

Have a nice day!





Jerry Stuckle wrote:
Quote:
user wrote:
>
Quote:
>Jerry Stuckle wrote:
>>
Quote:
>>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.
>>>
>>>
>
variable is not empty. As explained earlier this same sql script runs
fine if placed inside the php program. It is just when it is located
within the require "db.inc" file that the variable substitution does not
work.
>
Appreciate your top post request, but refuse to join the flat earth
society.
>
>
(Top posting fixed - again)
>
As I said - did you actually try to echo the variable to the screen to
see what's in it?
>
And if you don't follow normal usenet conventions, don't expect to get a
lot of help from this newsgroup. You're the one asking for help. You
should follow the established conventions.
>
So please don't top post. Or don't expect much for answers.
>
  #15  
Old January 19th, 2007, 02:55 PM
Geoff Berrow
Guest
 
Posts: n/a
Default Re: php variable in sql string

Message-ID: <mn4sh.762646$QZ1.204364@bgtnsc04-news.ops.worldnet.att.net>
from user contained the following:
Quote:
>P.S. For you and Inkster. THE EARTH IS NOT FLAT!!! REALLY!! Any you
>saying it is does not make it so!
Posting in a sensible manner in a technical forum such as this is not
flat earth mentality.

Thinking it is marks you out as singularly clueless.

Fine if you want to solve your own problems.
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
  #16  
Old January 19th, 2007, 03:05 PM
Rik
Guest
 
Posts: n/a
Default Re: php variable in sql string

user wrote:
Quote:
Read posts and reply or don't. That is your decision.

Indeed it is. Another regular poster gone.
*plonk*
--
Rik Wasmus


  #17  
Old January 19th, 2007, 04:05 PM
Jerry Stuckle
Guest
 
Posts: n/a
Default Re: php variable in sql string

user wrote:
Quote:
Jerry Stuckle wrote:
>
Quote:
>user wrote:
>>
Quote:
>>Jerry Stuckle wrote:
>>>
>>>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.
>>>>
>>>>
> >
> variable is not empty. As explained earlier this same sql script runs
> fine if placed inside the php program. It is just when it is located
> within the require "db.inc" file that the variable substitution
>does not
Quote:
> work.
> >
> Appreciate your top post request, but refuse to join the flat earth
> society.
> >
>>
>(Top posting fixed - again)
>>
>As I said - did you actually try to echo the variable to the screen to
>see what's in it?
>>
>And if you don't follow normal usenet conventions, don't expect to get
>a lot of help from this newsgroup. You're the one asking for help.
>You should follow the established conventions.
>>
>So please don't top post. Or don't expect much for answers.
>>
Jerry,
>
Read posts and reply or don't. That is your decision.
>
P.S. For you and Inkster. THE EARTH IS NOT FLAT!!! REALLY!! Any you
saying it is does not make it so!
>
Have a nice day!
>
>
Top posting fixed - AGAIN!

No, but top posting in a group which uses bottom posting as a
convention, then refusing to change when politely asked, shows the
ultimate level of arrogance.

Considerate people follow the conventions of the culture (including
newsgroups) in which they participate. Only losers and assholes refuse
to do so and insist others follow whatever conventions THEY want to observe.

Which are you?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
  #18  
Old January 19th, 2007, 06:15 PM
Geoff Berrow
Guest
 
Posts: n/a
Default Re: php variable in sql string

Message-ID: <jOKdnR7iULe9di3YnZ2dnUVZ_tXinZ2d@comcast.comfro m Jerry
Stuckle contained the following:
Quote:
Quote:
P.S. For you and Inkster. THE EARTH IS NOT FLAT!!! REALLY!! Any you
saying it is does not make it so!

Have a nice day!
>Top posting fixed - AGAIN!
>
>No, but top posting in a group which uses bottom posting as a
>convention, then refusing to change when politely asked, shows the
>ultimate level of arrogance.
>
>Considerate people follow the conventions of the culture (including
>newsgroups) in which they participate.
Isn't snipping irrelevant content also a convention?

gd&rlf



--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
  #19  
Old January 21st, 2007, 12:45 AM
Tim Roberts
Guest
 
Posts: n/a
Default Re: php variable in sql string

user <someone@somewhere.orgwrote:
Quote:
>
>Jerry,
>
>Read posts and reply or don't. That is your decision.
>
>P.S. For you and Inkster. THE EARTH IS NOT FLAT!!! REALLY!! Any you
>saying it is does not make it so!
At the risk of beating a dead horse, I'd like to explore what you've said
here.

Most people top-post because Microsoft chose to write Outlook and Outlook
Express with blatent (and perhaps intentional) disregard for the
established patterns. Those people top-post because they are use the
defaults without thinking and without knowing any better.

You, on the other hand, seem to be making the argumeent that top-posting is
somehow superior to bottom-posting. I've not heard that argument before,
and I'd like to hear your reasons. Clearly, saying "I do it therefore it
must be better" is nonsense, so you must have something better.

Personally, I don't think it makes a bit of difference. Most people quote
way, way, WAY too much as it is; thanks to threading newsreaders, all I
need is the briefest reminder of what we were talking about for context.
When you cut quoting to a minimum, the top/bottom thing becomes irrelevant.
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
  #20  
Old January 21st, 2007, 12:55 AM
Rik
Guest
 
Posts: n/a
Default Re: php variable in sql string

Tim Roberts wrote:
Quote:
Most people top-post because Microsoft chose to write Outlook and
Outlook Express with blatent (and perhaps intentional) disregard for
the established patterns. Those people top-post because they are use
the defaults without thinking and without knowing any better.
Hurray for OE-Quotefix...
Quote:
Personally, I don't think it makes a bit of difference. Most people
quote way, way, WAY too much as it is; thanks to threading
newsreaders, all I need is the briefest reminder of what we were
talking about for context. When you cut quoting to a minimum, the
top/bottom thing becomes irrelevant.
Quoting should always be at the top. And the reason to quote is something
dear to me: in usenet, on thousands of servers, not every post get's
through, and sometimes not even in the right order. So the quote is there
to inform people who might not see the previous what was there, or at least
in which direction this particular (sub) thread goes. Without the quote, I
have no idea what the original post/topic/question was, which is highly
frustrating... and unfortunately with a somewhat buggy newsserver atm not a
very rare occurance for me.
--
Rik Wasmus


  #21  
Old January 22nd, 2007, 06:35 PM
Michael Fesser
Guest
 
Posts: n/a
Default Re: php variable in sql string

..oO(Rik)
Quote:
>Tim Roberts wrote:
>
Quote:
>Personally, I don't think it makes a bit of difference. Most people
>quote way, way, WAY too much as it is; thanks to threading
>newsreaders, all I need is the briefest reminder of what we were
>talking about for context. When you cut quoting to a minimum, the
>top/bottom thing becomes irrelevant.
>
>Quoting should always be at the top. And the reason to quote is something
>dear to me: in usenet, on thousands of servers, not every post get's
>through, and sometimes not even in the right order. So the quote is there
>to inform people who might not see the previous what was there, or at least
>in which direction this particular (sub) thread goes.
Yep, that's what a quote is for. But it's still no reason for a full
quote of a hundred lines or even more. Such a full quote at the top with
a short answer below it is even more annoying than a full bottom quote.
Quote:
>Without the quote, I
>have no idea what the original post/topic/question was, which is highly
>frustrating... and unfortunately with a somewhat buggy newsserver atm not a
>very rare occurance for me.
Tim didn't suggest to quote nothing. The key is to quote _reasonably_ -
not too less, not too much. Many people here calling for bottom quotes
seem to forget the latter.

Micha
  #22  
Old January 23rd, 2007, 03:55 PM
user
Guest
 
Posts: n/a
Default Re: php variable in sql string

Wikipedia.org/wiki/Arrogance

Often people who are arrogant are not aware of their own behavior or
don't want to recognize they are arrogant. A person can be arrogant but
not show it externally to others due to their thoughts, actions and
emotions.

A strongly arrogant person will usually try to downplay other people's
achievements or ideas in order to make themselves appear better.
Arrogant people will even ignore or downplay good ideas from others, as
they cannot accept that others might have better ideas than themselves..
This makes reasonable communication difficult and arguments impossible
to resolve fairly as the arrogant person will not accept the other
person's point of view, no matter how logical/intuitive or correct it
is, because the arrogant person is really having an emotional argument
about their own arrogance.

Do you go along with all other cultural 'conventions'? I don't think so.

Maybe if you spend as much time correcting this problem as you do
annoying others with 'your' and a 'few' other dogma disciples it would help.


Jerry Stuckle wrote:
Quote:
user wrote:
>
Quote:
>Jerry Stuckle wrote:
>>
Quote:
>>user wrote:
>>>
>>>Jerry Stuckle wrote:
>>>>
>>>>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.
>>>>>
>>>>>
>> >
>> variable is not empty. As explained earlier this same sql script runs
>> fine if placed inside the php program. It is just when it is located
>> within the require "db.inc" file that the variable substitution
>>does not
>> work.
>> >
>> Appreciate your top post request, but refuse to join the flat earth
>> society.
>> >
>>>
>>(Top posting fixed - again)
>>>
>>As I said - did you actually try to echo the variable to the screen
>>to see what's in it?
>>>
>>And if you don't follow normal usenet conventions, don't expect to
>>get a lot of help from this newsgroup. You're the one asking for
>>help. You should follow the established conventions.
>>>
>>So please don't top post. Or don't expect much for answers.
>>>
Jerry,
>
Read posts and reply or don't. That is your decision.
>
P.S. For you and Inkster. THE EARTH IS NOT FLAT!!! REALLY!! Any you
saying it is does not make it so!
>
Have a nice day!
>
>
Top posting fixed - AGAIN!
>
No, but top posting in a group which uses bottom posting as a
convention, then refusing to change when politely asked, shows the
ultimate level of arrogance.
>
Considerate people follow the conventions of the culture (including
newsgroups) in which they participate. Only losers and assholes refuse
to do so and insist others follow whatever conventions THEY want to
observe.
>
Which are you?
>
  #23  
Old January 23rd, 2007, 04:05 PM
user
Guest
 
Posts: n/a
Default Re: php variable in sql string

Well thank you.

I 'stopped' bottom posting quit some time ago. Reason, I took a lot more
to read bottom posts than top posts. As you state even at it's best
bottom posts suffer from people 'not' cutting.

I have never understood the bottom post argument of 'that's the way is
has always been' or 'that's the way it is'. Many bottom posting groups
have changed and with all the time some people spend trying to enforce
'their' ideas on others they could spend said time fixing the problem.

It really seems 'flat earth' mentality without being arrogant.



Tim Roberts wrote:
Quote:
user <someone@somewhere.orgwrote:
>
Quote:
>>Jerry,
>>
>>Read posts and reply or don't. That is your decision.
>>
>>P.S. For you and Inkster. THE EARTH IS NOT FLAT!!! REALLY!! Any you
>>saying it is does not make it so!
>
>
At the risk of beating a dead horse, I'd like to explore what you've said
here.
>
Most people top-post because Microsoft chose to write Outlook and Outlook
Express with blatent (and perhaps intentional) disregard for the
established patterns. Those people top-post because they are use the
defaults without thinking and without knowing any better.
>
You, on the other hand, seem to be making the argumeent that top-posting is
somehow superior to bottom-posting. I've not heard that argument before,
and I'd like to hear your reasons. Clearly, saying "I do it therefore it
must be better" is nonsense, so you must have something better.
>
Personally, I don't think it makes a bit of difference. Most people quote
way, way, WAY too much as it is; thanks to threading newsreaders, all I
need is the briefest reminder of what we were talking about for context.
When you cut quoting to a minimum, the top/bottom thing becomes irrelevant.
  #24  
Old January 23rd, 2007, 04:25 PM
Geoff Berrow
Guest
 
Posts: n/a
Default Re: php variable in sql string

Message-ID: <Ufqth.800612$QZ1.244878@bgtnsc04-news.ops.worldnet.att.net>
from user contained the following:
Quote:
>I 'stopped' bottom posting quit some time ago. Reason, I took a lot more
>to read bottom posts than top posts. As you state even at it's best
>bottom posts suffer from people 'not' cutting.
*plonk*

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
  #25  
Old January 23rd, 2007, 04:45 PM
user
Guest
 
Posts: n/a
Default Re: php variable in sql string

Norman,

Thanks for the try. I had tried this and many many other syntax's.