php-general Digest 1 Jul 2006 17:41:07 -0000 Issue 4216

Topics (messages 239038 through 239056):

Re: ONE PAGE CONNECTS MANY DATABASE
        239038 by: BBC
        239040 by: BBC
        239043 by: chris smith

IMAGECOPYRESIZED(); DOESN'T WORK...
        239039 by: BBC
        239042 by: chris smith

Re: global class instance
        239041 by: sempsteen
        239044 by: sempsteen
        239047 by: chris smith
        239052 by: chris smith
        239056 by: Larry Garfield

Re: mysqli_stmt::bind_param(), Number of variables doesn't match number of 
parameters in prepared statement
        239045 by: gg15

Re: Quick Question re: Windows/Linux PHP
        239046 by: chris smith
        239051 by: Jochem Maas

Re: working on a template system...
        239048 by: Martin Marques

Re: Templates, PHP Frameworks, and DB Abstraction?
        239049 by: Martin Marques
        239050 by: Martin Marques

Re: Sad PHP Poem
        239053 by: tedd
        239054 by: tg-php.gryffyndevelopment.com
        239055 by: Ryan A

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Yes I'm using MySQL and the DataBases I mean are in different servers 
but the problem is I don't know how to set the host.
All input will be very helpful...

----- Original Message ----- 
From: "Brad Bonkoski" <[EMAIL PROTECTED]>
To: "BBC" <[EMAIL PROTECTED]>
Cc: "PHP" <php-general@lists.php.net>
Sent: Friday, June 30, 2006 11:07 AM
Subject: Re: [PHP] ONE PAGE CONNECTS MANY DATABASE


> Yes.
> For Mysql..
> http://www.php.net/manual/en/function.mysql-connect.php
> 
> -B
> 
> BBC wrote:
> 
> >Hi again..
> >
> >I'm wondering is it possible to make one page which connects to many
> >DataBase?
> >
> >If it's possible please tell me where can I get the references?
> >
> >Thank
> >
> >                     Best Regards
> >============BBC============
> >                     **o<0>o**
> >
> >  
> >
> 

--- End Message ---
--- Begin Message ---
Yes I'm using MySQL and the DataBases I mean are in different servers 
but the problem is I don't know how to set the host.
All input will be very helpful...

----- Original Message ----- 
From: "Brad Bonkoski" <[EMAIL PROTECTED]>
To: "BBC" <[EMAIL PROTECTED]>
Cc: "PHP" <php-general@lists.php.net>
Sent: Friday, June 30, 2006 11:07 AM
Subject: Re: [PHP] ONE PAGE CONNECTS MANY DATABASE


> Yes.
> For Mysql..
> http://www.php.net/manual/en/function.mysql-connect.php
> 
> -B
> 
> BBC wrote:
> 
> >Hi again..
> >
> >I'm wondering is it possible to make one page which connects to many
> >DataBase?
> >
> >If it's possible please tell me where can I get the references?
> >
> >Thank
> >
> >                     Best Regards
> >============BBC============
> >                     **o<0>o**
> >
> >  
> >
> 

--- End Message ---
--- Begin Message ---
On 7/1/06, BBC <[EMAIL PROTECTED]> wrote:
Yes I'm using MySQL and the DataBases I mean are in different servers
but the problem is I don't know how to set the host.
All input will be very helpful...

Read the documentation, it's all there.

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
I thought I have typed this function correctly, and I didn't know why my
browser couldn't run these script :
<?php
$filename = 'test.jpg';
$percent = 0.5;
header('Content-type: image/jpeg');
list($width, $height) = getimagesize($filename);
$newwidth = $width * $percent;
$newheight = $height * $percent;
$thumb = imagecreatetruecolor($newwidth, $newheight);  //1*ERROR
$source = imagecreatefromjpeg($filename);              //2*ERROR
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width,
$height); //3*ERROR
imagejpeg($thumb);
?>
and the error output is : "call to undefined function"
btw, I'm using PHP 4.1.1. Is there any possible that my PHP version can not
run those script?
So, what is the best solution for my problem..?

                     Best Regards
============BBC============
                     **o<0>o**

--- End Message ---
--- Begin Message ---
On 7/1/06, BBC <[EMAIL PROTECTED]> wrote:
I thought I have typed this function correctly, and I didn't know why my
browser couldn't run these script :
<?php
$filename = 'test.jpg';
$percent = 0.5;
header('Content-type: image/jpeg');
list($width, $height) = getimagesize($filename);
$newwidth = $width * $percent;
$newheight = $height * $percent;
$thumb = imagecreatetruecolor($newwidth, $newheight);  //1*ERROR
$source = imagecreatefromjpeg($filename);              //2*ERROR
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width,
$height); //3*ERROR
imagejpeg($thumb);
?>
and the error output is : "call to undefined function"
btw, I'm using PHP 4.1.1. Is there any possible that my PHP version can not
run those script?
So, what is the best solution for my problem..?

