• Content count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About smus

  • Rank
  1. But hypothetically, if we take, for example, time constant from PHP that contains fixed date and time value, then set an interval and place it to a "perpetual" cycle - we will be able to make it, isn't that possible? Or it is too complicated?
  2. I know, it's pretty common question, but I wonder if there is a way to schedule a PHP script to be executed periodically (with some intervals) without using server utilities, such as Cron?
  3. I need to create a search in a field where there are several delimiters, such as commas, brackets and slashes. I used FIND_IN_SET parameter when there was just single commas, but it doesn't find a substring when I add more delimiters as a search rule: SELECT * FROM field WHERE FIND_IN_SET ($searchquery, searchfield) > 0 SELECT * FROM field WHERE FIND_IN_SET ($searchquery, REPLACE(searchfield, '\', '')) > 0 I've connected the second query to the first using OR
  4. Thank you, dsonesuk! The main thing is that it works! Your information was very helpful, especially in 9th post. Appreciate your help!
  5. Thanks again! Your version is good, but I've decided instead to correct some HTML display while request is processing, to simplify the task. Now there's an additional <td> </td> after each informational <td> (even at the end of a row). And my script removes the last <td> before the array reversal and after it adds new <td> at the end of the table(so that the table will have the same view if you toggle it once again). There are just <td> </td> filling the rest of the space in case if there are 2 results. I think I have to somehow add fixed width to them or give <tbody> 66% of width of the table.
  6. Thank you very much! It works well, but there is a mistake with HTML display. It turned, the table structure is a bit more complicated: there's an additional <td> </td> between the main td's (td's that hold an information), so when, for example, number of results equal 6, the overall number of td's is 10: <table> <tr><td>1</td><td> </td><td>2</td><td> </td><td>3</td></tr> <tr><td>4</td><td> </td><td>5</td><td> </td><td>6</td></tr> </table> But when the row is not full, there is an additional <td> </td> at the end of it (9 td's instead of 8): <table> <tr><td>1</td><td> </td><td>2</td><td> </td><td>3</td></tr> <tr><td>4</td><td> </td><td>5</td><td> </td></tr> </table> So it looks not right when I reverse it. I guess, I would need somehow to exclude the last td, if the tr contains less than 3 td. I can apply to main td via class(".td"), so I'm not sure if this code would work: if ($(".td").len % 3 <> 0) { $("").empty(); }
  7. In order not to reload a page and send another query to the server
  8. Right, I just wanted to know if it's possible (using JS or JQuery). The task is slightly different: I'm showing the results in a table with a random number of <td>s, depending on the query; there are 3 <td>s in each <tr>. I need to reverse the order of <td>s in this table without sending additional queries. The initial order is: <table> <tr><td>1</td><td>2</td><td>3</td></tr> <tr><td>4</td><td>5</td><td>6</td></tr> </table> I need: <table> <tr><td>6</td><td>5</td><td>4</td></tr> <tr><td>3</td><td>2</td><td>1</td></tr> </table>
  9. Allow me to ask more theoretic question: for example, I've got usual PHP+MySQL search that gets some information from database. I've typed some searching values, submitted the form and got some results. Now I need to sort them onclick, for instance, alphabetically, not repeating mysql-query to the server (on client side), is it possible to make it simply using JavaScript (not AJAX)?
  10. I would be glad if there were integers or decimals, but this is not my code. I was given the task just to add sorting without adding changes to the table. And I've just found the solution. That space was a hex 'C2' symbol and the ORDER BY section have to look like this: ORDER BY CAST(REPLACE(price, X'C2A0', '') as signed)
  11. The table contains goods and their prices. The type of price field is TEXT, but I need it to be showed from the smallest price to the highest (as INT). CAST takes thousands and literally "stops" sorting before spaces. The output of the query is: price CAST (price AS signed) 8 791 8 8 791 8 8 082 8 9 374 9 9 823 9 10 186 10 12 698 12 12 257 12 13 959 13 14 920 14 14 463 14 15 132 15 16 117 16 16 023 16 16 606 16
  12. I was also trying to replace spaces: SELECT REPLACE (column, ' ', '') AS P FROM table WHERE ORDER BY CAST(column AS signed) SELECT REPLACE (column, ' ', '') AS P FROM table WHERE ORDER BY column*1 Result is the same
  13. Something with the DB field itself, because I've checked the same SQL queries SELECT * FROM 'table' WHERE ORDER BY CAST(column AS signed) SELECT * FROM 'table' WHERE ORDER BY ABS(column) SELECT * FROM 'table' WHERE ORDER BY column*1 in phpmyadmin and they sort the field this way: 8 791 8 791 8 082 9 374 9 823 10 186 12 698 12 257 13 959 14 920 14 463 15 132 16 117 16 023 16 606 The type of the field is TEXT and it seems to me the second element of each new thousand starts to be sorted from right side, not the left.
  14. I've tried to modify this query, but it's no good: SELECT * FROM column... ORDER BY CAST(column as signed) ORDER BY ABS(column) ORDER BY column*1 I wonder if there are other ways to sort text values as numbers?
  15. Here's the file run.php