-
Posts
24,563 -
Joined
-
Last visited
-
Days Won
822
Everything posted by Barand
-
Do you mean SELECT YEAR(vrijeme), SUM(nabavna_cijena) as total FROM kalkulacija_stavke WHERE YEAR(vrijeme) > YEAR(CURDATE()) -2 GROUP BY YEAR(vrijeme)
-
IP2Location Database IPv6 conversion to IP Number Decimal
Barand replied to brentman's topic in MySQL Help
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"; -
IP2Location Database IPv6 conversion to IP Number Decimal
Barand replied to brentman's topic in MySQL Help
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 -
Perhaps you should read the replies there.
-
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.
-
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.
-
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
-
Why are you naming the options?
-
Create Table with TIMESTAMP and MYSQLI Query
Barand replied to MatthewPatten's topic in PHP Coding Help
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 | +------------+--------+---------------------+ -
Take data from .txt file and display on HTML5 website
Barand replied to coly01's topic in PHP Coding Help
A couple of functions you should look at to get you started are file() explode() -
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 )
- 3 replies
-
- clickable image
- html to php
-
(and 1 more)
Tagged with:
-
My mistake, the highest value is 2147483647 (2^31 - 1)
-
So long as that "higher value" isn't higher than 2147483648
-
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;
-
The moral is "Don't use 'SELECT * '. Specify the columns you want."
-
It's a SELECT query. It is not changing any data in your database.
-
mysqli prepared statements on tables joined by a common value
Barand replied to ajoo's topic in MySQL Help
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' "; -
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
-
A signed integer will hold up to 2,147,483,648 (ie 2^31)
-
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" ;
-
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
-
Opening a file with "w" mode creates the file. $firstgroup=fopen('firstgroup.txt', "w");
-
$firstgroup=fopen('firstgroup.txt', "w"); foreach ($groupone as $row) { fputcsv($firstgroup, $row); } fclose($firstgroup);
-
use foreach() loops to iterate through your group1 and group2 arrays. use fputcsv() to write to the output files.
-
You need to pass $conn to the function function graphdata($conn) { ... } print json_encode(graphdata($conn));