PHP doesn't have the GD library installed or loaded.

Create a phpinfo page:

<?php
phpinfo();
?>

there needs to be a big "GD" section.
--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
i don't want to:
   - declare global $foo,

there is a mistake. it was not global $foo, it is global $a
:)

--- End Message ---
--- Begin Message ---
hi all,
i wonder if there is a way of creating an instance of a class and
reach it direcly from any scope in PHP4. basically what i want is:

class a
{
  function print()
  {
     echo 'sth';
  }
}

$a = new a();

and use this "a" instance from anywhere ex, in a function that is a
method of another class.

class b
{
  function print()
  {
     $a->print();
  }
}

i don't want to:
  - declare global $foo,
  - use pre-defined $GLOBALS variable,
  - or use a::print

thanks.

--- End Message ---
--- Begin Message ---
On 7/1/06, sempsteen <[EMAIL PROTECTED]> wrote:
hi all,
i wonder if there is a way of creating an instance of a class and
reach it direcly from any scope in PHP4. basically what i want is:

class a
{
   function print()
   {
      echo 'sth';
   }
}

$a = new a();

and use this "a" instance from anywhere ex, in a function that is a
method of another class.

class b
{
   function print()
   {
      $a->print();
   }
}

i don't want to:
   - declare global $foo,
   - use pre-defined $GLOBALS variable,
   - or use a::print

Then you're out of luck.

$a doesn't exist inside class b, how is it supposed to know what $a is ?

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
On 7/1/06, chris smith <[EMAIL PROTECTED]> wrote:
On 7/1/06, sempsteen <[EMAIL PROTECTED]> wrote:
> hi all,
> i wonder if there is a way of creating an instance of a class and
> reach it direcly from any scope in PHP4. basically what i want is:
>
> class a
> {
>    function print()
>    {
>       echo 'sth';
>    }
> }
>
> $a = new a();
>
> and use this "a" instance from anywhere ex, in a function that is a
> method of another class.
>
> class b
> {
>    function print()
>    {
>       $a->print();
>    }
> }
>
> i don't want to:
>    - declare global $foo,
>    - use pre-defined $GLOBALS variable,
>    - or use a::print

Then you're out of luck.

Actually you could pass it in:

function print(&$a) {
 $a->print();
}

but thats going to cause you lots of pain if you call it a lot (ie you
forget to pass it in everywhere).

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
It sounds like your only other option is a singleton, which works only if 
you're comfortable having only one instance of a, ever.  The following code 
also only works in PHP 5.

class A {
  static obj;

  static instance() {
    if (! self::obj instanceof A) {
      self::obj = new A();
    }
    return self::obj;
  }
}

class B {
  function print() {
    $a =  A::instance();
    $a->print();
  }
}

(Possibly a syntax error in the above, but hopefully you get the idea.)

On Saturday 01 July 2006 04:56, sempsteen wrote:
> hi all,
> i wonder if there is a way of creating an instance of a class and
> reach it direcly from any scope in PHP4. basically what i want is:
>
> class a
> {
>    function print()
>    {
>       echo 'sth';
>    }
> }
>
> $a = new a();
>
> and use this "a" instance from anywhere ex, in a function that is a
> method of another class.
>
> class b
> {
>    function print()
>    {
>       $a->print();
>    }
> }
>
> i don't want to:
>    - declare global $foo,
>    - use pre-defined $GLOBALS variable,
>    - or use a::print
>
> thanks.

-- 
Larry Garfield                  AIM: LOLG42
[EMAIL PROTECTED]               ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

--- End Message ---
--- Begin Message ---
No it is not empty. But I think I found the bug in the bugtracker...

http://bugs.php.net/bug.php?id=31037

Sorry, but with such a bug in the feature nobody can use it. Even if I am able to fix it on my local machine (but actually I was not able to do so until now), whats about my webspace? Maybe I do not have access to the console, so I cannot exchange any libs...

The prepared statements are definitely a nice-to-have, but under this conditions, stay away from them!

I will use mysqli_real_escape_string, like I have done with the old functions and just hope for some slight improve in performance ... but I think not even this is given with the new extension. Sorry, but I have not seen much of the "improved" in the functions (beside OOP ^^).


