| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
Comments:
<0> EDarkness, Start from http://php.net/tutorial <1> rapha: Very Likely <2> EDarkness: Although, if your *DATABASE* is saying it's not an int, that's probably because you quoted the value when p***ing it into the query. <3> What I did was use a single = so all values got changed into "" since I was checking for a blank value. <3> Changed it to == and everything is working. <2> EDarkness: Instead of using '== ""', try using isset() or 'strlen() > 0' <3> Okay. <3> Everything is working. Thanks a bunch for the help. It's 3am and I'm goin' to bed. You guys have a good one. :) <4> Im back with another question, I was wondering if and how you could add an x ammount of currency to a number every 24 hours? <4> or x ammount of time? <5> what do you need it for guitar <5> you could use cronjobs, but most of the time this is not needed <4> I am just working on money calculations for a future web rpg project. http://hashphp.org/pastebin?pid=6235 for an example. <4> I want to make it so every x ammount of time the total increases by x ammount <5> ask yourself if it's really needed to have the amount updated over an x-period of time <5> what about updating the amount of money when the user next logs in?
<5> if you keep track of users actions, you can store when a user left your page the last visit <4> How would you go about doing that? <5> when he logs in again, you'll know the current time <5> calculate how many periods have p***ed, translate this in a certain amount of money and update the account <5> easy as that <4> how would you determine when the user left? <5> this is far more efficient then updating for EVERY user EVERY 24 hours <5> when a user clicks a link you simply update a datetime field in the database <5> the last click is right before he left your website <2> I'm not convinced that Ruud's model is correct for your use case, guitarsauce. Do you want all users to have their value incremented at the same time? <5> i am :) <4> yes, that would be helpful, but i would also like to be able to change individual accounts <2> guitarsauce: If you want to update ALL accounts, a cronjob is the best way. <4> cronjob? <5> it's like windows task schedular <5> but for *nix <4> ok, gotcha. <6> :O <4> but i dont run on a *nix system <4> so could i just use the task schedular? <2> guitarsauce: Then use your platform's equivalent <5> then you can use the windows task scheduler <5> i still think you're going the wrong way here tho, but it's up to you ^^ <2> guitarsauce: Also, note that: "if ($_POST['foo'] == '') { $foo = 0; } else { $foo = $_POST['foo'] }" can be more easily spelled: "$foo = max(0, $_POST['foo']);" <5> hey, thats a nice one TML, thanks for that :) <2> Just make sure you put the 0 first. It coerces the type for the remainder of the comparison. <5> and do a isset first, but that should be clear :) <4> Is there any good PHP/Mysql books that any of you would recomend? <2> Ruud: You only need an isset() if you want your code E_ALL safe. max(0, NULL) does the right thing. <2> guitarsauce: php.net/manual <5> still, it's good practice <5> $foo = isset($_POST['foo']) ? intval($_POST['foo']) : 0; <4> ok, thanks everyone. <5> good luck <2> guitarsauce: Nearly every PHP book out there is a reprint of that content, with some author going on ad nauseum in between chunks of useful info. <2> Ruud: I'm of the opinion that my example delivers far more in readability than it may lose in...whatever it is that you're concerned about. <4> So no point to buy a book that just covers the core functions of PHP? <2> guitarsauce: No <5> we have php.net for that :) <5> well, the manual there <7> And dont buy a book that teaches you PHP4 <8> dont buy a book <8> its all on the internet for free <7> Advanced PHP Programming was a great book <7> I use it as a reference all the time <8> http://uk2.php.net/manual/en/ is also great <9> http://www.php.net/manual/en/ not everyone's in the UK :P <7> Yeah, but old George has some nice tricks up his sleeve ... I'd recommend it <7> http://www.amazon.com/gp/product/0672325616/103-5832694-8734238?v=glance&n=283155 <8> if you include() a file somewhere in a script, is it posible to un-include it? <10> whats a super dooper php gallery library? very simple.. so a photographer can upload a dir and have a customer using p***word access it? <11> gallery? <12> Bizzeh, how does that make sense? <10> mmm <8> Scorpmoon: give me a week and KATH is going to be ready <10> a week is due my deadline <10> not considering the bugs you want me to remove :) <5> lol <8> mybadluck: well, i wanna while(readdir()) { include(); do stuff with it; uninclude(); } <8> since the files ill be including have the same named functions <7> Bizzeh : Then thats just bad design
<7> Bizzeh : You need cl***es then <7> No files with functions <13> will: if ($foo != NULL) take more cpu resource than if (!$foo); ? <14> morning all :) <15> i got an arrMod[install][25]==1 and now intval(array_keys($arrMod)) returns 1 instead of 25. did i think something wrong? <7> krisp : I dont know about resources ... but !$foo is faster <14> kon: array_keys() returns an array of keys, you then trying to convert and array to an integer <15> oh <15> so if i just wanted the first key what would be the best way to do so <16> krisp: !== null is fastest <16> krisp: but they both do different things <17> hi.. can someone help me with a bit of smarty scripting ? <16> are you trying to see if the variable is set? use isset() <16> oghran; hell no, #smarty <17> :) just checking <17> thank you <14> kon: array_shift()? But have a look in the array section of the php manual, there might be a better way depending on your exact needs. <15> Lomat: thanks alot, yep i just saw this, in combination with reset() this is perfect for my need, thank you! <18> hi all can any body help me in file habdling for php? <16> lamers_inn: I don't know, ask the question and we'll find out :) <18> hi all can any body help me in file habdling for php? <19> Hmmm.. <16> lamers_inn: ... <5> that's his question <16> hehe <5> the answer is yes <19> Probably. <20> TML: Angel-SL|: is there some documentation on how you can change an app to work under PHP5, what needs to be changed and so? <16> rapha: have you spent more than half a second looking? <20> aidan: I haven't been able to find any documents specifically for this, and yes, I have spent more than half a second. Excuse me please if I offended you in any way, sir. <16> rapha: http://www.php.net/manual/en/migration5.php <20> Thanks <16> rapha: it's on the front page of the manual <20> aidan: Sometimes you're just blind ... isn't that why there's so many people in the world so that we can help each other with our blindness? <20> isn't that why there are, even <16> rapha: and please don't address your questions to specific people in the channel unless you're actually engaged in a conversation, you're more likely to get help and it's less annoying for those people (who are not even here) <16> rapha: yes, sometimes we're just blind, aslong as you've looked we don't mind :) <16> I found the link googling for "php4 to php5 migration" <18> i want to make a file on sever and want to make some checks according to that .txt file <18> here is an example <20> aidan: these specific persons had answered me before, although that was quite some minutes ago. I think after more than 10 years or so I should know the basic IRC rules. <18> the .txt file should save the number of times a web page is accessed <20> aidan: You have to know the word migration in order to be able to enter that search query. I'm not a native speaker. <21> hello... how do I discover the mime type of a file? i want to set the content-type header correctly before I send the data. I don't know if this is an apache question though.. <18> and at 100th time it should siplay some message <16> rapha: well you speak very well :) <18> can u help me <16> cb921: php.net/fileinfo <21> ah thanks <20> aidan: thanks :-) ... doesn't give me an endless vocabulary tho. <16> lamers_inn: file_get_contents, file_put_contents or fopen/fwrite/fclose with flock. <21> searching mime didn't give me any results <22> lamers_inn: file_get_contents() fputs() fopen() and $var++ <20> aidan: but thanks for the addition (to my vocabulary, that is) :-) <16> cb921: yeh it's a tricky one, the mime_content_type function has been deprecated and the new extension is quite tricky to use <16> rapha :) <22> fileinfo() didn't seem that hard to run ... <16> I couldn't get the damn extension to work for me <21> php.net/mime_magic ? <21> nm <22> I cheat. <22> urpmi php-fileinfo <16> oops <22> or was it urpmi php-pear-fileinfo <16> http://php.net/finfo <18> <16>: u there? <23> All: How can I disable that php always overwrite my meta-tag "Content-Type" <16> oops, that's wrong too <16> Kako: php.ini and httpd.conf both have options <22> In all honesty if you know the extension is the right type, just use a case on the extension. <22> It's probably not the 'right' way to do it. <23> aidan: default_mimetype = "text/html" <23> default_charset = "UTF-8" <23> but allways set it again to iso-8859-1
Return to
#php or Go to some related
logs:
WXU_2.6 not defined #perl what does $* field in awk means? pine Incomplete maildomain localhost #perl #perl #debian clever.mine.nu woopz #python
|
|