We're using MySQL to store some dates. I'm looking to show these as relative time periods in the user interface: 2 hours ago, 3 days ago etc. (Like Twitter does for the updates for example)
Is there a well-known way to accomplish this, or should I get creative with it?
Just to be clear, I want to transform:
07/26/2009 12:20 -> '2 days ...
Hi!
I would like to get the the number of arguments required for a stored procedure in MySql. Is that possible?
My first thought was to try
SELECT * FROM information_schema.ROUTINES;
but therein lies no information about the number of arguments as far as I can see. Next try was
SHOW PROCEDURE STATUS;
but that just seems to return...
Hello, I am trying to place items dynamically from a mysql database into a shopping cart(jcart). I have a page with 3 divs and all contain a form for the shopping cart(form code below). I am grabbing info from the database and placing it in the form.
The first div is getting the info correctly, but the second div displays the exact same...
Hi all
LEFT JOIN teams ON teams.id = (SELECT team_id FROM auth_users WHERE id = offers.user_id)
Gives me all the columns of the teams table, but converts everything to NULL.
LEFT JOIN teams ON teams.id = 1
works like a charm
When i do
SELECT (SELECT team_id FROM auth_users WHERE id = offers.user_id) as team_id
team_id will be ...
I'm having a problem trying to add an object to an object context in Entity Framework.
Here is the code :
//related object ids are retrieved from another context.
//since I thought the problem could be linked to object loaded in this context, I tried to
//close it and start on a fresh object context...
int idetab = currentEtab.Id;
lon...
I'm aiming to create a feature in my latest project preferably using PHP. When each user signs up they are going to input their postcode. Then hopefully I will be converting this to lat/long using Open Street Map.
Anyway, I want to be able to find out other users located near the current user.
I have seen a lot of people using the Have...
I have the following query:
mysql> explain SELECT Exhibition.venue_id, Exhibition.name, Exhibition.slug, Venue.name, Venue.slug, Venue.location_id, Venue.id, Exhibition.id FROM exhibitions AS Exhibition LEFT JOIN venues AS Venue ON (Exhibition.venue_id = Venue.id) LEFT JOIN temperatures AS Temperature ON (Temperature.ref = Exhibition.id...
Updating by @Cesar's request. Hope I understood what you want, if not, please revert. Quassnoi.
If I make an SQL query like this: SELECT * FROM TABLE_NAME WHERE b IN (2, 7) AND c IN (3, 9), can I assume that MySQL will match only pairs from elements with same number in each list?
That is, (2, 3), (7, 9), ...?
For example, suppose we h...
Hello there,
I'm confused when trying to fetch table rows in mysql using C++ with MySQL C API.
I can do it easily in PHP, just because C++ is a strongly-typed language so that we also need to take care of the dirty process..
This is how I done it in PHP
$data = array();
$i = 0;
$query = mysql_query("SELECT * FROM `my_table`");
while(...
This one's probably easy:
I have two variables:
$sender_id
$receiver_id
Those ID's are stored and assigned to a user in tblusers. I have no problem selecting one-at-a-time:
$data = mysql_query("SELECT * FROM tblusers WHERE usrID='$receiverID'") or die(mysql_error());
while($row = mysql_fetch_array( $data ))
{
echo $row['usrFirst...
I have text files with a lot of uniform rows that I'd like to load into a mysql database, but the files are not completely uniform. There are several rows at the beginning for some miscellaneous information, and there are timestamps about every 6 lines.
"LOAD DATA INFILE" doesn't seem like the answer here because of my file format. It d...
I'm making a site with PHP and MySQL. The big idea is that you can register and you can add objects to your profile. You can have only 1 profile, you can have multiple items(infinite, in theory) and each items can have multiple pictures(infinite, in theory).
I'm wondering how to best implement this in MySQL. I've had a very basic educat...
I am having trouble figuring out the best way to approach this problem,
I have two different list of items,
one in the DB, one not. Both list have
item ids and quantity, I need to merge
the two list into the DB.
My first inclination is to just pull all of the items out of the DB then merge the two list in the application logi...
As title says: How do I calculate a node's depth in a parent-child model?
I'll need the depth to, among other things, create the indent in my list (coded with PHP).
Thank you in advance.
...
I have a decent, lightweight search engine working for one of my sites using MySQL fulltext indexes and php to parse the results. Work fine but I'd like to offer more 'google-like' results with text snippets from the results and the found words highlighted. Looking for a php based solution. Any recommendations?
...
I have an array with zipcodes indexed by distance. now i need to select pizza shops
based on the zips, some thing like:
ziparray[]
foreach loop
SELECT * FROM location WHERE food='pizza' and zip='ziparray[]'
//do stuff
The zip array can grow up to 30 or 40 zips in time, which means 30 or 40 querys.
Is there a better way to do this? ...
Hello!
I'm trying to move some Excel-Data to MySQL, but having troubles with encoding.
What I did:
Data export from OpenOffice 3.1 as csv (utf-8 encoded)
Import to phpMyAdmin via file upload (Table encoding: '*utf8_unicode_ci*')
In phpMyAdmin's view mode, the data is displayed correctly (it is using utf-8 as charset):
<meta http-e...
Hey all people :-)
I think i did some nasty crap today...
I deleted the user (admin root) in phpmyadmin (XAMPP)
now I can't create new users.
Any idea how to fix, or should I just try re-install the hole XAMPP packet :-/
I use Leopard iMac.
/Willy
...
I want to write a query that will match up a string from one table with the closest alphabetical match of a string fragment within another table.
Given:
There are 2 tables, table 1 has a record with string "gumby". Table 2 has letters that start words: "g", "ga", "gam", "go", "ha", "hi".
Problem:
Because I don't have a "gu" entry o...
According to the MySQL documentation regarding Optimizing Queries With Explain:
* ALL: A full table scan is done for each combination of rows from the previous tables. This is normally not good if the table is the first table not marked const, and usually very bad in all other cases. Normally, you can avoid ALL by adding indexes that ...