OLG
Members-
Posts
50 -
Joined
-
Last visited
Never
Everything posted by OLG
-
Hi guys, Just a really simple problem here to do with typecasting, however I don't seem to be able to solve it myself. The background is that i am attempting to access a dynamic XML file from a website for the game EVE Online, the data of which i convert into a SimpleXML object. If I attempt to do a basic addition involving the players attributes and implants: $result = ($characterData->result->attributes->intelligence + $characterData->result->attributeEnhancers->intelligenceBonus->augmentatorValue); They will not add because they are strings - so I then typecast them to integers or floats - and the value of intelligence and augmentatorValue simply becomes 1 - and hence the incorrect values (when they should be 9 and 4, for example) Your help would be greatly appreciated in this matter.
-
Hi guys, I'm in a little of a dilemma and i am unsure what to do on this one. Basically i have a drag and drop script for an image and what i would like to be able to do is to drop the image onto a div layer and then get the ID of that div layer once i've dropped it. Is this possible and if so could you direct me to some hints? Thanks
-
yes, there is a problem with your WHERE clause, one of the variables isn't defined or doesn't match anything in the database.
-
Hey, Not so much as a request for help as a discussion with people on handling security with sessions. At the moment, im setting a session var to 0 or 1 to check if they are logged in (not secure at all) Anyone wanna offer how i can make it more secure? Since i know you can screw with sessions easily. The problem i'm seeing is balancing server load/performance against performing regular MySQL checks to make sure User Session Data is Valid. Any Advice?
-
I'm not actually sure, i've just changed over to a Plesk Server (8.1.1, using Virtuozzo, so i guess not) and am now having problems (its an older MYSQL Version) its arranged YYYYMMDDHHMMSS (Year, Month, Day, Hour, Minute, Seconds) strtotime returns -1, so i guess its telling me to go blow a fish right? I might just do a regular expression match, use some backreferences and re-organise it and just leave it like that, can't be assed to screw around with a timestamp.
-
Yes, i did know about the date format, but it keeps throwing out the wrong dates I don't think its 2038 quite yet
-
Hey guys, time for me to be the noob now (as if that ever changed ) How would i go about formatting a timestamp like this from my MYSQL DB: 20070720111445 Into something nice and coherent such as: 20th of July 2007 HH:MM Thank you, Adam
-
Read this tutorial http://www.phpbuilder.com/columns/rod19990601.php3 Then you will understand what you have to do.
-
I take it you have included the file and then instantiated a new instance of ticker include("ticker.php"); // just for an example $ticker = new ticker; Then you actually need to run the function you are after. $ticker->update_calc(); // for example.
-
I'm a nooblet at Classes, does PHPFreak have a tutorial? (Only ever used Classes in Python myself)
-
No, i took it straight from the comments section on the PHP.net manual reference from wordwrap - I've used it before, so i knew it worked
-
That is correct wordwrap($reply, 70, "<br />\n"); ^^ exactly the same usage as the function above
-
Give this function a whirl instead <?php function breakLongWords($str, $maxLength, $char){ $wordEndChars = array(" ", "\n", "\r", "\f", "\v", "\0"); $count = 0; $newStr = ""; $openTag = false; for($i=0; $i<strlen($str); $i++){ $newStr .= $str{$i}; if($str{$i} == "<"){ $openTag = true; continue; } if(($openTag) && ($str{$i} == ">")){ $openTag = false; continue; } if(!$openTag){ if(!in_array($str{$i}, $wordEndChars)){//If not word ending char $count++; if($count==$maxLength){//if current word max length is reached $newStr .= $char;//insert word break char $count = 0; } }else{//Else char is word ending, reset word char count $count = 0; } } }//End for return $newStr; } ?> Use it exactly the same way
-
Or else, Simply get a lovely piece of software called Regexbuddy
-
<?php $lines = file('dates.php'); $POSTDATE = $_POST["dateinput"]; // Loop through our array, show HTML source as HTML source; and line numbers too. foreach ($lines as $line_num => $line) { list($date, $timeone, $timetwo, $scriptname) = explode(",", $line); if($date == $POSTDATE) { echo ""; } else { echo "Date: ".$date."<br>"; echo "Departure Time: ".$timeone."<br>"; // I assume echo "Arrival Time: ".$timetwo."<br>"; echo "Script: ".$scriptname."<br>"; // Dunno if you really need this, but what the hell } } ?>
-
What line are you trying to remove?
-
PHP - Calculation of results from multi choice questions
OLG replied to stevepb's topic in PHP Coding Help
I for once agree with Yesideez, Your after javascript for what you want, not PHP -
Cygwin is a Linux-like environment for Windows. It uses A DLL which acts as a Linux API emulation layer providing substantial Linux API functionality. However, i don't think it will do what your after. Additionally, you might take a look at AceaXe Plus
-
You are doing this right? $VAT = int(($costpermonth/100)*17.5);
-
Parallel Processing is not supported in PHP You can however fork a process using the PHP CLI (assuming you're on a nix box) Here is a tutorial on that: http://www.electrictoolbox.com/article/php/process-forking/
-
It isn't good practice to do it. I'm not going to get into a coding language semantics debate with you.
-
If you don't want the print_r bit, then remove it????? Yes, i also knew this Yesideez, i regularly do it in MySQL statements.
-
I'll leave you with two statements and a comment echo "You don't echo $variables like this"; echo "You echo ".$variables." like this"; What isn't your script doing?