Jump to content

jsimmons

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jsimmons's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Running: Windows Server 2003 WAMP with Apache 2.0.55, MySQL 5.0.21 and PHP 5.14 I have the following code: <?php class TestClass { private $a; private $b; public function __construct() { $this->a = 0; $this->b = 0; } public function is_active() { return ($this->a == 1); } public function is_loaded() { return ($this->b == 1); } } $testX = new TestClass(); if ($testX->is_active() && $testX->is_loaded()) { // do something } ?> All of this code is in the same file, but I'm getting this error (occurring on the line with the "if" statement): Fatal error: Call to a member function is_loaded() on a non-object in filename.php on line 23. What am I doing wrong?
  2. I went on the #PHP on IRC, and as I suspected, it was okay to just un-zip the files to the appropriate folder(s).  Problem solved.
  3. Ummmm, no.... PEAR is installed. I want to install some addtional PEAR modules (Image_Canvas, Image_Graph, etc al).  How do I install them?  There's nothing on the PEAR site (that I could find).
  4. [quote author=manianprasanna link=topic=107212.msg429814#msg429814 date=1157631990] Thanks for all those who replied. [/quote] You're not a programmer, are ya...  :/ Hostfreak has given you the answer (twice).
  5. [quote author=wildteen88 link=topic=107211.msg429789#msg429789 date=1157628480] This should be be fine: [code=php:0]$arow['mytext'] = "hello \n, how \r . \n  you \r\n?"; print str_replace(array("\r\n", "\r", "\n"), '', $arow['mytext']);[/code] No need for trim. [/quote] Just an old programmer's observation: The OP didn't mention whether there are no cr/lf characters embedded in the string. The OP didn't say he wanted the cr/lf characters translated to html. Given those facts, trim() is a perfectly viable recommendation since it trims the offending characters off the end of the string. [code=php:0]trim($text);[/code] If that is indeed all he wants, I think trim() presents a simpler and cleaner solution in the code.
  6. [quote author=manianprasanna link=topic=107212.msg429772#msg429772 date=1157626439] I would like to write a looping function. for example as below [code] loop(10) {     echo 'Please answer me'; } [/code] So that the above code would print 10 times ''Please answer me''. Actually the code looks similar to for loop, but the above code is not the actual functionality i need. The functionality i need is similar to the above code. So could anyone tell me that whether i can write a looping function. If yes then how? Please help me. [/quote] Here's a looping function to do what you specified: [code] <?php function loop($iterations) { for ($i = 1; $i <= $iterations; $i++) { echo "Please answer me"; } } // usage... loop(10); ?> [/code] The output on a web page will look like this: [code]Please answer mePlease answer mePlease answer mePlease answer mePlease answer mePlease answer mePlease answer mePlease answer mePlease answer mePlease answer me[/code] I'm almost sure that's not what you want, but hey, who am I to judge?  I now re-quote you: [quote author=manianprasanna link=topic=107212.msg429772#msg429772 date=1157626439] Actually the code looks similar to for loop, but the above code is not the actual functionality i need. The functionality i need is similar to the above code. [/quote] How are we supposed to devine the special knowledge we need to write your code for you? 
  7. How do I install PEAR modules on a WAMP box?  Do I just unzip the files to the PEAR folder?  The modules in question are the Image_* modules. Since it's apparently in permenant beta, there is not documentation at all.
  8. I couldn't even get php to work with IIS.  I went to Apache and haven't looked back.
  9. Oooohhhh.  I think I like that a lot. :)  Many thanks, oh great and powerful Oz...
  10. [quote author=Barand link=topic=105741.msg423465#msg423465 date=1156787782] However, v4 users are able to use functions and stored procedures with input and output parameters. Just [b]stored procedures that grab a result set seem to be a no-no.[/b] [/quote] Well, that just plain sucks.  I'd love to move all the sql stuff out of my classes and into the db where it belongs.  :/
  11. I hope I explain this okay... I want to present the user with table contents and give them the ability to do the following: - edit selected row(s) - delete a selected row - delete all rows Can someone recommend a report generator that can generate an html-based form/page, and that allows me to select what columns to show, etc, etc?  Preferrably, something cheap/free but equal in quality and features to packages costing thousands of dollars. :)
  12. I'm fairly new to PHP, but can't you just do something like this? class CYourClass {   blah blah... } class CMyClass extends CYourClass {   blah blah... } $myClass = new CMyClass; $yourClass = new CYourClass; $myClass = $yourClass; I would expect all of the CYourClass elements to be set in the $myClass object.
  13. I jumped into the deep end while the lifeguard was talking to some chick.  I learned mostly via the php.net web page.  Most of my problems/errors are typos, like the one I found yesterday - I have this class that contains an array called "massagedData".  Sometime during one of my furious coding sessions, this inadvertantly got changed to "managedData" in the class functions, and everything stopped working.  I was bench-blind, and it took me an hour to find out what I had done.  It's what you might call a forehead-slapper. For the record, PHP is a lot harder to do than C++.  At least with C++, the compiler tells you when you do stupid crap like that.
  14. </div>' should be </div>\'
  15. I'm at my wits end. Here's my tale of woe: 1) I'm running Windows 2003 Server/IIS6. (Let's try to avoid religious dicussions about running Windows instead of Linux - I need support for ASP.net 2.0, and Mono ain't there yet.) 2) I installed PHP 5.12 and have verified that it's working. 3) I installed Active Perl and MySQL 5.0, and verified that the mysql service is running. 4) I then installed phpMyAdmin 2.8.0.3, and ran the setup script. This i where my problem starts. 5) The PHP, Perl, and MySql folders are all in the windows system path. 6) I copied the file LIBMYSQL.DLL to both the \Windows\system and \Windows\system32 folders (despite the fact that the path setting should have been enough). 7) In php.ini, I have set the php extension path, and verified via phpinfo() that php is looking in that path for extensions via phpinfo() . 8) In php.ini, I have uncommented most of the extensions (including both php_msql.dll AND php_mysqli.dll). 9) I've verified through phpinfo() that php is using the php.ini file in the appropriate location. Depite all of the above, when I run phpMyAdmin I get the following error: "Cannot load MySQL extension, please check PHP Configuration" I've done everything I thought I needed to do, and I've been searching high and low for a solution. Can anyone help?
×
×
  • 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.