Jump to content

DarkReaper

Members
  • Posts

    36
  • Joined

  • Last visited

    Never

Posts posted by DarkReaper

  1. okay another problem ... (the above one i've solved using drop function before the create, obviously my alter syntax is wrong) ... but the following error occures now:
    [code]
    create function naemi ( _carid int, _egn char(10), _price float, _ime char(100), _familiq char(100)) RETURNS char(255)
    begin
    declare returncheck timestamp;
    select datanavryshtane into returncheck from clients where carid=_carid order by datanavryshtane asc limit 1;
    if (datanavryshtane = '0000-00-00 00:00:00') then
      return 'Not returned'
    else
      return 'returned'
    end if;
    end
    [/code]

    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'return 'Not returned'
    else
      return 'returned!'
    end if;


    I guess my if conditions are wrong ... but its a standard if function .. i've checked the manual ... any ideas why is this not working????
  2. hi, there i have the following problem:
    i have a stored function which i want to alter so i do this:

    [code]
    alter function naemi ( _carid int(10), _egn char(10), _price float, _ime char(100), _familiq char(100)) RETURNS timestamp
    begin
    declare returncheck timestamp;
    select datanavryshtane into returncheck from clients where carid=_carid order by datanavryshtane asc limit 1;

    return returncheck;
    end[/code]

    but it returns the following error:
    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '( _carid int(10), _egn char(10), _price float, _ime char(100), _familiq char(100' at line 1

    i have changed the delimiter to //, also all of the needed tables in the function exists. I just dont get it ... why would an error occur ... help!?
  3. Thats all. :) This was just a test to see if i can even create a procedure ... one more odd thing to report is that when i do this:
    CREATE PROCEDURE tst()
    BEGIN
    END;

    - no error occures and the procedure is created.
    But when i add even the simplest select/insert etc. query between the begin and end i get a query error ... please if someone knows why this is happening help me out :)
  4. Well the topic says it all :) i have mysql 5.0.26 and i cant use
    CREATE PROCEDURE
    CREATE FUNCTION
    i've tried with CREATE VIEW and it worked. So i guess ... HELP?! :)

    Here is the result of an example simple procedure from the mysql manual

    CREATE PROCEDURE simpleproc ()
      BEGIN
        SELECT COUNT(*) FROM log;
        END;

    -- result:
    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT COUNT(*) FROM log' at line 3
  5. I have 3 tables. Each of them contains information for a specified period of time by the column "time".
    I want to print for example the information from the 3 tables for yesterday/2 weeks ago or any other date i want.
  6. My last problem is that i have 3 tables, and i need the data from them to be merged by this sql query.

    The tables are as follows uniques, impr, vis. I need to extract the same data at the same time from them, with 1 query. I know how to do it with multiple queries but i dont like that way, its too uniefficient.
  7. Hello i have a table with structure:
    [code]
      `id` int(10) NOT NULL auto_increment,
      `site_id` int(10) NOT NULL default '0',
      `time` int(10) NOT NULL default '0',
      PRIMARY KEY  (`id`),
      KEY `site_id` (`site_id`)

    [/code]

    My problem is that i want to select all entries by days. My date cell is time, and its unixtime stamp. I know how to select the entries from today ... but i want to group them by all the days available.

    [code]SELECT count(id) as total FROM uniques WHERE site_id=2 GROUP BY TO_DAYS(FROM_UNIXTIME(TIME));[/code]

    This code returns all the entries from today. Because of the "TIME" code. I've tried also:

    [code]SELECT count(id) as total FROM uniques WHERE site_id=2 GROUP BY TO_DAYS(FROM_UNIXTIME(uniques.time));[/code]

    But the result was the same. Helppp :)

    Short version: I have the table from above, i want to select all entries grouped by days. My time stamp is the unix default and its stored in the cell -> time.


    --------------------


    WHOOPS! My bad. I've forgotten to cycle though the returned rows ... sorry the
    [code]SELECT count(id) as total FROM uniques WHERE site_id=2 GROUP BY TO_DAYS(FROM_UNIXTIME(uniques.time));[/code]
    Does the trick. Case closed :)
  8. Hello i am having a problem with ajax and php encodings ... i have a string encoded in cp1251 in a php variable, i save it to a file (using ajax and php), then with ajax i read it from the file and display it ... but only screwed up characters appears ...

    The strangest thing is that if i type a message (input box, again cp1251 encoding) and then handle it to be saved to a file and display it, everything is okay ...

    Do you have any ideas why is this happening?
  9. Hello there, i have a problem i need help with ;)

    I have a page on it are many links. I need when a user clicks on one of them all of the links should be disabled (or atleast links with the same name/group), so that the information is submitted correctly. Right now if a user clicks 2 times the information gets half way done and some important stuff is losed in the process. Or if there is a way to prevent the multiclicking using php ... enything! HELP! :)
  10. i understand your idea but how can i set the key if i cant carry the data on a separate storage for each window. + i dont have a submit/post on every page. Thats why i am asking is there a way to carry this key via the browsers headers or some other way
  11. Orio, cookies are shared. This means that if i change 1 cookie var, every window will read the new value on the next request. Rendering this method quite uneffective.

    I want to limit them to 1 window so i can prevent cheating in an online game.

    I want to identify each tab with unique id ... the problem is that i dont know how, nor if its possible ... :)

    The best thing that i've comed up with is to get the browser PID but ... i dont think this is implemented in php
  12. @Orio: what will happen when the 2 different users are the same :) i mean 1 user opens different windows :) ... I think nothing because cookies are shared.

    @GingerRobot: But still i wont do as what i want. 1 and no more windows/tabs should be active at every moment. If a second ones open ... the previous should invalidate. But i just cant identify each browser/tab as unique :(
  13. @Daniel0: Well this sounds good but what if i close the window?? I get locked out from the account :( ....

    @onlyican: same for you :)

    I am thinking of someting like this:

    1st user 1st window logs -> do its stuff
    1st user opens 2nd tab/window and logs again -> if login already exists invalidate the previous login
    1st user 1st window -> clicks and gets an invalidation message
    1st user 2nd window -> continues without problems.

    But cant seem to think of a way to use this technique :)
  14. Hi there ;) i am trying to limit my users to only 1 active login per user.
    Here is what i have done so far:
    1. Login -> update session_id in the mysql db with the new one generated from the session_start()
    2. User account -> first check if session_id is equal to mysql session id. If not -> force logout.

    This worked for different browsers. But if i use 2 same browsers for example IE or FF the session stays the same and again they can log as much times as they want :( ...

    Any ideas how can i do this? If i can identify each browser no matter if its the same or not maybe will work?!
  15. Okay here is what i have in theory:
    A list of users.
    1. If a user clicks on another users name mysql inserts a row in the db saying that the users requests lets say "chat".
    2. set a session var to the row id for the 1-st user.
    3. The second users sees that its attention is requested and clicks on the above users name, mysql update-s the row acccoudingly.
    4. set a session var to the row id for the 2-nd user
    5. Both users do their "chat".

    So far so good. But if both users click at the same time 2 rows get inserted (sometimes), usually the 2 sessions vars should be the same but they are not since mysql inserted 2 rows and the 2 vars are different, and the whole module gets to hell cous one user thinks it is "chatting" with someone as is the other, but in fact noone cant see the other couse the 2 rows in the db kinda kill functionallity.

    In short 2 rows exist but there should be only 1.

    Dont know if you understood me ...

    *notice: i say "chat" because i cant think of a word to fully classify it.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.