Darla
Members-
Posts
31 -
Joined
-
Last visited
Never
Everything posted by Darla
-
Thanks! That worked perfectly
-
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
-
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
-
Problem with special chars extracting from database in php
Darla replied to Darla's topic in PHP Coding Help
Here is the response for SELECT @@version: 4.0.24_Debian-10sarge2-log -
Problem with special chars extracting from database in php
Darla replied to Darla's topic in PHP Coding Help
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 :| -
Problem with special chars extracting from database in php
Darla replied to Darla's topic in PHP Coding Help
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. -
Problem with special chars extracting from database in php
Darla replied to Darla's topic in PHP Coding Help
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. -
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
-
yes, but only in the time period from the first/oldest date/hour in the database table and up to todays date/hour.
-
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.
-
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
-
[SOLVED] mysql: fetch average from multiple rows (both numeric and text)
Darla replied to Darla's topic in PHP Coding Help
Ah that worked nicely, thanks -
[SOLVED] mysql: fetch average from multiple rows (both numeric and text)
Darla replied to Darla's topic in PHP Coding Help
Never mind, I figured it out. It was an problem with the reference for some reason, when using $row[0] it worked -
[SOLVED] mysql: fetch average from multiple rows (both numeric and text)
Darla replied to Darla's topic in PHP Coding Help
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" -
[SOLVED] mysql: fetch average from multiple rows (both numeric and text)
Darla replied to Darla's topic in PHP Coding Help
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? -
[SOLVED] mysql: fetch average from multiple rows (both numeric and text)
Darla replied to Darla's topic in PHP Coding Help
Thanks both of you, just what I needed -
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
-
[SOLVED] Basic question: how to fetch variable from class?
Darla replied to Darla's topic in PHP Coding Help
That did the trick, thanks! -
[SOLVED] Basic question: how to fetch variable from class?
Darla replied to Darla's topic in PHP Coding Help
I have set it up to run php5 -
[SOLVED] Basic question: how to fetch variable from class?
Darla replied to Darla's topic in PHP Coding Help
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? -
[SOLVED] Basic question: how to fetch variable from class?
Darla replied to Darla's topic in PHP Coding Help
Hei Thanks both of you. The first answer did not return anything? The second one using $this worked Super! Darla -
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
-
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
-
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
-
[SOLVED] print_r of table - how to get the actual values into variables?
Darla replied to Darla's topic in PHP Coding Help
ok, yes arrays was what I meant Thanks again for helping, you saved my day!