Jump to content

domagoj

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.spestudent.org

Profile Information

  • Gender
    Not Telling
  • Location
    Croatia

domagoj's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thnx, I think this should work.
  2. This does not work, that\'s why I\'m posting to this forum And I didn\'t understand the thing with 3 queries - you thought that I should use $result = mysql_query($query, $link) three times or just once? Because I was thinking that this should work if I executed just once the whole \"stored procedure\"
  3. it doesn\'t work in where clause, don\'t ask why, I don\'t know. With MSAccess and MSSQL it works, but MySQL doesn\'t support subqueries yet.
  4. it works fine inside the mysql, but the answer is here: $query = " DROP TABLE IF EXISTS tmp_table; CREATE TEMPORARY TABLE tmp_table (mjgod VARCHAR(20)) TYPE=HEAP; INSERT INTO tmp_table SELECT DATE_FORMAT(max(time), \'%M, %Y\') FROM clanci; SELECT clanci.*, tmp_table.* as najnoviji from clanci, tmp_table WHERE DATE_FORMAT(clanci.time,\'%M, %Y\')=tmp_table.mjgod; "; $result = mysql_query($query, $link) or die("No results for bulletin."); The only problem is that this code works inside mysql prompt, but when I try to execute multiple SQL statement string (above) from PHP it returns no results. Does anybody know is it possible to execute some kind of SQL procedure like above one from PHP?
  5. maybe something like this: select * from ids where extract(month from time) = extract(month from current_date) and extract(year from time) = extract(year from current_date);
  6. That\'s OK but \'03\' is not a constant, so i need to make a subquery which MySQL doesn\'t support. I think the beginning of the SQL code should be (maybe ) something like this: DROP TABLE IF EXISTS tmp_table; CREATE TEMPORARY TABLE tmp_table (mjgod VARCHAR(20)) TYPE=HEAP; INSERT INTO tmp_table SELECT DATE_FORMAT(max(time), \'%M, %Y\') FROM clanci; The second thing - did someone try to store several QUERIES in one PHP string and then execute? I\'ve got no results from database.
  7. I have a table with datetime column in MySQL database. If I wanted to select all rows with the newest month how I would do it? For example, table ids: +----+---------------------+ | id | mytime | +----+---------------------+ | 1 | 2003-03-01 21:03:34 | | 2 | 2003-01-01 20:33:34 | | 3 | 2003-01-01 21:03:34 | | 4 | 2003-03-01 02:03:34 | | 5 | 2002-03-01 15:13:34 | +----+---------------------+ from which I want to select all ids from March 2003.
×
×
  • 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.