Best Regards, Ulrich



chris smith schrieb:
On 7/1/06, gg15 <[EMAIL PROTECTED]> wrote:
I wanted to use the prepared statements of mysqli, but the following
problem occured:

If I just use one parameter everything works fine
$prep = $this->mysqli->prepare('INSERT INTO guestbook (Von, Datum)
VALUES (?, NOW())');
$prep->bind_param('s', $this->Von);

but if I try to use two
$prep = $this->mysqli->prepare('INSERT INTO guestbook (Von, Betreff,
Datum) VALUES (?, ?, NOW())');
echo $prep->param_count; // echos 2
$prep->bind_param('ss', $this->Von, $this->Betreff);

I get an error
Warning: mysqli_stmt::bind_param() : Number of variables doesn't
match number of parameters in prepared statement in ...

Is $this->Betreff empty? I wonder if its having issues with an empty var..


--- End Message ---
--- Begin Message ---
On 7/1/06, Beauford <[EMAIL PROTECTED]> wrote:
Hi,

I'm just curious, because I come across this from time to time.

Why does the code below work on Windows and not on Linux. PHP is 5.0 on
Linux and 4.4 on Windows (still can't get 5 on Windows). The code at the
very bottom is how I got it to work on Linux. Also, why is it with the same
setup I can't call a function within a function in Linux, but can in
Windows. Sorry I don't have the error, but something about calling a static
function. Would this be a difference between OS's or with the different
versions of PHP?

You'll have to narrow down what you're having issues with before
anyone will take a look. Is it the regex? Is it lines x -> y?

Of course you can call a function within a function in linux. We can't
help debug that without at least the code and the error.

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
Beauford wrote:
> Hi,
> 
> I'm just curious, because I come across this from time to time.
> 
> Why does the code below work on Windows and not on Linux. PHP is 5.0 on
> Linux and 4.4 on Windows (still can't get 5 on Windows). The code at the

what stops you from installing php5 on windows? - it's not like it's very 
difficult.

> very bottom is how I got it to work on Linux. Also, why is it with the same

ah yes good of you to point out which line(s) you changed.

> setup I can't call a function within a function in Linux, but can in
> Windows. Sorry I don't have the error, but something about calling a static

if your too lazy to run the code one more time to copy and paste the error
then why should anyone help you?

> function. Would this be a difference between OS's or with the different
> versions of PHP? 

it's something to do with fact that OO in php4 is a world away from
OO in php5.

> 
> Thanks
> 
> B
> 
> ---------------------------
> 
>       if (empty($subemail)) { $form->setError($field, emailnotentered); 
>               }
>               else {
>                $regex = "^[_+a-z0-9-]+(\.[_+a-z0-9-]+)*"
>                        ."@[a-z0-9-]+(\.[a-z0-9-]{1,})*"
>                        ."\.([a-z]{2,}){1}$";
>                if(!eregi($regex,$subemail)){
>                   $form->setError($field, emailinvalid);
>                }
>          $subemail = stripslashes($subemail);
>               }
>               elseif(in_array(strtolower($a), $language))
> $form->setError($field, profanity);
>               elseif(in_array(strtolower($b), $language))
> $form->setError($field, profanity);
>               elseif(in_array(strtolower($c), $language))
> $form->setError($field, profanity);
>         else {
>            $query = "SELECT * FROM users WHERE $subemail = 'email'";
>            $result = mysql_query($query)or $mysqlerror = mysql_error();
>            if ($mysqlerror) {
>                    $form->setError($field, tberror);
>            }
>            else {
>               $numrows = mysql_fetch_row($result);
>               if($numrows = mysql_num_rows($result)) {
>                       $form->setError($field, duplicatepassword);
>               }
>            }
>         }
> 
> ---------------------------
> 
>   $field = "email";
>   list ($a, $b, $c) = split ('[EMAIL PROTECTED]', $subemail);
>   $regex =
> "^[_+a-z0-9-]+(\.[_+a-z0-9-]+)[EMAIL 
> PROTECTED](\.[a-z0-9-]{1,})*\.([a-z]{2,}){1}
> $";
> 
>   if (empty($subemail)) { $form->setError($field, emailnotentered);
>   }
>   elseif(!eregi($regex,$subemail)){
>             $form->setError($field, emailinvalid);
>   }
>   elseif(in_array(strtolower($a), $language)) $form->setError($field,
> profanity);
>   elseif(in_array(strtolower($b), $language)) $form->setError($field,
> profanity);
>   elseif(in_array(strtolower($c), $language)) $form->setError($field,
> profanity);
>                         
>   else {   
>            $query = "SELECT * FROM users WHERE $subemail = 'email'";
>            $result = mysql_query($query)or $mysqlerror = mysql_error();
>            if ($mysqlerror) {
>                    $form->setError($field, tberror);
>                 
>            }
>            else {
>               $numrows = mysql_fetch_row($result);
>               if($numrows = mysql_num_rows($result)) {
>                       $form->setError($field, duplicatepassword);
>               }
>            }
>         }
> 

--- End Message ---
--- Begin Message ---
On Thu, 29 Jun 2006, Charlene Wroblewski wrote:

*joining the fray a little late*

What is the difference between this, Smarty and template.inc? I have found Smarty to be unusable in my situation where a graphic designer needs to be able to edit the html and is easily confused by non-html.

So, I am using template.inc which is apparently old (PHP 3) but seems to work great even with PHP 4.1. Another question is whether it will work with PHP 5?

Try HTML_Template_IT from PEAR. Excelente! We use it with web designers that know nothing about programming.

--
 21:50:04 up 2 days,  9:07,  0 users,  load average: 0.92, 0.37, 0.18
---------------------------------------------------------
Lic. Martín Marqués | SELECT 'mmarques' || Centro de Telemática | '@' || 'unl.edu.ar';
Universidad Nacional        |   DBA, Programador,
    del Litoral             |   Administrador
---------------------------------------------------------

--- End Message ---
--- Begin Message ---
On Fri, 30 Jun 2006, Jay Paulson wrote:

I'd like to get some feedback on what the list thinks is a good template
engine other than smarty.

PEARs HTML_Template_IT... or mix it with other HTML_Template*

I'd also like to do some quick prototyping using a PHP framework does anyone
have any recommendations for one that is easy to pick up and run with?

The only important one I know of is Horde (http://www.horde.org).

Finally, does anyone have any suggestions for a good PHP database
abstraction library?

For PHP 5 I've heard wonderfull things about PDO, but the documentation sucks.

I personally am working with PEAR::DB which has been merged with MDB to make MDB2 (this would be a good start point).

--
 21:50:04 up 2 days,  9:07,  0 users,  load average: 0.92, 0.37, 0.18
---------------------------------------------------------
Lic. Martín Marqués | SELECT 'mmarques' || Centro de Telemática | '@' || 'unl.edu.ar';
Universidad Nacional        |   DBA, Programador,
    del Litoral             |   Administrador
---------------------------------------------------------

--- End Message ---
--- Begin Message ---
On Fri, 30 Jun 2006, KermodeBear wrote:

http://pear.php.net/package/DB/

This one has no more development, besides bug fixes. It was merged to create the one below.

http://pear.php.net/package/MDB2/

--
 21:50:04 up 2 days,  9:07,  0 users,  load average: 0.92, 0.37, 0.18
---------------------------------------------------------
Lic. Martín Marqués | SELECT 'mmarques' || Centro de Telemática | '@' || 'unl.edu.ar';
Universidad Nacional        |   DBA, Programador,
    del Litoral             |   Administrador
---------------------------------------------------------

--- End Message ---
--- Begin Message ---
At 1:26 AM -0300 7/1/06, Martin Alterisio wrote:
>That's all folks. Coming up next: an innovative realistic soccer simulation
>game: "Fix the World Cup". Everything from bribing a referee to fixing the
>team sorting. Do you lack the morality to make your team the world champion
>by any means necessary? Take this chance to prove it! .... (just joking...
>really.... but it would be a good game, wouldn't it?)

Soccer... what's that?

tedd
-- 
------------------------------------------------------------------------------------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
I think they call it 'futbol' in your native language tedd.  Or was that 
'maize'.. it was one or the other :)

-TG

= = = Original message = = =

At 1:26 AM -0300 7/1/06, Martin Alterisio wrote:
>That's all folks. Coming up next: an innovative realistic soccer simulation
>game: "Fix the World Cup". Everything from bribing a referee to fixing the
>team sorting. Do you lack the morality to make your team the world champion
>by any means necessary? Take this chance to prove it! .... (just joking...
>really.... but it would be a good game, wouldn't it?)

Soccer... what's that?

tedd
-- 
------------------------------------------------------------------------------------
http://sperling.com  http://ancientstones.com  http://earthstones.com


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

--- End Message ---
--- Begin Message ---
 
> Soccer... what's that?
> 
> tedd


Its a mis-spelling of two words taken out of context,
its actually "sock her" and meant for Hillary Clinton 






;))



Cheers!
Ryan

------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

--- End Message ---

Reply via email to