php-windows Digest 8 Oct 2004 21:04:00 -0000 Issue 2424

Topics (messages 24718 through 24724):

Object declaration
        24718 by: Nunners
        24721 by: Cory D. Wiles

4 vs 5
        24719 by: Bobo Wieland
        24724 by: DvDmanDT

Re: php_mysql.dll - WON'T WORK!!
        24720 by: Felipe Gasper

static inheritance in a class object
        24722 by: Kevin

PHP,W2K,Manual Configure, Authentication
        24723 by: zac korpi

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 ---
Hi all,

In the ongoing saga of moving the application I've developed from Apache to
IIS, I've found another problem, with objects this time.

I've got a standard file that is included as a header, which includes the
following lines:

[script]
$query = "SELECT * FROM user where username='".$_COOKIE["username"]."' LIMIT
1"; 
$user_res=mysql_query($query) or die("Query failed : " . mysql_error()); 
while ($user_row=mysql_fetch_row($user_res)) {
        $user->username=$user_row["username"];
        $user->password=$user_row["password"];
        $user->agent_id=$user_row["agent_id"];
        $user->reference=$user_row["reference"];
        $user->level=$user_row["level"];
        $user->email_address=$user_row["email_address"];
        $user->email_username=$user_row["email_username"];
        $user->email_password=$user_row["email_password"];
}
[/script]

When I then try and recall the object variable $user->username it comes up
with an error:
Notice: Undefined variable: user in C:\www\portal\global\var_setup.php on
line 15

Notice: Trying to get property of non-object in
C:\www\portal\global\var_setup.php on line 15

What do I need to do to declare the object before I write sections to it?

Cheers
Nunners

--- End Message ---
--- Begin Message --- The reason why that you get the error is because you didn't call the class. How I do my sql/class manipulation would be something like this:

class User {
var $dbRecords = array();//array that will hold db records

function User() {
...constructor
}//

}//end class


$sql = "SELECT * FROM user WHERE username = '".$_COOKIE["username"]."' LIMIT 1";


$user_res = mysql_query($sql) or die("Query failed : " . mysql_error());

$user = new User();//call User class

while ($user_row = mysql_fetch_row($user_res)) {
  $user->dbRecords[] = array(
  'Username'       => $user_row["username"],
  'Password'       => $user_row["password"],
  'Agent Id'       => $user_row["agent_id"],
  'Reference'      => $user_row["reference"],
  'Level'          => $user_row["level"],
  'Email Address'  => $user_row["email_address"],
  'Email Username' => $user_row["email_username"],
  'Email Password' => $user_row["email_password"]
  );//end array
}//end while

To access the information you just stored in your array:

foreach ($user->dbRecords as $records):
  print $records['Username']."<br>";
  print $records['Password']."<br>";
  print $records['Agent Id']."<br>";
  print $records['Reference']."<br>";
  print $records['Level']."<br>";
  print $records['Email Address']."<br>";
  print $records['Email Username']."<br>";
  print $records['Email Password']."<br>";
endforeach;

If you want to a complete example that I have done
then go to http://www.randomthoughtprocess.com/AdminArticle.phps for the class and http://www.randomthoughtprocess.com/admin_article.phps for the
display. You don't have to use an array to store your db values. I do that so I can keep my class and display logic seperate.



Nunners wrote:

Hi all,

In the ongoing saga of moving the application I've developed from Apache to
IIS, I've found another problem, with objects this time.

I've got a standard file that is included as a header, which includes the
following lines:

[script]
$query = "SELECT * FROM user where username='".$_COOKIE["username"]."' LIMIT
1"; $user_res=mysql_query($query) or die("Query failed : " . mysql_error()); while ($user_row=mysql_fetch_row($user_res)) {
$user->username=$user_row["username"];
$user->password=$user_row["password"];
$user->agent_id=$user_row["agent_id"];
$user->reference=$user_row["reference"];
$user->level=$user_row["level"];
$user->email_address=$user_row["email_address"];
$user->email_username=$user_row["email_username"];
$user->email_password=$user_row["email_password"];
}
[/script]


When I then try and recall the object variable $user->username it comes up
with an error:
Notice: Undefined variable: user in C:\www\portal\global\var_setup.php on
line 15

Notice: Trying to get property of non-object in
C:\www\portal\global\var_setup.php on line 15

What do I need to do to declare the object before I write sections to it?

Cheers
Nunners


-- Cory Wiles Systems Engineer ePerformax - Memphis, TN 901.751.4902 http://www.eperformax.com

--- End Message ---
--- Begin Message ---
Hi all!

