Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Attn: Bluetac - Problem in Query result in multipage using variables

Status
Not open for further replies.

paulsam

Programmer
Mar 15, 2001
4
0
0
US
hello bluetac,

i have found ur code and test but when i used variables in my query. huh! doesnt work anymore. the first page shows the right one but once you go to other pages it shows all the database (see below code):

this is ur code:
$sqlstr = "SELECT column1, column2 FROM yourtable";

my code:
$sqlstr = "SELECT * FROM $table WHERE FNAME='$fname' ORDER BY LNAME, FNAME";

i tried not using the variables & it works. i need to use the variables coz the the design of my php has an authentication. im using their usernames as their table name as well as their search input.

pls help me... i've been working on this for 3weeks already & tried several sample codes but i encountered the same problem..

hope for ur immediate reply. thank you in advance.

army
army@idess.com
 
Try putting the $table variable in single quotes:

[tt]
you had:

$sqlstr = "SELECT * FROM $table WHERE FNAME='$fname' ORDER BY LNAME, FNAME";

try:

$sqlstr = "SELECT * FROM '$table' WHERE FNAME='$fname' ORDER BY LNAME, FNAME";

[/tt]

Hope this helps.

-Vic

vic cherubini
vikter@epicsoftware.com
====
Knows: Perl, HTML, JavScript, C/C++, PHP, Flash, Director
====
 
thanx vic, but still dont work. i think i must accept that these user variables will not work anymore.. coz i went to 'MySql manual - User Variables' topic & found the limitations of SELECT using USER VARIABLES.

im still hoping somebody out there encountered this problem & if possible could share to me whats the solution...

thanx in advance,
army
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top