Sql count problem

hi all
when i using this query it is returning me with count =0 but when i'm using other query it is returning with count 10 . please help me Actually working on message box forms personalization .and i need to show a message box where it should return me only if count is more than 3 .
1.SELECT COUNT (*) FROM CSD_REPAIRS CR, CS_INCIDENTS_ALL_B CS, CSD_PRODUCT_TRANSACTIONS CP
WHERE (
SELECT count(*)
FROM CSD_REPAIRS CR, CS_INCIDENTS_ALL_B CS, CSD_PRODUCT_TRANSACTIONS CP
WHERE CR.REPAIR_LINE_ID = CP.REPAIR_LINE_ID
AND CR.INCIDENT_ID = CS.INCIDENT_ID
AND CS.ACCOUNT_ID = 1608
AND CP.prod_txn_status = 'RECEIVED'
AND CR.STATUS = 'C'
AND CP.SOURCE_SERIAL_NUMBER = '0722AB05')>=3
2. select * from (select count(CASE WHEN cr.status='C' then 1 END) statuscnt
from csd_repairs cr, csd_product_transactions cp, cs_incidents_all_b cs where cs.incident_id=cr.incident_id and
CP.SOURCE_SERIAL_NUMBER = '0722AB05'
and cr.repair_line_id=cp.repair_line_id group by cr.serial_number) where statuscnt>2
union
select * from (select count(case when cp.prod_txn_status='RECEIVED' then 1 end) statusrec
from csd_repairs cr, csd_product_transactions cp, cs_incidents_all_b cs where cs.incident_id=cr.incident_id and
CP.SOURCE_SERIAL_NUMBER = '0722AB05'
and cr.repair_line_id=cp.repair_line_id group by cr.serial_number) where statusrec >2

You are the one who should know what must be there in the SELECT clause. Try this.
select *
from (SELECT cr.REPAIR_LINE_ID,
             cr.INCIDENT_ID,
             cs.ACCOUNT_ID,
             count(1) over (partition by 1 order by 1) tot
      FROM CSD_REPAIRS CR,
           CS_INCIDENTS_ALL_B CS,
           CSD_PRODUCT_TRANSACTIONS CP
      WHERE CR.REPAIR_LINE_ID = CP.REPAIR_LINE_ID
      AND CR.INCIDENT_ID = CS.INCIDENT_ID
      AND CS.ACCOUNT_ID = 1608
      AND CP.prod_txn_status = 'RECEIVED'
      AND CR.STATUS = 'C'
      AND CP.SOURCE_SERIAL_NUMBER = '0722AB05'
where tot >= 3;     Cheers
Sarma.

Similar Messages

  • Perform SQL COUNT from AS3

    Hi there all,
    Just working away as usual and I've encountered a problem with a flash app I'm making..
    I can save and load variables from flash to the mySQL database, but when I load up the results one after the other I eventually run out of results to display, which throws an error !!
    Is there a way I can perform an SQL COUNT from flash to determine the amount of results I have in the database and loop the viewer back to the first result ??
    Many Thanks in advance for any help

    This is how I am parsing and requesting the information.. I know it's in there somewhere I just can't get the variables, do I need to add them ? It's not making much sense to me at the moment, I'm sorry !! I need to add the variables to the request somehow.. so I can receive the info, no ?
    var tab = "SQLtab";
    var filesend = "path to php file";
    var modesend = "post";
    function variableTransaction(fichier, modesend, tab, var1, var2) {
         var URLload = new URLLoader();
         var URLrequest = new URLRequest(fichier);
         var variables:URLVariables = new URLVariables();
         variables.tab = tab;
         variables.var1 = var1;
         variables.var2 = var2;
         if (modesend == "post") {
              URLrequest.method = URLRequestMethod.POST;
         } else if ( modesend == "get") {
              URLrequest.method = URLRequestMethod.GET;
         if (var1 == false && var2 == false) {
              URLload.dataFormat = URLLoaderDataFormat.VARIABLES;
              URLrequest.data = variables;
              URLload.load(URLrequest);
              URLload.addEventListener(Event.COMPLETE, loadComplete, false, 0, true);
         } else {
              URLrequest.data = variables;
              URLload.load(URLrequest);
              var receiveObject = variableTransaction(filesend, modesend, tab, false, false);

  • NEED HELP IN SQL HOMEWORK PROBLEMS

    I NEED HELP IN MY SQL HOMEWORK PROBLEMS....
    I CAN SEND IT VIA EMAIL ATTACHMENT IN MSWORD....

    Try this:
    SELECT SUBSTR( TN,
                   DECODE(LEVEL, 1, 1, INSTR(TN, '#', 1, LEVEL-1) + 1),
                   DECODE( INSTR(TN, '#', 1, LEVEL) , 0 ,
                           LENGTH(TN) + 1, INSTR(TN, '#', 1, LEVEL) )
                   - DECODE(LEVEL, 1, 1, INSTR(TN, '#', 1, LEVEL-1 ) + 1)
           ) xxx
    FROM (
        SELECT '234123#1254343#909823#908232#12345' TN FROM DUAL
    CONNECT BY LEVEL <= LENGTH(TN) - LENGTH(REPLACE(TN,'#')) + 1
    XXX                               
    234123                            
    1254343                           
    909823                            
    908232                            
    12345
    SELECT regexp_substr(tn, '[^#]+', 1, level) xx
    FROM (
        SELECT '234123#1254343#909823#908232#12345' TN FROM DUAL
    CONNECT BY LEVEL <= LENGTH(TN) - LENGTH(REPLACE(TN,'#')) + 1
    XX                                
    234123                            
    1254343                           
    909823                            
    908232                            
    12345 

  • SQL injection problem

    hi
    How can we solve SQL injection problem in JDBC ?
    this means if we have a form with text field and the user must enter a number say 4 , instead he entered "4 or true" this will concatenated with the SQL query and return all records because of "or true"....
    is there any solutions ?
    i tried PreparedStatment and it words but not alwayes
    good luck

    i clearfied this in my first post
    if u didnt got what i mean u can google it
    http://www.google.com
    thanksYou didn't gently provide keywords, like I always do, so I cannot learn from you.
    Well, with a "reproduceable example" I mean that you have to post a short but complete working code snippet which reproduces the problem. So that we can copy'n'paste it in our environment here and test/debug it ourself and then eventually confirm the SQL injection.

  • Not Converted : Free-hand SQL connection problem

    While converting a Free Hand SQL report from Desktop Intelligence to Web Intelligence report in BI XI 3.1, I am faced with the problem
    Not Converted : <REPNAME> - Free-hand SQL connection problem
    It is be noted that there are some other Free Hand SQL Reports, that go converted and published without any error. The subject report has two Data Providers; one referring to the Universe and other from the Free Hand SQL tagged to a DB Connection

    Ajay,
    Some more points that can be of consideration to you to help understand my problems.
    The conversion from DeskI to WebI is in the same version BI XI 3.1 and not to BI 4.0 in which Free Hand SQLs is not supported.
    I have converted one other Free Hand SQL Report with an error "Partially Converted : <REPNAME2> - Conditional or permanent Hide Header not available in Web Intelligence", for which I had to edit the report in InfoView and un-tick the "Show When Empty" property of the table ( http://www.forumtopics.com/busobj/viewtopic.php?t=197157&view=next&sid=e6840aafa2d1267c66dae164d1dbf9db ). I think the solution mentioned in this link does not meet the purpose as the table is not displayed in the design time after the above untick.
    Coming back to our issue, further probing into this aspect I stumbled upon this link meant for RCT for BI 4.0 version
    https://csdwportal.dhhs.state.nc.us/downloads/Business%20Objects%20XI%20R4.0%20Docs/SAP%20BusinessObjects%20Report%20Con…
    where in Section 3.4.9, there is a mention of the limitation in conversion as under
    "Conversion of reports with free-hand SQL or stored procedures is only possible in Connected mode, since the Report Conversion Tool needs to use the secured connection to the database that is saved in the CMS."
    I want to how the secured connection to the database in REPNAME2 is different from the subject report REPNAME1 as REPNAME2 got partially converted. The error reported for Subject report is "Free Hand SQL Connection Problem" and not conversion problem which can occur after the connection is established.
    I did check the security properties of various FHSQL connections in the CMC and all of them are identical in nature.
    Please advise

  • SQL Command problem in Application Express 3.2.0.00.27

    To Oracle Application Express Development Team,
    Yesterday I installed Oracle Application Express 3.2.0.00.27.
    While doing my r&d, I came across one problem in SQL Command.
    For example I wanted to run sql "select * from tab"
    When I checked "Autocommit" checkbox it worked fine.
    But when I unchecked the "Autocommit" checkbox it gave me following error:
    ORA-01003: no statement parsed
    Please check post
    http://www.oraclebrains.com/2009/03/sql-command-problem-in-application-express-3200027/ for more details.
    Cheers

    I can't find the log file (a good indication that something went wrong)
    Here's the transcript of the session...
    SQL> startup upgrade
    ORACLE instance started.
    Total System Global Area 599785472 bytes
    Fixed Size 1288820 bytes
    Variable Size 264242572 bytes
    Database Buffers 331350016 bytes
    Redo Buffers 2904064 bytes
    Database mounted.
    Database opened.
    SQL> @apxpatch.sql
    PL/SQL procedure successfully completed.
    PL/SQL procedure successfully completed.
    Wrote file apxset.sql
    PL/SQL procedure successfully completed.
    PL/SQL procedure successfully completed.
    SQL>
    SQL> @apxldimg.sql
    PL/SQL procedure successfully completed.
    Enter value for 1: C:\Documents and Settings\jtench\Desktop\My Downloads\Oracle\apex_3.2.1
    old 1: create directory APEX_IMAGES as '&1/apex/images'
    new 1: create directory APEX_IMAGES as 'C:\Documents and Settings\jtench\Desktop\My Downloads\Oracle\apex_3.2.1/apex/images'
    Directory created.
    PL/SQL procedure successfully completed.
    PL/SQL procedure successfully completed.
    PL/SQL procedure successfully completed.
    Commit complete.
    timing for: Load Images
    Elapsed: 00:03:30.03
    Directory dropped.
    SQL>

  • SQL Express problem client connection

    SQl Express problem, I can't connect another computer.
    I have sql express on win xp, and one client win 7 starter. The firewall is disable, I can ping the server computer (win xp pro). On Sql Configuration Manager I enable TCP/IP protocol and named pipes. ODBC local is fine, but remote don't connect.
    If anyone has an idea about this
    Felipe Script Center

    You hae to enable remote Connections as well, in Express Edition it's disabled by default, see
    Configure the remote access Server Configuration Option
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Pls help me(sql server problem)

    Im using sql server 2000
    i had 2 database servers
    'srv1', 'srv2'
    in srv1 had 'db1' database
    first create a user called 'db1usr1' with read and write previlages only(not dbowner)
    then take backup of 'db1' as 'db1bakup'
    then u hav to restore the 'db1bakup' in srv2 as 'db2'
    then u have 2 login in the 'srv2' machine as 'db1usr1'
    here is the problem : it is(db1usr1) not logged in srv2 machine through query analyser

    You're asking about a sql server problem on an Oracle forum?
    Don't you think a sql server forum would be a more appropriate place for your question?

  • Form_check.php returns SQL Configuration Problem

    Hello, I am hosting the MUSE outside of BC and the form cannot send out email. http://<website>/scripts/form_check.php shows that there is a SQL Configuration Problem. How to fix?

    Repplying to myself Ok, after lots of frustration, tickets to web host admin, forum crawlign it looks like the problem was either on the PHP-versio or the name of the form. The forms were titled with Scandinavian characters and "/"-mark so after simplified the forename from muse the messages came trough! The thing is that also did change in control panel of my web host from PHP-version 4.3 to PHP 4.5 so not sure which one did the job, actually i did try with fresh-starndard forms out of Muse and also with the complexly-named ones and the later did not come trough with the PHP-version change. So i would expect that it was both - naming and php-version.
    Hopefully this will help others since painful form-issue it was. Used woo-forms for whole but in terms of easy updatebility i decided to go with MUSE one. Tool still missing crucial features like radio buttons but looks like Muse been little hobby of Adobe so features coming in one by one, slowly but surely.
    Not sure though if next time will be building site using DW since these small limitations - issues makes life so much harder. When the app works it works like charm but when issue arrises you better of building stuff from scratch.

  • Solution: Play count problem

    As many others I had the play count problem with my iPod Shuffle which suddenly stopped working.
    The solution sounds boring but seems to work: the iPod seems to be pretty inflexible, but you have to follow a precise routine to keep it working after you have reset it:
    1) click 'eject' before tacking the iPod of the charger
    2) switch on
    3) start
    4) listen
    5) stop
    6) switch off
    7) insert in charger in 'switched off' mode
    Since I don't shortcut any of these steps, I don't have the count problem anymore.

    Unfortunately, this did not work for me. I tried chatting with Apple support about the issue and they suggested I call support. They had me re-install iTunes, but that did not correct the problem. Since my wife's Shuffle was updating the Play Count and Last Played correctly on her computer, I thought I would try on her computer. However, she has a older version of iTunes and it would not sync with my Shuffle. I then connected my Shuffle to my Son's laptop since he has the latest version of iTunes. iTunes required me to Erase and Sync on his computer. I did this, loaded up a few short songs, played them, and then sync'd back to his computer. It worked! I then sync'd my Shuffle with my computer (Erase and Sync, etc.) and it worked there as well!
    I'm not sure what part of that process actually corrected the problem, but thought I would post this in case it helps someone else.

  • SQL QUERY COUNT PROBLEM

    Employees:
    Employee_ID Name
    01 Hansen, Ola
    02 Svendson, Tove
    03 Svendson, Stephen
    04 Pettersen, Kari
    Orders:
    Prod_ID Product Employee_ID
    234 Printer 01
    657 Table 03
    865 Chair 03
    SELECT Employees.Name, Orders.Product
    FROM Employees, Orders
    WHERE Employees.Employee_ID=Orders.Employee_ID
    My question is :how to take the count of particular field from above query from the second table.

    Please don't re-post or cross-post.
    SELECT employee.name, COUNT(*)
    FROM employee, product
    WHERE employee.employee_id = product.employee_id
    GROUP BY employee.name
    - Saish

  • Creating pl/sql procedure problems

    Dear all,
    I have problems with creating a procedure which select returns more then one row.
    CREATE OR REPLACE PROCEDURE ECM_DATA.check_padrones_datos
    IS
      v_padron_check   VARCHAR2(50);
      v_padron_number   VARCHAR2(50);
    BEGIN
       SELECT count(pd.estado)
       INTO v_padron_check
       FROM par6.padrones_datos pd, par6.padrones p, par6.FECHAS f
         where pd.estado not in ('2000','8000')
         AND PD.ARCHIVO = P.ARCHIVO
         AND P.FECHA = F.datum_s;
        DBMS_OUTPUT.PUT_LINE('Št. neuspešnih zapisov :  ' || v_padron_check);
        SELECT distinct pd.archivo
       INTO v_padron_number
       FROM par6.padrones_datos pd, par6.padrones p, par6.FECHAS f
         where pd.estado not in ('2000','8000')
         AND PD.ARCHIVO = P.ARCHIVO
         AND P.FECHA = F.datum_s;
        DBMS_OUTPUT.PUT_LINE('Padron št. :  ' || v_padron_number);
      EXCEPTION
        WHEN NO_DATA_FOUND THEN
         v_padron_number := 'Vsi padroni so OK';
         DBMS_OUTPUT.PUT_LINE('Padron št. :  ' || v_padron_number);
    END;
    Error ->  -01422: exact fetch returns more than requested number of rows
    Select returns 2 or more rows.
    SELECT distinct pd.archivo
        FROM par6.padrones_datos pd, par6.padrones p, par6.FECHAS f
         where pd.estado not in ('2000','8000')
         AND PD.ARCHIVO = P.ARCHIVO
         AND P.FECHA = F.datum_s;
    How to write correct syntax in pl/sql. I apologize in advance for rookie questions. Any help would be appreciated.
    Regards,
    Robert

    The exact implementation depends on the use case.
    You can loop through the results
    FOR r IN (
        SELECT  DISTINCT pd.archivo
        FROM    par6.padrones_datos pd
               ,par6.padrones p
               ,par6.fechas f
        WHERE   pd.estado not in ('2000','8000')
        AND     pd.archivo = p.archivo
        AND     p.fecha = F.datum_s
    LOOP
        dbms_output.put_line('Padron št. :  ' || r.archivo);
    END LOOP;
    Or maybe you can process all results in one step, e.g. if you want to update a table based on the select.
    Regards
    Marcus

  • Sql count function in order by clause

    Post Author: krypton
    CA Forum: Data Connectivity and SQL
    Hi Guys
    Can i ask a quick question. I am trying to retrieve data remotely from a SQL Server via crystal reports.
    Within the Database Expert I have entered a SQL query to retrive the number of (call center) support calls raised by our customers:-
    Select `Primary_Company`, COUNT(`Calls`)From  `SPRT_Issue` GROUP BY  `Primary_Company`ORDER BY  COUNT(`Calls`) desc
    The customer's column is called 'Primary Company' and the calls they raise are in the 'Calls' column. the above is a normal sql query.
    However Crystal fails to run the query and generates an error message :-
    Failed to open a rowset. Details: 420: Driver&#93; Expected lexical element not found: <identifier>
    I dont understand why it wont run. In the ORDER BY clause if i replace field 'Calls' by the field 'Primary Company' then it works.
    I think the problem is that it wont accept the count function in the order by clause. which is what i want it to do i.e display the calls in descending order by each customer.
    Could someone tell me if there is a way around it.
    Thanks
    Krypton

    Post Author: krypton
    CA Forum: Data Connectivity and SQL
    Thanks Lynn
    I tried your suggestion. But there is one probelm.
    When i sort the data in descending order using the count(calls) field, the data is returned but the customer's name appears multiple times along with their calls raised.
    E.g, if customer Mark raised multiple calls i.e. 2, 5, and 10 calls, then the report will show
    Mark   2
    Mark  5
    Mark 10
    But is there a way to aggregate all the calls for mark and show them only once:
    such as Mark   17
    Thanks

  • Report SQL query problem

    Hi!
    I want to create a report with the script i copied at the bottom of this message. For some reason i get the following error:
    Error: Unable to describe SQL statement. Please correct it (WWV-13010)
    (WWV-)
    ORA-01001: invalid cursor (WWV-11230)
    ORA-00937: not a single-group group function (WWV-11230)
    Critical Error in wwerr_api_error.get_errors! SQL Error Message: ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-01001: invalid cursor (WWV-)
    Does anybody have a clue where this is coming from? It seems to me that there are no diffucult un-SQL like things in the script.
    Thanks in advance!
    SELECT rse.name||', '||rse.initials||' '||rse.prefix "Medewerker"
    ,dpt.name "Afdeling"
    ,sum(round(act.duration *24,2)) "Aantal uren"
    ,count(distinct(sht.begin_date)) "Aantal dagen"
    ,count(distinct(ill.begin_time)) "Aantal keer"
    FROM ros.ros_departments@ROSPROD dpt
    ,ros.ros_scenarios@ROSPROD sco
    ,ros.ros_activity_types@ROSPROD aty
    ,ros.ros_activities@ROSPROD act
    ,ros.ros_duties@ROSPROD dty
    ,ros.ros_illnesses@ROSPROD ill
    ,ros.ros_shifts@ROSPROD sht
    ,ros.ros_resources@ROSPROD rse
    WHERE rse.id = sht.rse_id
    AND sht.name = 'Z'
    AND sht.begin_date <= sysdate
    AND ill.rse_id = rse.id
    AND trunc(sht.begin_date) BETWEEN trunc(ill.begin_time) AND trunc(nvl(ill.end_time,sysdate))
    AND dty.id = sht.dty_id
    AND decode(sign(dty.begin_time)
    ,-1, sht.begin_date + 1
    ,sht.begin_date)
    >= to_date('10-01-2000 00:00','dd-mm-yyyy hh24:mi')
    AND decode(sign(dty.begin_time)
    ,-1,sht.begin_date + 1
    ,sht.begin_date)
    <= to_date('10-01-2001 23:59','dd-mm-yyyy hh24:mi')
    AND sht.begin_date >= to_date('10-01-2000 00:00','dd-mm-yyyy hh24:mi') - 1
    AND sht.begin_date <= to_date('10-01-2001 23:59','dd-mm-yyyy hh24:mi') + 1
    AND act.dty_id = dty.id
    AND aty.id = act.ate_id
    AND aty.name = 'Ziek'
    AND sco.sce_rsr_id = sht.sce_id
    AND sco.status = 'PUBLISHED' -- <> 'TRIAL' en 'PLAN'
    AND dpt.id = sco.dpt_id
    AND dpt.name NOT IN ('BEEK/VKL', 'BEEK/VLA','EELDE/VKL','EELDE/VLA','ROTTERDAM/VKL','ROTTERDAM/VLA','SIM','STO','RCN','XSurvey')
    AND rse.name = :MDWPARAM
    AND dpt.name = :AFDPARAM
    GROUP BY rse.name||', '||rse.initials||' '||rse.prefix ,dpt.name
    ORDER BY 2,1

    Hi,
    Please run this sql statement in the SQL session. This way you will get the line number where the problem is happening.
    The error seems to be because the column in the select is not in the group by clause.
    Thanks,
    Sharmila

  • SQL Verification Problem / Muse Form Issue (Server uses MySQL muse uses SQLite) I'm in desperate need of help

           Alright well here is my issue... I have been trying to fix it on my own for the past week non stop and I have finally came to a solid conclusion as to the cause of the issue.
       I always get the error "The server has encountered an error..." in red text when anyone tries to submit a form and also when I try and test it myself. This led me to test the server / site for compatibility or issues by using the test:
    mydomain.com /scripts/form_check.php
    I got the first two checks green (pass) and the third test threw a red check meaning I was having an issue with SQL verification. This then led me to days of trying to work with my hosting provider (one.com) trying to solve the problem and I was told that they use mySQL on their servers and that they couldn't do anything on their end to solve the issue. I read alot that we are recommended in this case to try and get our host to add the SQLite database to their server or whatever it is they would do, long story short I guess many people are able to ask their host to make SQLite work and most accept and add SQLite functionality to their servers but unfortunately my hosting provider doesn't want to do this and they said they were sorry and that I would need to either switch the script to work with mySQL or figure something else out...
       I took a lot of time building my site and I dont want to take the form out. I absolutely need it... I know many post on here saying "forms dont work, oh poop " or "adobe sucks I dont want to use business catalyst grrr" but I tried to find the source of the problem and I've successfully came to the conclusion that my issue is that my script wants to use SQLite but in order for my sites forms to work the server needs to have SQLite as well... My idea is that if I can configure the script and the site itself to use mySQL instead of SQLite the SQL verification will then not be an issue and my websites forms will function with no issues. I am curious if a member of the staff with adobe has experience with this particular issue and can help me out? or if a member of the adobe community has solved this problem? If not I am hoping that with the description I provided that someone with knowledge of mysql, sqlite or code in general could help me modify the script or write a new script that will allow the forms to work properly. I know its a long shot, I say that because this discussion is full of people who used muse in favor of dreamweaver because just like a large number of people in the muse discussion area, I'm a graphic designer, with plenty of computer experience, art and design skill and I am extremely familiar with photoshop. Muse is perfect in so many ways. In fact, like I mentioned above, I don't even have a complaint at this time about muse. I understand the form issue in this case, and I imagine in thousands of other users situations, is all just a matter of scripts and compatibility.. Its just a little issue between the SQLite scripts we are all given when we export our muse website and the SQL version our various hosting service may be using on their servers.
       Just incase I missed anything, to provide just a bit more info on the topic and myself for anyone who may be able to help:
    I can alter the text inside of the scripts easily if anyone happens to know any lines of code that easily solve this issue (making the muse contact forms, which are native to SQLite, functional on a server using mySQL)
    I was told one way I could make the forms work on a server using mySQL (or any version other than SQLite) If I were to make changes to adobe muses SQL version by converting the SQLite db to mySQL db (db = database)
    I am computer literate and I can take any directions necessary, I really just need to get this done, I really appreciate any help I can get!!
    Thank you in advance,
    Roy

    <?php
    If you see this text in your browser, PHP is not configured correctly on this hosting provider.
    Contact your hosting provider regarding PHP configuration for your site.
    PHP file generated by Adobe Muse CC 2014.1.6
    function formthrottle_check()
        if (!function_exists("sqlite_open"))
            return '1';
        $retCode ='5';
        if ($db = @sqlite_open('muse-throttle-db', 0666, $sqliteerror))
            $res = @sqlite_query($db, "SELECT 1 FROM sqlite_master WHERE type='table' AND name='Submission_History';",  $sqliteerror);
            if ($res == null or @sqlite_num_rows($res) == 0 or @sqlite_fetch_single($res) != 1)
                $created = @sqlite_exec($db, "CREATE TABLE Submission_History (IP VARCHAR(39), Submission_Date TIMESTAMP)",  $sqliteerror);
                if($created)
                    @sqlite_exec($db, "INSERT INTO Submission_History (IP,Submission_Date) VALUES ('256.256.256.256', DATETIME('now'))",  $sqliteerror);
                else
                    $retCode = '2';
            if($retCode == '5')
                $res = @sqlite_query($db, "SELECT COUNT(1) FROM Submission_History;",  $sqliteerror);
                if ($res != null and @sqlite_num_rows($res) > 0 and @sqlite_fetch_single($res) > 0)
                    $retCode = '0';
                else
                    $retCode = '3';
            @sqlite_close($db);
        else
            $retCode = '4';
        return $retCode;
    function formthrottle_too_many_submissions($ip)
        $tooManySubmissions = false;
        if (function_exists("sqlite_open") and $db = @sqlite_open('muse-throttle-db', 0666, $sqliteerror))
            $ip = @sqlite_escape_string($ip);
            @sqlite_exec($db, "DELETE FROM Submission_History WHERE Submission_Date < DATETIME('now','-2 hours')",  $sqliteerror);
            @sqlite_exec($db, "INSERT INTO Submission_History (IP,Submission_Date) VALUES ('$ip', DATETIME('now'))",  $sqliteerror);
            $res = @sqlite_query($db, "SELECT COUNT(1) FROM Submission_History WHERE IP = '$ip';",  $sqliteerror);
            if (@sqlite_num_rows($res) > 0 and @sqlite_fetch_single($res) > 25)
                $tooManySubmissions = true;
            @sqlite_close($db);
        return $tooManySubmissions;
    ?>

Maybe you are looking for

  • Doubts regarding db connection with encrypted password usage in sandbox

    Hi All, We have setup the db connection using configuration file. The configuration file contains db connection information including the encrypted password. Below are my doubts: 1. If we are going to import the ETL project in zip file directly into

  • Mail sending from different person's name. Help!

    Hi! This problem is a little confusing-I'll try to make it as simple as possible. I've gone through dozens of threads and still can't find an answer for this. I have my work email set up on a Macbook. I'm the only one who uses the Macbook. The addres

  • Rwrun reports stop working after a period of time using a job scheduler

    Hello, I am having a strange issue. We use either Control-M or Windows Task scheduler to run a VBS script that calls rwrun to generate multiple reports for multiple properties. Initially everything worked without issues then after about 2 months the

  • Maintenance optimizer transaction dont see product version for a solution

    Hi, I am having a very difficult time in understanding the concept of solution manager product system,instance,solution. Now, in Technical Administration >> Solutions >> I click on a solution, in the solution the product column is missing. Then it ap

  • Elements 12 startet nicht

    Ich versuche elements 12 über den Startbildschirm zu starten, das funktioniert nicht. Die Aktivitätsleiste (diese blau/weiße Linie) bewegt sich etwas und dann ist einfach Schluss. Wenn ich ein Bild direkt in elements öffne funktioniert es, aber dann