Search found 16 matches

by Darla
Sun Feb 18, 2007 11:00 am
Forum: PHP - Code
Topic: How to remove decimals in php (sql)?
Replies: 2
Views: 314

Thanks, cant believe I did not find this when searhing php.net... I must be tired.
Well, it works perfectly now :)
by Darla
Sun Feb 18, 2007 10:22 am
Forum: PHP - Code
Topic: How to remove decimals in php (sql)?
Replies: 2
Views: 314

How to remove decimals in php (sql)?

Hello I am wondering if there are any ways to remove extra decimals in php (or alternatively in sql)? I fetch aome average values from a table, and I wish to keep only one decimal or remove decimals entirely. Ex: 14.6154 should be 14.6 og just 14. Are there any "ready-to-use" functions for...
by Darla
Sat Feb 17, 2007 4:07 pm
Forum: PHP - Code
Topic: Php and ajax problem with getting back to original data in s
Replies: 3
Views: 271

I have tried the select both outside and inside the div. The select appears but with empty values (I use a javascript for loop to list up all 24 hours). I also have a calendar which appears as it should be but when I select a date nothing happens, the function to show average using ajax does not tak...
by Darla
Sat Feb 17, 2007 2:37 pm
Forum: PHP - Code
Topic: Php and ajax problem with getting back to original data in s
Replies: 3
Views: 271

Php and ajax problem with getting back to original data in s

Hello I am kind of a newbie at ajax. I have a little table displaying some variables, and listbox which triggers the ajax ->javascript->php page. The table displaying the variables is the placeholder (inside a div tag), the table values change upon selecting values here. The change when selecting fr...
by Darla
Fri Feb 16, 2007 3:04 pm
Forum: PHP - Code
Topic: Problem with special chars extracting from database in php
Replies: 2
Views: 654

Problem with special chars extracting from database in php

Hello I have a database table where I have some values containing the special letters æ, ø or å. Upon fetching them it seems Ø turns into a simple "?": $sql = "SELECT description, count(description) AS count FROM userdata WHERE datetime like '".$datetime."%' GROUP BY descrip...
by Darla
Thu Feb 15, 2007 6:51 am
Forum: PHP - Code
Topic: Calendar/dropdown for given set of dates/time
Replies: 3
Views: 386

Ok cool, do you know any simple calendar scripts which you can configure to display the given startdate and up to todays date?
by Darla
Thu Feb 15, 2007 6:29 am
Forum: PHP - Code
Topic: Calendar/dropdown for given set of dates/time
Replies: 3
Views: 386

Calendar/dropdown for given set of dates/time

Hello I have a database with some records, these records have been inserted with a datetime (ex:20070214202701 ). I wish that the user can search for records for a given time or hour for all dates/hours that are in the table. Even for times where there are no records in the table, so it should be po...
by Darla
Wed Feb 14, 2007 4:43 pm
Forum: Databases
Topic: Fetch difference between two timestamps in seconds
Replies: 2
Views: 408

Thanks, I'll try it out but am having some problems with my server now :(
by Darla
Wed Feb 14, 2007 4:08 pm
Forum: Databases
Topic: Fetch difference between two timestamps in seconds
Replies: 2
Views: 408

Fetch difference between two timestamps in seconds

Hello I have a database table where each record has a timestamp (created using the NOW() function perhaps CURRENT_TIMESTAMP is more correct to use?) I wish to make a simple query which compare timestamp of right now with the timestamp in the database and returns the difference in seconds. Is there s...
by Darla
Wed Feb 14, 2007 3:59 pm
Forum: Databases
Topic: fetch average from multiple rows (both numeric and text
Replies: 6
Views: 697

Did not work either it seems, get this error: #1111 - Invalid use of group function

However I got another one that works now, so problem solved:

Code: Select all

SELECT description, count(description) AS count FROM dataset GROUP BY description ORDER BY count DESC LIMIT 1
by Darla
Wed Feb 14, 2007 1:09 pm
Forum: Databases
Topic: fetch average from multiple rows (both numeric and text
Replies: 6
Views: 697

Thanks, it seems logical. I get a syntax error with this and I cannot see why though, here's the query i use: SELECT description FROM dataset GROUP BY description, ORDER BY COUNT(description) DESC, description LIMIT 1 I get a 1064 syntax error, according to mysql the error is here somewhere: 'ORDER ...
by Darla
Wed Feb 14, 2007 12:42 pm
Forum: Databases
Topic: fetch average from multiple rows (both numeric and text
Replies: 6
Views: 697

OK thanks, the AVE query is fine but you don't happen to have an example of how the count query could look? Would it also be possible to determine the most popular name even if there are double names like "Sue Anne"?
by Darla
Wed Feb 14, 2007 12:22 pm
Forum: Databases
Topic: fetch average from multiple rows (both numeric and text
Replies: 6
Views: 697

fetch average from multiple rows (both numeric and text

Hello Just wondering the best way to fetch average values from a table. I wish to fetch both the average age and the most commonly used name from a table which has the fields age name 21 michelle 15 sean 22 lisa 65 michelle 43 stan etc. Anyone have an idea what is the simplest and best way to do thi...
by Darla
Wed Feb 14, 2007 8:25 am
Forum: PHP - Code
Topic: Caching in php
Replies: 5
Views: 462

Thanks for this, I'll test it out. Here i see an entire file is cached. I thought of doing it like this alternatively (using a table): - Have a table with 6 values + a timestamp - Upon request: do a comparison in php between current time and the timestamp in db table - If the diff is less than 3 min...
by Darla
Wed Feb 14, 2007 6:32 am
Forum: PHP - Code
Topic: Caching in php
Replies: 5
Views: 462

Could you give me an example of what you mean by "caching output from dynamic pages"? I am fetching the data from a feed. I will maximum fetch data from the feed every three minutes, thus the caching. So far my application fetch data from feed and puts it into 6 variables/one array. Then t...