Icy Phoenix

     
 


Post new topic  Reply to topic 
Page 1 of 2
Goto page 1, 2  Next
 
Reply with quote Download Post 
Post This Is Driving Me Nuts !! - SQL Query Producing Double Results !! 
 
Hi Guys,

I have a tpl file :-

Spoiler: [ Show ]


I have the following script

Spoiler: [ Show ]



Now there is a drop down box in the tpl file that gets populated with this code is the php script:-

                $sql = "SELECT DISTINCT `type` FROM `" . $tbl ."`WHERE 1 ORDER BY `type` ";
        
        $result = $db->sql_query($sql);

        if (!($result = $db->sql_query($sql)))
            {
                   die("Database Query Failed" . mysql_error());
            }


        
        while ($row = $db->sql_fetchrow($result))
            {
                   $region_filter_options .= '<option value="' . $row['type'] . '">' . $row['type'] . '</option>';
                
            }
            
        $template->assign_vars(array(
                'REGION_FILTER' => $region_filter_options,
            )
        );    



For some reason it produces double entries for every entry, but it looks as if it has run through this routine twice, can someone tell  me how to fix this ???
 



 
Edited by DWho, Sat 29 Aug, 2009 16:17: Added spoiler bbcode to make the post easy to read...
AndyGpySend private messageVisit poster's website  
Back to topPage bottom
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.

Support us
 
Reply with quote Download Post 
Post Re: This Is Driving Me Nuts !! - SQL Query Producing Double Results !! 
 
are you telling me you´ve got the sql vars assigned twice ??

once in your script and once in dropdown ??
 




____________
Out of Order
 
spydieSend private messageVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: This Is Driving Me Nuts !! - SQL Query Producing Double Results !! 
 
No it only gets assigned via the PHP script once
 



 
AndyGpySend private messageVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: This Is Driving Me Nuts !! - SQL Query Producing Double Results !! 
 
question.

why do you connect to the database then your allready connected via config ??

or are you using an extra db for your ticklist???
 




____________
Out of Order
 
spydieSend private messageVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: This Is Driving Me Nuts !! - SQL Query Producing Double Results !! 
 
Yes i am using a seperate DB for my ticklist, this way i can port it to new versions of IP easily.

regards
 



 
AndyGpySend private messageVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: This Is Driving Me Nuts !! - SQL Query Producing Double Results !! 
 
was just a question , cause i thought that it might be the cause off double output
 




____________
Out of Order
 
spydieSend private messageVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: This Is Driving Me Nuts !! - SQL Query Producing Double Results !! 
 
Anyone else care to help ?

Mighty Gorgon Help !!
 



 
AndyGpySend private messageVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: This Is Driving Me Nuts !! - SQL Query Producing Double Results !! 
 
have you tried removing this part from your code

Code: [Download] [Hide] [Select]
$result = $db->sql_query($sql);

 




____________
Mods and themes for Icy Phoenix 1.3

IcyPhoenix UK is off-line permanently due to lack of time to update mods.
if anyone is interested in my templates I will upgrade them to Icy 2.0.
 
DWhoSend private messageVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: This Is Driving Me Nuts !! - SQL Query Producing Double Results !! 
 
Andy,

Is what you are saying is that you have a drop-down box and that is the only thing that is calling this script twice?

Spoiler: [ Show ]


Correct ?

If this MOD is GPL - Would you be kind enough to make available for me a zipped copy of the whole MOD - Because working like this has got "Feathers" on it.  
 
 
 
Back to topPage bottom
Reply with quote Download Post 
Post Re: This Is Driving Me Nuts !! - SQL Query Producing Double Results !! 
 
DWho,

I have tried that - no Joy.


Lopalong,

It dont know how to put it in zip format, i can zip the files and send them to you but i cannot send the assosciated database.

Basically i have the tpl file in the first post and the php script in the first post. There is a small section in the PHP file that populates the drop down box.

If you log into my site as

Username -- test
Password -- test

browse to Ticklists ( Top navigation bar in home page ) you will see what i mean.

Click here for website

regards
 



 
AndyGpySend private messageVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: This Is Driving Me Nuts !! - SQL Query Producing Double Results !! 
 
I don't need to log into your site because I understand what you are saying. And physically looking at the problem is not really going to help.

All you need to do is dig out all of the files associated with it and .zip them up, and a copy of the original SQL that you added would be more than useful.
 
 
 
Back to topPage bottom
Reply with quote Download Post 
Post Re: This Is Driving Me Nuts !! - SQL Query Producing Double Results !! 
 
lots of errors on that page at the moment

> Critical Error!
message_die() was called multiple times.
 Error #1
Could not query Icy_jr_admin_users table

Line : 152
File : /var/www/Forum/includes/functions_jr_admin.php
SQL : SELECT * FROM Icy_jr_admin_users WHERE user_id = '47'
  Error #2
Error
Could not query log information

Line : 101
File : /var/www/Forum/includes/functions_mg_log.php
SQL : SELECT MAX(log_id) max_log_id FROM Icy_logs

cant see whats going on
 




____________
Mods and themes for Icy Phoenix 1.3

IcyPhoenix UK is off-line permanently due to lack of time to update mods.
if anyone is interested in my templates I will upgrade them to Icy 2.0.
 
DWhoSend private messageVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: This Is Driving Me Nuts !! - SQL Query Producing Double Results !! 
 
Hi Lopalong,

Have PM you what you requested.

DWho,

i only have those errors with the test account, will look into resolving once i get the duplication thing sorted. Thanks anyway.

regards
 



 
AndyGpySend private messageVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: This Is Driving Me Nuts !! - SQL Query Producing Double Results !! 
 
After many tests and trying to work the Db thing out.

It's appears it's in the .tpl file.

Code: [Download] [Hide] [Select]
            <option value="{REGION_FILTER}">{REGION_FILTER}</option>


The same VAR twice.

Try this?

 
Code: [Download] [Hide] [Select]
           <option value="{REGION_FILTER}" /></option>

 
 
 
Back to topPage bottom
Reply with quote Download Post 
Post Re: This Is Driving Me Nuts !! - SQL Query Producing Double Results !! 
 
Cheers Lopalong that fixed the duplicate entries.

With regards to DWho's spotting-

Critical Error!
message_die() was called multiple times.
 Error #1
Could not query Icy_jr_admin_users table

Line : 152
File : /var/www/Forum/includes/functions_jr_admin.php
SQL : SELECT * FROM Icy_jr_admin_users WHERE user_id = '13'
  Error #2
Error
Could not query log information

Line : 101
File : /var/www/Forum/includes/functions_mg_log.php
SQL : SELECT MAX(log_id) max_log_id FROM Icy_logs

It appears i am getting it for all users, moderators and admins are ok, it was as a result of missing a " ," when parsing variables.

Problems solved, Lopalong your a star and i look forward to your PM.

regards
 



 
Last edited by AndyGpy on Wed 02 Sep, 2009 07:04; edited 1 time in total 
AndyGpySend private messageVisit poster's website  
Back to topPage bottom
Post new topic  Reply to topic  Page 1 of 2
Goto page 1, 2  Next


Display posts from previous:    

HideWas this topic useful?

Link this topic
URL
BBCode
HTML




 
Permissions List
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events