I'm about to reinstall PHP/MySQL/Apache (+ MySQL Front) on my WinXP machine...
It's been a while since I last installed this package and there have been some version 
changes...
Should I go for the old Apache or Apache 2? And most important; can I have a dual 
install of php4 and php5 or is it possible to force php5 scripts to run in php4 
compability mode?

My webserver is just local and I use a webhotell for everything I do. They do not have 
php5 installed. And probably won't have it for quite a while. I don�t want to make 
scripts that wont work bcause of their older version of php. At the same time I want 
to migrate to php5 so that I can learn it... How should I do?


_bobo wieland

--- End Message ---
--- Begin Message ---
Well.. You can have both 4 and 5 installed on both Apache 1 and 2 if you
want to.. Which Apache version to use doesn't really matter.. I use 1.3, and
I have PHP 2, 3, 4 and 5 installed. PHP 4 as Apache module and the rest as
CGI binaries.. Instructions in manual..

You can't force PHP5 to only accept PHP4 syntax, and that would be pointless
since you could anyway use PHP4 in that case. You could have one folder
using PHP5 and one using PHP4 if you want to, as long as you install one of
them (or both) as CGI.. You can only have one of them as Apache module at a
time.. Which one to have as module is the one you will likely use the most..
Doesn't matter all that much though..

Hope that helps..
-- 
// DvDmanDT
MSN: dvdmandt�hotmail.com
Mail: dvdmandt�telia.com

"Bobo Wieland" <[EMAIL PROTECTED]> skrev i meddelandet
news:[EMAIL PROTECTED]
Hi all!

I'm about to reinstall PHP/MySQL/Apache (+ MySQL Front) on my WinXP
machine...
It's been a while since I last installed this package and there have been
some version changes...
Should I go for the old Apache or Apache 2? And most important; can I have a
dual install of php4 and php5 or is it possible to force php5 scripts to run
in php4 compability mode?

My webserver is just local and I use a webhotell for everything I do. They
do not have php5 installed. And probably won't have it for quite a while. I
don�t want to make scripts that wont work bcause of their older version of
php. At the same time I want to migrate to php5 so that I can learn it...
How should I do?


_bobo wieland

--- End Message ---
--- Begin Message ---
Use the libmysql.dll provided by PHP - that should work just fine.

-Felipe Gasper

Quoth Marc Kia on 10/8/2004 1:18 AM...
Hello,

I have the same probleme if I undersoud well:
The last available MYSQL 4.0.21 is not supported by the php_mysql.dll
because of the suppression of the drop_database function in Libmysql.dll.
To seams like a bug in the php_mysql.dll I hope that I will find a fix prety
quickly. Because using php_mysqli.dll is not possible in many cases because
of backward compatibility.

I'll try to use an old crapy 3.xx it should work again.

bye


"Phpdiscuss - Php Newsgroups And Mailing Lists" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]

I set my extension folder to 'D:\Service\PHP\ext' and the php_mysql.dll is
in the ext folder. I was getting an error saying "The specified module
could not be found." But after I copied the libmySQL.dll to the system32
folder, I got this error, "The specified procedure could not be found."
(Notice the difference of 'module' and 'procedure' in the two error
messages.) Why isn't it working? *sighs*

Thanks in advance.



-- Quidquid latine scriptum sit altum viditur. Si hoc legere scis, nimis eruditionis habes.

Easier web browsing: http://mozilla.org
--- End Message ---
--- Begin Message ---
Anyone know why class static vars are inherited?  (See code below)

class A
{
   public static $CONFIG = null;
}

A::$CONFIG = "A";

class B extends A
{
   public static $CONFIG = null;
}

B::$CONFIG = "B";

print ("A: " . A::$CONFIG . "<br>");
print ("B: " . B::$CONFIG . "<br>");

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

I've installed PHP manually on W2K server - IIS.  I followed the instructions, as 
listed in the the appendix of PHP & MYSQL Web Developmeent, and it's not working.

I've checked and rechecked the installation procedure and can't see where I did 
anything wrong. The auto-install of PHP worked fine;  however, I realized that I 
needed the SAPI configuration for PHPmyAdmin for authentication.

Recently we got a new server at work; I'm a student working for Northern Michigan 
University.  I'm attempting to develope an online web satisfaction survey that writes 
to an SQL database.

If anyone would be willing to help me get this working, I'd be really greatful!  

Here is a link to the current php info page - http://meet.nmu.edu/test.php

Thanks!
Sincerely, 
Zac Korpi

--- End Message ---

Reply via email to