php-windows Digest 11 Oct 2005 06:39:49 -0000 Issue 2792

Topics (messages 26391 through 26393):

Handling objects as session vars
        26391 by: Marcos R. Cardoso

Re: cannot use $mysqli->set_charset (undefined method)
        26392 by: Greg Crittall

PDF question
        26393 by: Raul IONESCU

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:
        [email protected]


----------------------------------------------------------------------
--- Begin Message --- I'm trying to use an object as a session var so I could handle its properties and methods as long as the session is still on. But when I use a second PHP script the values inside this object are lost. I have a script like this.

<?
include("class/object_def.php");
session_start();
$new_object = new TNewClass($cod,$password);
if ($new_object->getCod() == 0) {
 echo $new_object->getMsgError();
} else {
 $_SESSION['session_object'] = $new_object;
?>
<script language="JavaScript">
 location.replace("new_script.php");
</script>
<?
}
?>

then in the script "new_script.php" I have the following instructions:

<?
include("class/object_def.php");
session_start();
if ($_SESSION['session_object'] == "") {
 echo "there is no session open<br>";
 exit;
}
echo $_SESSION['session_object']->getCod()."<br>";
echo $_SESSION['session_object']->getName()."<br>";
?>

The result from the script new_script.php always return empty where the methods should return something. I've already read the documentation at www.php.net, tried what it's shown there and checked some other sites as well, bu I haven't found a solution yet.

Environment:

Windows 2003 Server
Apache 2.0.54
PHP 4.4.0
Sun Chili!Soft ASP 3.6.2
MySQL 4.0.20a
Oracle 9i (through a Oracle 8i NetClient)


TIA,
Marcos R. Cardoso
Blumenau
Brazil

--- End Message ---
--- Begin Message ---
Hi Julien

You will probably find that if you use the procedural coding rather than the object-oriented programming you code will work.

So instead of using:
$mysqli->set_charset("utf8");

use:
mysqli_set_charset("utf8");

Hope this helps

Greg

Julien Ricard - Condenet wrote:

Hello,

here are the versions I'm using :
Apache/2.0.54 (Win32) PHP/5.1.0RC2-dev

The mysqli client api version is : 5.0.13-rc (as written on my phpinfo output)

I can instantiate mysqli with
$mysqli = new mysqli("localhost", "root", "---", "mysql");

But I get an error when I try to set the charset with :
$mysqli->set_charset("utf8");

The error I get is :
Fatal error: Call to undefined method mysqli::set_charset() in ....

I don't know what to do. I tried to reinstall php with the latest builds, did the same thing with mysql...

Any idea ?

Thank you
Julien


--- End Message ---
--- Begin Message ---
Hi all,

Does anyone know how can I open an existing PDF file to get the text
content from it, into PHP???

Many, many thanks!

--- End Message ---

Reply via email to