Jump to content

Darla

Members
  • Posts

    31
  • Joined

  • Last visited

    Never

Everything posted by Darla

  1. 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 this in php/mysql? Darla
  2. 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 from the listbox is displaying an average of the values based on date, when the user enter the page the initial values are displayed. My problem is when the user select from the listbox the table values change accordingly. But how do I get back to the original content/home of the page? I wish to use the same graphical element/same div tag. I tried creating a jsscript for going the other way, It worked except that the listbox no longer triggers the ajax.. Darla
  3. Here is the response for SELECT @@version: 4.0.24_Debian-10sarge2-log
  4. I use a server where I only have access to phpmyadmin, when I run the query there (in phpmyadmin) I get no DEFAULT CHARSET in the response :|
  5. When I run this query in phpmyadmin I get :TYPE=MyISAM, does this indicate the charset? I get no additional info except for field names etc.
  6. Hello Thanks for tips, but it seems id did not help. Regarding the ALTER TABLE yourtable DEFAULT COLLATE latin1; - do you think this will help? It is stored correct in the database you see, with SØ. It is when I fetch it in php it turns out wrong. Could there be something with mysql_fetch_array($result); or something? I have tried utf-8 decoding it but it seems it is not utf-8 code.
  7. Hello I have a database table where I have some values containing the norwegian 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 description ORDER BY count DESC LIMIT 1"; $result = mysql_query($sql); $descres= mysql_fetch_array($result); echo "description:" . $descres['description'] ; Here is an example of output - the value should have been "SØ" like it is in the database: "description:S�" Great if someone have some idea why. Darla
  8. yes, but only in the time period from the first/oldest date/hour in the database table and up to todays date/hour.
  9. One more comment as I did not describe this accurately: There should be possible to search for dates/hours where there are no records in the table, so it should be possible for the user to search for all hours/dates from the first entry to todays date.
  10. 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. Are there some good calendars where this can be done, or does someone have some other example with for instance dropdowns using php? Darla
  11. Never mind, I figured it out. It was an problem with the reference for some reason, when using $row[0] it worked
  12. Hello Did not seem to help either, I get no error messages. Here is the code: $result = mysql_query("SELECT AVG(age) FROM persons"); if (!$result) { die('Invalid query: ' . mysql_error()); } print_r ($result); while($row = mysql_fetch_array($result)) { echo $row['age']; } I tried the print_r just to see what happened and I got the output "Resource id #3"
  13. I have an issue with the AVG query - it works directly in mysql, but not from php (I tried with another query which worked from php so it is not the surrounding code). Do I have to escape something perhaps? $result = mysql_query("SELECT AVG(age) FROM persons"); Any ideas?
  14. 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 this? I guess I can use the AVG-function for the age, but how about the names? (From the above example the name michelle should stand out as the result) Darla
  15. Hello obsidian Thanks for info. I tried testing the script you gave but received an error: "Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE in testphp5.php on line 6" Seems to be an issue with this line: public getMyValue() { Any idea why?
  16. Hei Thanks both of you. The first answer did not return anything? The second one using $this worked Super! Darla
  17. Hello I have a class structure like this: class test{ function fetchsomevalues() { $testvalue="1"; } } In another class I wish to use the values in the variables from the class test, I include the class and create a new object of it: $fetcobj= new test; $fetcobj->fetchsomevalues(); How can i access the variable $testvalue from here? Darla
  18. One more thing: I can use a mysql table for temporary storage, will this be considered good caching even though it is not the traditional way of caching? Darla
  19. Hello I am wondering what is the best method for caching variables or arrays in php (for 3 minutes)? Or is it better to cache the whole page where these variables are? I see there are a few methods out there and I am uncertain what to use. Therefore I am wondering if someone here knows a simple/effective way of doing this as it is kind of a minor application I am building. Have a nice day! Darla
  20. ok, yes arrays was what I meant Thanks again for helping, you saved my day!
×
×
  • 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.