Sponsored Content
Top Forums Web Development Notes with Ravinder on Badging System Development Part II Post 303028189 by Neo on Tuesday 1st of January 2019 12:42:18 PM
Old 01-01-2019
Hey Ravinder,

Your fancy query is broken... even I I put xxxxx as the field in the query, I get the same wrong answer:

Code:
mysql> SELECT TIME_TO_SEC(TIMEDIFF(NOW(), FROM_UNIXTIME('xxxxx')))/(3600*24) AS 'join_time' FROM user WHERE userid =1;
+-----------+
| join_time |
+-----------+
|   34.9583 |
+-----------+
1 row in set, 2 warnings (0.00 sec)

Code:
mysql> SELECT TIME_TO_SEC(TIMEDIFF(NOW(), FROM_UNIXTIME('WHAT_THE_F')))/(3600*24) AS 'join_time' FROM user WHERE userid =1;
+-----------+
| join_time |
+-----------+
|   34.9583 |
+-----------+
1 row in set, 2 warnings (0.00 sec)

This is why I write SQL queries that a 12 year old can understand. LOL

Yours looks really clever, but is broken.

I kindly suggest you rewrite your query to perform the logic outside of the SQL query; but it is up to you. I will wait for your next attempt.

Thanks and good try!

PS: You might earn your Dev Ops Team Badge sooner than I thought .. Haha
 

3 More Discussions You Might Find Interesting

1. What is on Your Mind?

New Badging System - Badges Prototype Beta 1 (Badges Only)

Today I mapped out the new badging system using FA icons, Beta 1 in no particular order except a 6 x 8 grid: https://www.unix.com/members/1-albums215-picture991.png The prototype HTML code for this layout: <style> .fa-badge-grid { font-size: 1.5em; } .row { ... (38 Replies)
Discussion started by: Neo
38 Replies

2. What is on Your Mind?

Status of Badging System - Beta 1

Dear All, Here is the current status of the badging system: The Beta 1 phase of the new badging system is close to completion. 42 prototype badges have been "allocated" 6 prototype badge slots are held in reserve The "alert you have new badges" prototype is running and is currently... (4 Replies)
Discussion started by: Neo
4 Replies

3. What is on Your Mind?

Badging System: UNIX.COM Bug Hunter Badge (New)

I have moved the bug badge out of reserve and into the main stream. Basically, I will assign a color level like the others, based on who has made a good actionable bug report for UNIX.COM. "Good" means screenshots, links, and even details from web dev tools our the HTML source code. So far,... (0 Replies)
Discussion started by: Neo
0 Replies
CUBRID_UNBUFFERED_QUERY(3)						 1						CUBRID_UNBUFFERED_QUERY(3)

cubrid_unbuffered_query - Perform a query without fetching the results into memory

SYNOPSIS
resource cubrid_unbuffered_query (string $query, [resource $conn_identifier]) DESCRIPTION
This function performs a query without waiting for that all query results have been complete. It will return when the results are being generated. PARAMETERS
o $query -A SQL query. o $conn_identifier -The CUBRID connection. If the connection identifier is not specified, the last connection opened by cubrid_connect(3) is assumed. RETURN VALUES
For SELECT, SHOW, DESCRIBE or EXPLAIN statements returns a request identifier resource on success. For other type of SQL statements, UPDATE, DELETE, DROP, etc, returns TRUE on success. FALSE on failure. NOTES
Note The benefits of cubrid_unbuffered_query(3) come at a cost: you cannot use cubrid_num_rows(3) and cubrid_data_seek(3) on a result set returned from cubrid_unbuffered_query(3). EXAMPLES
Example #1 cubrid_unbuffered_query(3) example <?php $link = cubrid_connect("localhost", 30000, "demodb", "dba", ""); if (!$link) { die('Could not connect.'); } $query = "select * from code"; $result = cubrid_unbuffered_query($query, $link); while ($row = cubrid_fetch($result)) { var_dump($row); } cubrid_close_request($result); cubrid_disconnect($link); ?> PHP Documentation Group CUBRID_UNBUFFERED_QUERY(3)
All times are GMT -4. The time now is 10:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy