Jump to content

Koobi

Staff Alumni
  • Posts

    419
  • Joined

  • Last visited

    Never

Everything posted by Koobi

  1. why don't you give it a quick try and show me what you have and i will tell you what changes you need to make :) just follow these steps while referring to the manual: 1. use file_get_contents() to get the image 2. use fwrite() to write the image to the disk.
  2. you really should have created a new thread since it's a different topic. please do so the next time. try using [url=http://www.php.net/str_pad]str_pad()[/url] [code=php:0] <?php for($count = 0; $count <= 999; $count++) { echo str_pad($count, 3, '0', STR_PAD_LEFT) . "<br />\r\n"; } ?> [/code] i recommend using \r\n instead of just \n for cross platform compatibility. also, i believe there was a more efficient solution for this sort of thing (padding numbers) but i can't remember what it was. hope this suffices for now :)
  3. i'll assume you're on PHP4 so you already know the URI of the image? if you don't you can get the HTML of the page's URL file using [url=http://php.net/file_get_contents]file_get_contents()[/url] and the use [url=http://www.php.net/preg_match]preg_match()[/url] to match the value of the "src" attribute of the "img" tag. so assuming you have the URI of the image at this point, you use [url=http://php.net/file_get_contents]file_get_contents()[/url] once again with the URI of the image as an argument so that it gets the contents of that image. now you use [url=http://www.php.net/fwrite]fwrite()[/url] to write that image to your disk and use that image with an img tag in your HTML to display it. if you're on PHP5, [url=http://www.php.net/manual/en/function.file-put-contents.php]file_put_contents()[/url] is a more efficient alternative to fwrite() hope that answered your question :)
  4. [quote author=Crayon Violent link=topic=99076.msg390392#msg390392 date=1151826313] And here's my opinion to you and the others who have said this: "I didn't bother to read your post because..." if you aren't going to respect my arguments, then why should i bother to read/respect yours? I've addressed most of you guys' concerns in my posts. Had you read it, you would have possible counter-argued.  If you think that's rude, then good. I think it's rude to say you didn't bother to read my post but i'm gonna debate with you anyways. [/quote] you need to calm down and read my post properly. there's a difference between not bothering (as you put it) and wanted to read but not having the time or the state of mind to comprehend that especially when the person who had to read has been working a crazy week with some crazy deadlines at work. which is why i only read the part you quoted me on. [quote author=Crayon Violent link=topic=99076.msg390392#msg390392 date=1151826313] The "what works for one person may not work for another person, so karma can be misleading" argument is not valid, because like I said, there are a million different things to consider for each individual user. That was the point in my statement that the person asking the question is the most qualified to judge whether your solution worked or not.  do [i]you[/i] know everything there is to know about PHP and how to use it in the most efficient way possible, for every circumstance? Can [i]anybody[/i] honestly say that about themselves? The great thing about an open community like this, is this: clueless user = [b]CU[/b] helper = [b]H[/b] [b]CU[/b]: how can I get my webpage to show the numbers one through ten? [b]H1[/b]: do this: echo "12345678910"; [b]CU[/b]: thanks! that worked great! [b]H2[/b]: a more convenient way would be to do this: for($x=1;$x<11;$x++) { echo $x; } [b]CU[/b]: thanks again! [b]CU2[/b]: Okay i tried H2's method and it doesn't seem to work for me, here's my code: blahblahblah [b]H1/H2/H3/Hx[/b]: okay blahblahblah [/quote] i think you made my point for me. NOBODY knows everything about PHP (i don't think even Rasmus Lerdorf knows everything about it) which is why nobody should judge if an answer is right in the first place. i don't think  something like this should be on a forum unless it's absolutely necessary. [quote author=Crayon Violent link=topic=99076.msg390392#msg390392 date=1151826313] There is no system out there that will be 100% accurate. And yet we have systems implemented that are less accurate than others. You say that you do not like the karma system. You also say that you don't care for the post count system either.  You say that both are misleading and inaccurate.  But which would you say is closer to being a true estimate? Surely you must at least agree that the karma system is [i]significantly[/i] more accurate than the post count system, even though it's not accurate enough for your standards.  Therefore, why not petition to have the post count system removed, as well?  You say you don't agree with it, so if the karma system is not to be implemented, then let's petition to have the post counts removed as well. Every single reason you have given to not implement the karma system and lots more reason can be used to remove it. You've already argued it's invalidness. So if you really feel that way, let's officially petition to have the post count system removed instead. What say you? [/quote] in this particular case, accuracy is a relative term therefore i don't see it as plausible if i'm going to talk about karma being used for the reasons mentioned in the previous posts of this thread. i don't want to petition against anything. it is just my opinion. the admins do a good job running the site and it should boil down to their judgement even if it's against my opinion...as long as it doesn't hurt me, i don't really care, that's just how i am. i honestly don't have the time for a "petition" over such a small thing. this is the internet...it's a nice PHP community where we come to help people, talk to people with similar coding interests and also learn new tricks from others. the only thing i would change about this site is the colour scheme because it hurts my eyes :) but other than that, nothing else really bothers me. don't get me wrong, i have no problem with voicing my opinion or telling someone very bluntly if i disagree with them or fighting against something that i believe is wrong or immoral with everything i have...but this is the internet and having the post count on the side there doesn't REALLY bother me so i ignore it. maybe if i had more free time i would go on some sort of campaign/petition for something random...i don't know but that's not my priority right now. [quote author=Crayon Violent link=topic=99076.msg390392#msg390392 date=1151826313] Oh and also, there are stats links that show time online, and top 10 users by time online. This might lead people to believe these people are around to help and can help them too.  This too can be misleading, as someone could be on here 24/7 looking for help themselves.  We should petition to have that removed too.  I'm not being facetious. Let's petition to have all this misleading stuff removed.  [/quote] i don't know if you're trying to be cynical. if you are, there's no need to. this is a friendly discussion :) if you're not, i apologize for assuming that you were :) it's clear we have different ways of looking at things therefore i doubt we can ever come to an agreement on this. why don't we just leave this be or it can go on forever and i don't have the time to make long posts :) don't get me wrong there. i'm happy with whatever decision the admins make.
  5. [quote] [b]Koobi[/b] [quote] the karma feature is open to faults as well. if you have a lot of friends on this board, they might give you karma just because they're you're friends. [/quote] But in reality there are only a few people here who are regulars. By far the majority of users are random people who come in looking for help, and then leave.  In reality, the regulars are people who want to help other people.  If they are in that mindset already, then it is very unlikely they will go superficially raising other people's karma. In theory, I'd agree with you. But in reality, this is not a chat forum. It is a support forum, so that danger would be virtually non-existent. [quote] and people would ask questions because they don't know the answers. so how is it right to say that they can judge an answer is correct just because it works in their particular case when they didn't know the answer to begin with? [/quote] I'm not sure I understand you here. You seem to be answering your own question.  It's the right answer, because it works. Are there better answers? Maybe, maybe not.  But given the many scenarios out there, from php/sql versions, platforms they are run on, features enabled/disabled, structure of the rest of their script, etc.. etc.. too many to even name, the bottom line is that the only person really qualified to judge whether it worked or not was the person who asked the question in the first place.  [/quote] unfortunately i didn't have time to read your entire post so i'll just reply to what you quoted me on. i'll give you a rough example...it's not the best one but i'm sure you'll get what i mean. clueless user = [b]CU[/b] helper = [b]H[/b] [b]CU[/b]: hi, i have a problem. i would like to load an extension into PHP dynamically. how would i do this? [b]H[/b]: what's the name of the extension you want to load? [b]CU[/b]: it's called "myextension.so" [b]H[/b]: ok, then do this: dl('myextension.so'); [b]CU[/b]: thanks, that worked fine! you deserve karma for that one 2 months later, [b]CU[/b] switches to a windows based host and the extension won't load because on windows, the extension isn't generally .so, it's .dll or he might have been on a windows machine and loaded the dll version instead and then switched to *nix and it would still have broken. what [b]H[/b] should have told him to do is to use this: dl(myextension.' . PHP_SHLIB_SUFFIX); because that will work on any OS. while [b]H[/b]'s answer isn't totally wrong, it's also not totally right because it will only work under some circumstances. so now you have a majority of windows based developers asking that same question and [b]H[/b] keeps giving that same answer and gets his karma and it's possible he's not aware that *nix uses an .so extension. a *nix based user comes along with a similar problem but [b]H[/b]'s solution doesn't work for him...obviously. [b]H[/b] is going to insist his solution worked everytime before even though it didn't work for this *nix user. his advice would make all the difference in the world for a windows user and would be useless to a *nix user. so this *nix user would be utterly confused as to why the solution by a member with such a high karma rating doesn't work on his system. this *nix user decides it must be something else wrong with his code and spends ages trying to figure it out. now why does [b]H[/b] have such high karma to begin with? because it worked for some users in a particular environment. it's like asking one of the people who go put out in the first few rounds of American Idol to judge the competition. [quote] the bottom line is that the only person really qualified to judge whether it worked or not was the person who asked the question in the first place. [/quote] why do i think this argument is invalid? because you can do some things in many ways in PHP but not all of them will work all the time but how would a newbie who's not sure how to even use dl() know that? if it works for him, he will probably think it would work for everyone else. this is one of the reasons why i'm not a fan of karma. it can be misleading. this is just my opinion. i don't expect you to agree with it, just stating how i see it.
  6. [quote author=fruzzgle link=topic=99130.msg390244#msg390244 date=1151787910] Edit: After installing it, it didn't work. Do I have to be on IE or can I do it on firefox? [/quote] i believe on win, you have to either start apache manually or add it as a service. did you try that? and are you positive you followed the installation instructions word for word? and just to let you know, I'll move this to the [url=http://www.phpfreaks.com/forums/index.php/board,2.0.html]Apache Server[/url] after your next post because this really doesn't belong in the PHP Help section :)
  7. localhost should work...but you seem to be on a windows machine and hosts are generally on a *nix base. some things may vary in between a linux and windows based host depending on your coding practices. for example (this is the only one i can think of right now), if you're loading an extension, it's best to do this: [code=php:0] dl(myExtension.' . PHP_SHLIB_SUFFIX); [/code] but most people might do this: [code=php:0] //for win dl(myExtension.dll'); [/code] or this: [code=php:0] //for *nix dl(myExtension.so'); [/code] but using PHP_SHLIB_SUFFIX, PHP will determine the extension's file extension dynamically. so just make sure you practice good coding methods and you should be fine if you test it locally on your win or remotely (it would be a *nix machine in most cases)
  8. windows judges file types by extensions and if it doesn't recognize the extension or if the extension is missing, it would display that icon (default). what you're seeing it probably the installation instruction file minus the extension. it's probably a few KB's big and you can probably view it in notepad.
  9. actually i don't like the post count field being there either. i was about to mention that in my previous post but it seemed out of subject. but in the end its the admins decision. the karma feature is open to faults as well. if you have a lot of friends on this board, they might give you karma just because they're you're friends. and people would ask questions because they don't know the answers. so how is it right to say that they can judge an answer is correct just because it works in their particular case when they didn't know the answer to begin with? therefore i think the karma system isn't very accurate either. it just can be misleading and i don't think it's an appropriate feature for a community...depending on what you want the atmosphere of the community to be like. but once again, it's just my opinion based on the way i see things so it's natural for us to disagree on things like this :)
  10. i believe karma is something like a rating system right? for example, if some guy answered a question that i asked and i found it helpful, i would give him karma to up his ratings...something like that i don't know what the admins opinion on this is yet, but i'm frankly not too fond of it. this is a community right? not some place where we want to see who's answered more questions successfully or who knows more about something. in my opinion, in a community, eveyone should be seen as equals, even mods/admins (except they would have to do the basic managing of the site) just my opinion :)
  11. [quote author=Crayon Violent link=topic=96931.msg390035#msg390035 date=1151738944] oh for shame that a mod would not mention http://www.webhostfreaks.com/ !!!  :o [/quote] freedom of choice :)
  12. i'm moving this from the Web Server to the Miscellaneous section. i use www.dreamhost.com and i have nothing but great things to say about them :) Related topic: [url=http://www.phpfreaks.com/forums/index.php/topic,96876.0.html]PHP 5 and MySQL 5 hosting free or else cheap?[/url]
  13. I'm moving this from PHP Help to PHP Installation [quote author=mkozaq link=topic=99044.msg389884#msg389884 date=1151699715] i've tried with <?php phpinfo() ; ?>  function but nothing happens  .. Me is using xampp 1.5.3a  . [/quote] so what is your definition of "nothing happens?" blank screen? file downloads?
  14. as far as i know, the response to an HTTP request will have the headers so it can be displayed depending on your user agents capabilities. i would think this is a more Java related problem, right? since you mentioned that this hapenned inside a Java Applet. correct me if i'm wrong.
  15. also: [url=http://en.wikipedia.org/wiki/DHTML]Dynamic HTML[/url]
  16. i'm moving this from the PHP Help to the Miscellaneous section. i suggest you read the readme.txt for instructions. it would probably be more accurate and better detailed than most of us would care to explain when instructions are already available :) have a look at it, and if there's something specific you don't understand, let us know.
  17. yeah i think it's to do with the email address itself as well. have a look at the manual for the allowed formats: http://www.php.net/manual/en/function.mail.php so it seems like this: [code=php:0] $emailTo = '"julie" <julie@bits-uk.com>'; [/code] should be: [code=php:0] $emailTo = 'julie <julie@bits-uk.com>'; [/code]
  18. Glad you sorted it out :) I will move this topic to the Apache Server section because people are more likely to search for something like this in that forum.
  19. [quote author=neugi link=topic=98964.msg389663#msg389663 date=1151675193] Hi, version ist: Apache Version 2.0.54 best [/quote] ok thanks. did it occur to you that you should have perhaps tried looking for apache2.conf? :)
  20. what version of Apache are you on? I believe Apache 2 uses apache2.conf instead of httpd.conf it's generally located in /etc/apache2/apache2.conf [b]generally[/b], all configuration files are located in the /etc/ folder
  21. Thanks. Any progress on this yet? Is this possible?
  22. like Orio suggested, use sessions. you can also [a href=\"http://www.php.net/serialize\" target=\"_blank\"]serialize[/a] your data before you pass it via sessions.
  23. you're including the file via the HTTP protocol which means your web server (eg: apache) will parse the file which means what you're including will be some form of makrup like HTML and not PHP. if you want the raw PHP code, you would have to include it via the file protocol instead of http so that the PHP is not processed before it's included. eg: [code] <?php require ("/path/to/inc.johnluetke.net/site_status.php"); if (isRestricted("home")) {     include ("http://inc.johnluetke.net/unavailable.php");     die(); } ?> [/code]
  24. [!--quoteo(post=388526:date=Jun 27 2006, 08:52 PM:name=Wildbug)--][div class=\'quotetop\']QUOTE(Wildbug @ Jun 27 2006, 08:52 PM) [snapback]388526[/snapback][/div][div class=\'quotemain\'][!--quotec--] I need some clarification(s) first. 1. Are the author_* fields primary author, secondary author, etc., for a particular book? 2. Are you expecting to return a list for each author_*? 3. Could you post the SQL for your database structure? [/quote] 1. yes, they are 2. each author_* field will hold an integer in the BOOKS field since it's a foreign key but `AUTHORS`.`title` would hold a string value (one authors name). the `BOOKS`.`author_*` would point to `AUTHORS`.`author_id` 3. it's quite long so i decided to pastebin it: [a href=\"http://pastebin.housni.org/?show=6\" target=\"_blank\"]http://pastebin.housni.org/?show=6[/a] thanks so far :)
  25. Hi, My SQL skills are pretty weak so I was hoping someone could give me a hand here for a digital library web app that I'm creating. The current query: [code]     $_SYSTEM['query']['PENDING_BOOKS']     = "    SELECT `BOOKS`.`title`, `BOOKS`.`author_1`, `BOOKS`.`author_2`, `BOOKS`.`author_3`, `BOOKS`.`author_4`, `BOOKS`.`author_5`, `BOOKS`.`pages`, `REQUESTS`.`desired_prototype`, `TRANSACTIONS`.`cust_id`, `REQUESTS`.`delivery_date`, `REQUESTS`.`prototype_produced`, `REQUESTS`.`trans_id`, `MEDIUMS`.`title` as med_title, `CUSTOMERS`.`name`                                     FROM `REQUESTS`, `BOOKS`, `TRANSACTIONS`, `MEDIUMS`, `CUSTOMERS`                                     WHERE `TRANSACTIONS`.`trans_id` = `REQUESTS`.`trans_id`                                         AND `TRANSACTIONS`.`book_id` = `BOOKS`.`book_id`                                         AND `REQUESTS`.`production_status` = 'PEN'                                         AND `MEDIUMS`.`type` = 1                                         AND `MEDIUMS`.`medium_id` = `REQUESTS`.`desired_prototype`                                         AND `CUSTOMERS`.`user_id` = `TRANSACTIONS`.`cust_id`;"; [/code] As you can see, I select from 5 tables `REQUESTS`, `BOOKS`, `TRANSACTIONS`, `MEDIUMS` and `CUSTOMERS` The thing is, the some of those selected fields hold foreign keys to other tables which hold the actual data. I want my query to return `AUTHORS`.`title` for each of the `BOOKS`.`author_*` fields WHERE `BOOKS`.`author_*` == `AUTHORS`.`author_id` insead of just the foreign key. Could somebody help me add this functionality to this query? I could always do it via PHP but I'd rather gather all this data in one SQL query. here's an example of the output of my current query: [code] Array (     [title] => The Da Vinci Code     [author_1] => 11     [author_2] => 10     [author_3] => 12     [author_4] => 13     [author_5] => 10     [pages] => 56     [desired_prototype] => 1     [cust_id] => 10     [delivery_date] => 0000-00-00     [prototype_produced] => 0000-00-00     [trans_id] => 1     [med_title] => CD WAV     [name] => Housni ) [/code] Thanks for your time.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.