
silkfire
Members-
Posts
569 -
Joined
-
Last visited
Everything posted by silkfire
-
It's because of the PHP Math precision. It happens when the result is 0; 305.33(75340675450) - 305.33(7534067545065231111) There are hidden decimals in your number which PHP sees and uses them in the calculation. Round your answer to 2 decimals: $sum = round(7.50 + 6.45 + 12.90 + 12.00 + 13.00 + 0.61 + 32.00 + 4.00 + 27.00 + 18.00 + 10.88 + 129.50 + 92.94 - 100.00 - 38.25 + 76.80 - 305.33, 2);
-
The brackets are actually not needed but they allow you to insert an array element within a string. You can also write $txn[payment_amount] (without inner quotes).
-
Thanks a lot!
-
Hey all, If I have a number like this: 1245 then I want a '.' inserted at position -2: 12.45 how do I do that in the most simple and elegant way? 74342 -> 743.42
-
Echo mysql_error you can try to save it to a text file. Try, mate.
-
Well I didn't get any sufficient answers last time. I wanted to run a query on a subquery. How do you run an IN (...) on something that returns 2 columns, aye?
-
Dunno if I'll get much help here but thought I'd give it a try. I'm running a subquery which returns 2 columns, one with substance and one with status. I then want to run a query on this data set to ONLY get the substance (I need the status as a helper column but need to get rid of it to run an IN query). SELECT set.substance FROM (SELECT substance, (SELECT parameters.state FROM parameters WHERE products.vnr = parameters.vnr AND parameters.plnt = 'SE20' AND parameters.state <> 'passive') as state FROM `products` WHERE products.substance IN (SELECT substance_mapping.substance FROM substance_mapping WHERE dead <> 'yes') AND company LIKE '%company%') as set WHERE set.state <> NULL And get error Subquery returns more than 1 row. It is supposed to return multiple rows, why is MySQL complaining? I have aliases, so what's wrong with the query?
-
Fetch the RSS with cURL then load the string with simplexml_load_string.
-
Need help with XML data to populate tables...
silkfire replied to DeyBwah's topic in PHP Coding Help
I couldnt really understand that jQuery code; how does the plugin read in the items? If you can't answer that question I can't help you... -
Need help with XML data to populate tables...
silkfire replied to DeyBwah's topic in PHP Coding Help
Is your problem how to layout the XML file? Does the jQuery plugin read raw XML or JavaScript objects/arrays? To make it create an extra slide if items > 4 that's something you have to write in jQuery. -
You, sir, shouldn't be on these forums, you can't help out anyway just giving people useless replies. I said I had one price in every cell, what is it you don't understand? Anyway I solved it myself. And if I would want more than one price in a cell I would separate them with a delimiter. Don't tell me how to build tables, fenway.
-
Has anyone encountered this bug which had me banging my head against the desk all morning? In the beginning I registered a $GLOBALS['direction'] that equalled to a radio button value. Later in the script I declare a variable $direction that for some strange reason took the value of $GLOBALS['direction'] without me even writing so. So when i compared them they had the same value. As soon as I changed $direction to $directionx the script worked and the value wasn't "copied" to the $GLOBALS. What's up?
-
Why not? One price for each month.
-
Can you help me out guys? I now need to compare a previous price with a current one and the problem is when I compare Dec with January of a next year. (I can't do this with PHP because I need the result of this query to make another query). Let's say I want to compare these two rows (even if it's not just these two rows, it should check in the whole table): ID, year, Jan ............(months)............., Dec 40432329, 2011, .............................................45.32 40432329, 2012, 28.45............................................. How do I select all IDs where Jan 2012 is LESS than Dec 2010? Remember that on most months it will compare to same row, for example Sep 2011 with Oct 2011. Tried with subquery but it said subquery returned multiple results. Help!
-
Columns: id, year, Jan .... Dec
-
boy, you're persistent
-
I've got a table with columns id, year and the 12 months. How do I join the result set if I want to select Nov, Dec where year is 2010 and Jan where year is 2011? Without selecting Jan 2010 and Nov, Dec 2011?
-
With jQuery make an AJAX request for the change() event of the first dropdown: categories.php?cat=5 And that should echo a list with <option value="1">Frangrance #1</option> then you let jQuery insert the list into the second dropdown replacing its current contents.
-
Extracting data from particular attribute using simplexml
silkfire replied to gnrmatt's topic in PHP Coding Help
SimpleXML is truly simple: $xml->tripDetails->tripDetail[0]; You don't extract the contents by supplying attribute, you supply the order it is as a child to tripDetails, in this case zero-based first. -
Yes, you have to utf8_encode the string before you json_encode it.
-
Selecting members who's birthday is in the next month
silkfire replied to denno020's topic in PHP Coding Help
denno, strtotime converts an English date sentence into a date. You need to have 'first day of this month next month' instead of just 'next month' or '+1 month' because if you're on 31 January then +30 days will become March and you'll skip February completely. So what that does is first gives you 1st day of the month and then goes +30 days which guarantees not to skip month. The 'n' is a format that results in a month number 1-12 without a leading zero, a value that the MySQL MONTH() function understands. -
Selecting members who's birthday is in the next month
silkfire replied to denno020's topic in PHP Coding Help
First let PHP give you the next month: $month = date('n', strtotime('first day of this month next month')) Then use in MYSQL query: WHERE MONTH(birthday_date) = '$month' -
Oh thank you Adam! So you figured it out? I needed a table for currency conversion but let PHP generate all the combos (much faster, eh?). Thanks!
-
Hey all I've found some combination functions out there but they're not working really like I want. I have an array with some currencies: array('SEK', 'EUR', 'USD', 'GBP', 'DKK', 'NOK', 'ISK'); Now I want the function to generate an array with all possible pairs: array(array('SEK', 'EUR'), array('SEK', 'USD') ...) It must allow for the inverse form: EUR, SEK is different from SEK, EUR. But trash all pairs that are equal: SEK, SEK or EUR, EUR. Help me out?
-
UTF-8 problem with Echo when reading from .csv file
silkfire replied to foggykt's topic in PHP Coding Help
Fogg it really stood Euvari in the csv file, so that's something wrong with the spelning not with the source file. Were letters cut off in the screenshot too?