Jump to content

Barand

Moderators
  • Posts

    24,563
  • Joined

  • Last visited

  • Days Won

    822

Everything posted by Barand

  1. Do you mean SELECT YEAR(vrijeme), SUM(nabavna_cijena) as total FROM kalkulacija_stavke WHERE YEAR(vrijeme) > YEAR(CURDATE()) -2 GROUP BY YEAR(vrijeme)
  2. mysql> SELECT INET_ATON('199.119.180.52') as ip_num; +------------+ | ip_num | +------------+ | 3346510900 | +------------+ Therefore you can $ip_add = '199.119.180.52'; $sql = "SELECT * FROM ip2location_db11 WHERE INET_ATON('$ip_add') BETWEEN ip_from AND ip_to";
  3. You may find it useful to look at MySQLs INET_* and INET6_* functions http://dev.mysql.com/doc/refman/5.6/en/miscellaneous-functions.html#function_inet-aton
  4. Perhaps you should read the replies there.
  5. With the exception of some expected "deprecated mysql" warnings, your code ran fine when I tried it. Of course I had to change the database connection credentials.
  6. What determines that a particular client should move from position 5 to position 3? If it is a particular attribute that could be stored or calculated then you could use that in an ORDER BY clause and save yourself the effort of moving them manually.
  7. Following on from what QuickOldCar said, here's some code I put together many months ago. It should get you started. dbAdmin.php dbAdmin_ajax_c.php dbAdmin_ajax_p.php dbAdmin_ajax_t.php
  8. Why are you naming the options?
  9. The point of using a timestamp column is so you do not have to enter a datetime value - it is automatically entered. For example CREATE TABLE student ( student_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(30), created TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); INSERT INTO student (name) VALUES ('Barand'); Then mysql> SELECT * FROM student; +------------+--------+---------------------+ | student_id | name | created | +------------+--------+---------------------+ | 1 | Barand | 2014-12-12 14:54:09 | +------------+--------+---------------------+
  10. A couple of functions you should look at to get you started are file() explode()
  11. Note that when an image input is clicked, the x,y coordinates of the click in the image are sent. So if you have <form> <input type='image' name='imageButton' src='myimage.jpg'> </form> then this is sent back to your page Array ( [imageButton_x] => 4 [imageButton_y] => 11 )
  12. My mistake, the highest value is 2147483647 (2^31 - 1)
  13. So long as that "higher value" isn't higher than 2147483648
  14. Your syntax is wrong. UNION should be inside the quotes otherwise PHP assumes it is defined constant. When it then finds no definition then it assumes (correctly) that it meant to be a string value. $query = $query1 . " UNION " . $query2;
  15. The moral is "Don't use 'SELECT * '. Specify the columns you want."
  16. It's a SELECT query. It is not changing any data in your database.
  17. An explicit JOIN, as Ch0cU3r used, is more efficient and also better shows the structure of the query by separating the join conditions from the selection criteria in the WHERE clause. Also the purpose of prepared queries is to prevent injection from user-supplied data via variables. 'active' is a constant and therefore just include it in the statement SELECT ud.User_club_ID, ud.fname, ud.lname, ud.email, ud.club_No c.CLUBCODE, c.club_id FROM user_details AS ud JOIN club AS c ON ud.club_No = c.CLUBCODE WHERE c.club_id = ? AND ud.user_status = 'active' ";
  18. 1. I am not on your payroll and therefore do not respond well to comments like 2. I haven't a clue what you are talking about when you say
  19. A signed integer will hold up to 2,147,483,648 (ie 2^31)
  20. Use a JOIN to find the matching records instead of IN (SELECT ...) $tblsell = PRFX.'sell'; $tblskipped = PRFX.'skipped'; $sql = "SELECT * FROM $tblsell AS sel INNER JOIN $tblskipped AS sk ON sel.id = sk.id_ AND sk.uid = $u WHERE sel.draft = 0 ORDER BY sk.id" ;
  21. Use foreign keys with the ON UPDATE and/or ON DELETE actions set to CASCADE http://dev.mysql.com/doc/refman/5.6/en/create-table-foreign-keys.html
  22. Opening a file with "w" mode creates the file. $firstgroup=fopen('firstgroup.txt', "w");
  23. $firstgroup=fopen('firstgroup.txt', "w"); foreach ($groupone as $row) { fputcsv($firstgroup, $row); } fclose($firstgroup);
  24. use foreach() loops to iterate through your group1 and group2 arrays. use fputcsv() to write to the output files.
  25. You need to pass $conn to the function function graphdata($conn) { ... } print json_encode(graphdata($conn));
×
×
  • 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.