Re: Why do I always come up with the hard stuff?
| From: | Mark Summers | Date: | Tue, 07 Aug 2007 16:02:46 +0000 |
| Subject: | Re: Why do I always come up with the hard stuff? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-260293@lists.php.net to get a copy of this message | ||
Hello,
I suspect that you need to assign the new instance of mysqli to $mysqli
by reference to prevent the on-demand instance that is created by new
from being copied (cloned) at the point of assignment.
Mark
Jason Pruim wrote:
> Yes I am hijacking a thread just to screw with all the people who use
> threaded e-mail viewers and because I'm mean like that :P
>
> Figured since yall have to much time on your hands anyway I'd give you
> something else to gripe about... :)
>
> Now... My question :)
>
> <?php
> $mysqli = new mysqli("localhost", "user", "password",
> "database");
>
> /* check connection */
> if (mysqli_connect_errno()) {
> printf("Connect failed: %s\n", mysqli_connect_error());
> exit();
> }
>
> printf("Host information: %s\n", $mysqli->host_info);
>
> /* close connection */
> $mysqli->close();
> ?>
>
> [Tue Aug 7 11:19:20 2007] [error] PHP Fatal error: Trying to clone
> an uncloneable object of class mysqli in
> /Volumes/RAIDer/webserver/Documents/tests/legion/mysqli.php on line 2
>
>
> What is wrong with line 2? The login info is correct since I use it to
> connect with the old mysql_connect stuff and it works just fine...
> What am I missing?
>
> --PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>