[SOLVED] Select query causes output displayed to duplicate
Posted: Tue May 27, 2008 2:56 am
Hi,
The following query causes the output displayed to duplicate:
This problem is resolved with the use of
but I have another page with exactly the same code with a different table but the output is not duplicated there. I've checked to ensure that there aren't any duplicate records in the database table.
I've run the query from the PHP Page and within MySQL and the result remains the same on both.
Why would this query cause the rows displayed to duplicate if there aren't any duplications in the DB or if it has not been placed in a loop?
The following query causes the output displayed to duplicate:
Code: Select all
$query="select uni_bw_usr.user_number,uni_bw_usr.user_name,uni_bw_usr.user_level,uni_bw_usr.user_entry_menu,uni_bw_usr.user_branch_cd,bw_templates.user_number as template from uni_bw_usr,bw_templates where uni_bw_usr.user_level = bw_templates.user_level and uni_bw_usr.user_entry_menu = bw_templates.user_entry_menu and uni_bw_usr.user_op1 = bw_templates.user_op1 and uni_bw_usr.user_op2 = bw_templates.user_op2 and uni_bw_usr.user_op3 = bw_templates.user_op3 and uni_bw_usr.user_op4 = bw_templates.user_op4 and uni_bw_usr.user_op5 = bw_templates.user_op5 and uni_bw_usr.user_op6 = bw_templates.user_op6 and uni_bw_usr.user_op7 = bw_templates.user_op7 and uni_bw_usr.user_op8 = bw_templates.user_op8 and uni_bw_usr.user_op9 = bw_templates.user_op9 and uni_bw_usr.user_op10 = bw_templates.user_op10 and uni_bw_usr.user_op11 = bw_templates.user_op11 and uni_bw_usr.user_op12 = bw_templates.user_op12 and uni_bw_usr.user_op13 = bw_templates.user_op13 and uni_bw_usr.user_op14 = bw_templates.user_op14 and uni_bw_usr.user_op15 = bw_templates.user_op15 and uni_bw_usr.user_op16 = bw_templates.user_op16 and uni_bw_usr.user_op17 = bw_templates.user_op17 and uni_bw_usr.user_op18 = bw_templates.user_op18 and uni_bw_usr.user_op19 = bw_templates.user_op19 and uni_bw_usr.user_op20 = bw_templates.user_op20 and uni_bw_usr.user_op21 = bw_templates.user_op21 and uni_bw_usr.user_op22 = bw_templates.user_op22 and uni_bw_usr.user_op23 = bw_templates.user_op23 and uni_bw_usr.user_op24 = bw_templates.user_op24 and uni_bw_usr.user_op25 = bw_templates.user_op26 and uni_bw_usr.user_op26 = bw_templates.user_op26 and uni_bw_usr.user_name like '%$name%' order by uni_bw_usr.user_branch_cd"Code: Select all
$query="select distinct .........I've run the query from the PHP Page and within MySQL and the result remains the same on both.
Why would this query cause the rows displayed to duplicate if there aren't any duplications in the DB or if it has not been placed in a loop?