Derleek
Members-
Posts
297 -
Joined
-
Last visited
Never
About Derleek
- Birthday 11/30/2008
Profile Information
-
Gender
Male
-
Location
colorado
Derleek's Achievements
Advanced Member (4/5)
0
Reputation
-
Hi, I am developing on a server that I don't really have all that control over... I just started working for a Kiosk company about 3 months ago. I am used to developing on my localhost (MAMP) and porting it to my hosting company. I recently wrote a script that takes advantage of json_decode() and it appears the server I am working on does not support this method... I looked in phpinfo() and on my localhost it has "json support" whereas on this server there is no mention of json in the phpinfo(). The php versions are slightly different... 5.1.6 (json not working) Vs. 5.2.10 (json working) Was json support added between those versions? What do I need to get json_decode()/json_encode() working on this server @ work? Not all that good at this kind of stuff, I try to stay away from configuring anything and just stick to the code when I can... Thanks
-
IE/jquery compatibility, dynamically populating a select field
Derleek replied to Derleek's topic in Javascript Help
The script is breaking on 'options[0].trim()'. It appears there is some incompatibility with this JQuery method and IE. -
Hi, Not sure where to even start on this one... I have a function that takes a select input field ID and populates it with an array of options. function populateSelect(selectId, options){ options = options.split(';'); selectId.find('option').remove().end(); $.each(options, function(i, option){ option = option.split(':'); selectId.append($('<option />').val(String(option[0].trim())).text(String(option[1].trim()))); }); } An example call would be... selectId = $("#dateBar_graphSelect"); var options = 'Pie:Pie;Column:Column'; populateSelect(selectId, options); The error I'm getting in IE 8 is... Object doesn't support this property or method (selectId.append line) Considering that line has several methods being called I have NO IDEA what could be going on here. Even a tip on debugging situations like this would do a world of good for me!! -thanks in advance for the help
-
Simple AJAX function causing difficult debug in chrome/safari
Derleek replied to Derleek's topic in Javascript Help
mysql_close($conn) needed to be executed before I returned 0 or 1... duh! -
Hi, I have a *very* simple jQuery/ajax script for a membership driven website. The script just checks to see if the user entered info, validates it against my database and returns 1 for a failed login attempt, and 0 if the username/password match. The function works perfectly when I run it w/o calling it from ajax. **Firefox:** everything works. **Chrome/Safari:** The query is locking everything up. When I enter valid info, there isn't even any record of a request going out (in the developer tools chrome/safari supply). When invalid info is entered the request is going out and it returns 3. I'm pretty baffled by this. Is it a "sandbox" issue? as I understand it Firefox and Chrome/safari handle XHR differently... Although don't ask me how. I am running a base install of MAMP. Could this be something on my developer environment? (I will be testing it on a live server later this afternoon) Here is my AJAX call and the php script it is calling. AJAX: $.ajax({ //I've also tried.. //url: '_modules/php/session.php', url: 'http://localhost/current/100TradeJack/httpdocs/_modules/php/session.php', type: 'POST', cache: false, timeout: 5000, data: "method=login&"+$('#loginTop').serialize(), error: function(XMLHttpRequest, ajaxOptions, thrownError) { alert("ERORR!!"); }, success: function(response){ alert(response); if(response == '0'){ alert("log user in"); window.location.replace("http://localhost/current/100TradeJack/httpdocs/trading.php"); } else if(response == '1') { alert("invalid username/password"); } else { alert("ERRROOR!"); } } }); session.php: $connection = mysql_connect("localhost","root","root") or die(mysql_error()); mysql_select_db("sandbox_members", $connection) or die(mysql_error()); if($email){ $email = mysql_real_escape_string($email); } else { return 1; } if($password){ $password = mysql_real_escape_string($password); } else { return 1; } $query = "SELECT * FROM users WHERE username='". $email . "' AND password='". $password ."'"; $result = mysql_query($query); if($row = mysql_fetch_array($result)){ return 0; } else { return 3; } //if it gets to here the username/password combo was incorrect or was not found in the db return 1; mysql_close($connection);
-
so... it does work... I needed to divide the dp.Discount_Percent by 100.... it was throwing the whole query off... Delete?
-
I am attempting to join several tables and I'm unclear on what the correct syntax would be. I think I am just not connecting the tables correctly... Tables: Transaction: Transaction_id item_id 1 1 2 2 3 1 4 3 Transaction_Discount: Transaction_id code 1 123 2 222 //type - 0=DiscountPercent | 1 = DiscountValue Discount: code type 123 0 222 1 DiscountPercent: code percent 123 50 DiscountValue: code value 222 2.00 Item: item_id 1 2 3 Item_Discount: Item_ID code 1 123 2 222 Item_Transaction: Transaction_ID Item_ID 1 1 2 2 3 1 4 3 Schedule: Item_ID Price 1 10.00 2 15.00 3 5.00 I would like to calculate the adjusted price when a discount is applied. Here is my query so far... SELECT *, CASE WHEN td.Transaction_ID IS NULL THEN sch.Price WHEN td.Transaction_ID IS NOT NULL AND d.Discount_Type = '0' THEN sched.Price - (sched.Price * dp.Discount_Percent) ELSE sched.Price - dv.Discount_Value END PriceDiscounted FROM ItemTracker_dbo.Transaction t LEFT JOIN ItemTracker_dbo.Purchase p ON t.Transaction_ID = p.Transaction_ID LEFT JOIN ItemTracker_dbo.Item it ON p.Item_ID = it.Item_ID LEFT JOIN ItemTracker_dbo.Schedule sch ON sch.Item_ID = it.Item_ID LEFT JOIN ItemTracker_dbo.Transaction_Discount td ON t.Transaction_ID = td.Transaction_ID LEFT JOIN ItemTracker_dbo.Discount d ON td.Discount_Code = d.Discount_Code LEFT JOIN ItemTracker_dbo.DiscountPercent dp ON dp.Discount_Code = d.Discount_Code LEFT JOIN ItemTracker_dbo.DiscountValue dv ON dv.Discount_Code = d.Discount_Code LEFT JOIN ItemTracker_dbo.Item_Discount id ON id.Discount_Code = d.Discount_Code LEFT JOIN ItemTracker_dbo.Item iq ON id.Item_ID = iq.Item_ID LEFT JOIN ItemTracker_dbo.Schedule sched ON sched.Item_ID = iq.Item_ID The database relations go as follows (at least I think): Transaction -> Transaction_Discount -> Discount -> discountPercent & DiscountValue Transaction -> Transaction_Discount -> Discount -> Item_Discount -> Item -> Schedule Transaction -> Purchase -> Item -> Schedule Do I need to add some conditional logic for the two different discount_types? I'm not sure If I am selecting from the tables in the right order or not... I really am in a bit over my head here, If you look at the logic in the query it should be easy to see what I'm getting at. The query executes and pulls the first condition perfectectly (if no discount was applied). Although I am getting NULL for entries that do have a discount applied. kudos to anyone who stuck with this long post, it's much appreciated.
-
here is a MUCH different view. I think this might be more accurate (unfortunately...)
-
the browser trends in 2009 - according to w3schools.... IE (6/7/8)[/td]ChromeFirefoxSafari -8.5%+6.2%+2%[td]+.9% Good to see...
-
Exporting a spreadsheet to XML gives a pretty good idea on how to go from XML -> Excel. He's actually approved the pear excel conversion class... It's a pretty easy extension. Although, I am having (conceptual) problems transferring the data returned by my AJAX queries to the PHP script to export to excel... it'll fall into place soon though =)
-
yes, he is a developer. His main concern is that he does not want to be tied into something that can go away. His Fear: We start to rely on an extension -> The project dies -> we find a bug -> our stuff breaks and we can't get support. Understandable... For bigger extensions. I don't think PEAR is going away any time soon so that one should be fine. It looks pretty light-weight too.
-
my boss is a turd... He won't even accept PEAR lol
-
can you just use the file manipulation commands in PHP and save the file as a .xls?
-
Hi, I am looking to output one column of data in a MySQL DB to an excel file. Is there a way to go about doing this w/o installing a plugin?