Jump to content

DarkReaper

Members
  • Posts

    36
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

DarkReaper's Achievements

Member

Member (2/5)

0

Reputation

  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. Basically i want when i call the procedure to insert in a couple of tables new row/s with the needed values. I know how to do it, but i don't know why mysql doesnt accept my syntax :( The example you've provided doesn't work mysql outputs an error, phpmyadmin also but with an "empty" mysql error ... strange things happen ...
  4. 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 :)
  5. 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
  6. 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.
  7. 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.
  8. 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 :)
  9. How can i convert it again to my desired encoding? Example i send cp1251 encoding to ajax then when it converts it to utf8, i should convert it again to cp1251??? Am i right?
  10. 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?
  11. Thanks! These examples will do the job :)
  12. Lets suppose we have 2 tables with same structure, i want to move row with id=N from table1 to table2. How do i do that? I hope there is a simple way, because selecting from 1 -> inserting in 2 does not appear to be a good idea :)
  13. 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! :)
  14. 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
×
×
  • 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.