[PHP-DB] Trouble with uploading a file via ftp_put

2003-10-05 Thread Ruprecht Helms
Hi,

by uploading a file via the ftp_put-command the upload is not done
properly. Result is I have a file in the destinationdirectory but
0 bit in size, only the filename is transfered.

How have I to write the script that the file I want upload should
be uploaded within the correct size. The actual script you can see
here.

[code]


$conn_id=ftp_connect('62.241.50.14');
ftp_login($conn_id,'','');
echo "Current directory : ", ftp_pwd($conn_id), "\n";
ftp_chdir($conn_id,"html");
echo "Current directory is now : ", ftp_pwd($conn_id), "\n";
$dstdir="html";
$upload=ftp_put($conn_id,$bild,$dstdir."/".$bild,FTP_BINARY);

[/code]

Regards,
Ruprecht

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Trouble with uploading a file via ftp_put

2003-10-05 Thread Jason Wong
On Sunday 05 October 2003 17:15, Ruprecht Helms wrote:

> by uploading a file via the ftp_put-command the upload is not done
> properly. Result is I have a file in the destinationdirectory but
> 0 bit in size, only the filename is transfered.
>
> How have I to write the script that the file I want upload should
> be uploaded within the correct size. The actual script you can see
> here.
>
> [code]
>
>
> $conn_id=ftp_connect('62.241.50.14');
> ftp_login($conn_id,'','');
> echo "Current directory : ", ftp_pwd($conn_id), "\n";
> ftp_chdir($conn_id,"html");
> echo "Current directory is now : ", ftp_pwd($conn_id), "\n";
> $dstdir="html";
> $upload=ftp_put($conn_id,$bild,$dstdir."/".$bild,FTP_BINARY);
>
> [/code]

1) You've got your source-file and destination-file mixed up.
2) You've already chdir into 'html' so destination-file so be just '$bild' and 
not '$dstdir."/".$bild'. Unless your directory structure really is 
'html/html/'

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Sometimes a cigar is just a cigar.
-- Sigmund Freud
*/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Trouble with uploading a file via ftp_put

2003-10-05 Thread Ruprecht Helms
On Sun, 2003-10-05 at 11:39, Jason Wong wrote:

> > $upload=ftp_put($conn_id,$bild,$dstdir."/".$bild,FTP_BINARY);
> >
> > [/code]
> 
> 1) You've got your source-file and destination-file mixed up.
> 2) You've already chdir into 'html' so destination-file so be just '$bild' and 
> not '$dstdir."/".$bild'. Unless your directory structure really is 
> 'html/html/'

actual I have the following script.
I want to upload a image from the local pc into the subdir html of a
webspace. The file I want to upload is not stored in the
destinationdirectory.

This is my actual script

','');
 echo "Current directory : ", ftp_pwd($conn_id), "\n";
 //ftp_chdir($conn_id,"html");
 echo "Current directory is now : ", ftp_pwd($conn_id), "\n";
 echo "Bilddatei   ";
 echo $bild;
  $upload=ftp_put($conn_id,'html'+$bild,$bild,FTP_BINARY);
?>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Confused

2003-10-05 Thread Robin Kopetzky
I need to setup a user, 'commerce' with a password, that can be accessed
from any web server in our farm 'blackmesa-isp.net'. What "GRANT" statement
do I need to make this work? I've tried a bunch of the examples in the
manual and can't get it right. Specifically, I need the user to CONNECT,
SELECT, INSERT, UPDATE, DELETE and that's all for privileges.

Any help is appreciated.

Robin 'Sparky' Kopetzky
Black Mesa Computers/Internet Service
Grants, NM 87020 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Confused

2003-10-05 Thread Jason Wong
On Sunday 05 October 2003 23:44, Robin Kopetzky wrote:
> I need to setup a user, 'commerce' with a password, that can be accessed
> from any web server in our farm 'blackmesa-isp.net'. What "GRANT" statement
> do I need to make this work? I've tried a bunch of the examples in the
> manual and can't get it right. Specifically, I need the user to CONNECT,
> SELECT, INSERT, UPDATE, DELETE and that's all for privileges.
>
> Any help is appreciated.

This has *nothing* to do with PHP, try asking on the MySQL list.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Your computer account is overdrawn.  Please reauthorize.
*/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Confused

2003-10-05 Thread Martin Marques
El Dom 05 Oct 2003 12:44, Robin Kopetzky escribió:
> I need to setup a user, 'commerce' with a password, that can be accessed
> from any web server in our farm 'blackmesa-isp.net'. What "GRANT" statement
> do I need to make this work? I've tried a bunch of the examples in the
> manual and can't get it right. Specifically, I need the user to CONNECT,
> SELECT, INSERT, UPDATE, DELETE and that's all for privileges.

You didn't give information on which database you're talking about, but any 
way, I'll give you the Standard SQL way:

GRANT SELECT ON table_name TO commerce;

This always if the user already exists. :-)

-- 
Porqué usar una base de datos relacional cualquiera,
si podés usar PostgreSQL?
-
Martín Marqués  |[EMAIL PROTECTED]
Programador, Administrador, DBA |   Centro de Telemática
   Universidad Nacional
del Litoral
-

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Confused

2003-10-05 Thread Martin Marques
El Dom 05 Oct 2003 13:07, Jason Wong escribió:
> On Sunday 05 October 2003 23:44, Robin Kopetzky wrote:
> > I need to setup a user, 'commerce' with a password, that can be accessed
> > from any web server in our farm 'blackmesa-isp.net'. What "GRANT"
> > statement do I need to make this work? I've tried a bunch of the examples
> > in the manual and can't get it right. Specifically, I need the user to
> > CONNECT, SELECT, INSERT, UPDATE, DELETE and that's all for privileges.
> >
> > Any help is appreciated.
>
> This has *nothing* to do with PHP, try asking on the MySQL list.
   ^
He never said it was on MySQL.

-- 
Porqué usar una base de datos relacional cualquiera,
si podés usar PostgreSQL?
-
Martín Marqués  |[EMAIL PROTECTED]
Programador, Administrador, DBA |   Centro de Telemática
   Universidad Nacional
del Litoral
-

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Confused

2003-10-05 Thread Wang Feng
Jason,

how do you know he's using MySQL?

I think some php people would like to answer this question since it makes
the community stronger.


cheers,

feng


- Original Message -
From: "Jason Wong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, October 06, 2003 2:07 AM
Subject: Re: [PHP-DB] Confused


> On Sunday 05 October 2003 23:44, Robin Kopetzky wrote:
> > I need to setup a user, 'commerce' with a password, that can be accessed
> > from any web server in our farm 'blackmesa-isp.net'. What "GRANT"
statement
> > do I need to make this work? I've tried a bunch of the examples in the
> > manual and can't get it right. Specifically, I need the user to CONNECT,
> > SELECT, INSERT, UPDATE, DELETE and that's all for privileges.
> >
> > Any help is appreciated.
>
> This has *nothing* to do with PHP, try asking on the MySQL list.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> --
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-db
> --
> /*
> Your computer account is overdrawn.  Please reauthorize.
> */
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Trouble with uploading a file via ftp_put

2003-10-05 Thread Jason Wong
On Sunday 05 October 2003 21:54, Ruprecht Helms wrote:

> actual I have the following script.
> I want to upload a image from the local pc into the subdir html of a
> webspace. 

You *are* running this script on the local pc aren't you?

> The file I want to upload is not stored in the
> destinationdirectory.

Check your 'destinationdirectory':

1) it's missing a '/'.
2) '+' is an mathematical addition operator, '.' is a string concatenation 
operator

> This is my actual script
>
>  ...
>
> $conn_id=ftp_connect('62.241.50.14');
>  ftp_login($conn_id,'','');
>  echo "Current directory : ", ftp_pwd($conn_id), "\n";
>  //ftp_chdir($conn_id,"html");
>  echo "Current directory is now : ", ftp_pwd($conn_id), "\n";
>  echo "Bilddatei   ";
>  echo $bild;
>   $upload=ftp_put($conn_id,'html'+$bild,$bild,FTP_BINARY);
> ?>

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Kafka's Law:
In the fight between you and the world, back the world.
-- Franz Kafka, "RS's 1974 Expectation of Days"
*/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Confused

2003-10-05 Thread Jason Wong
On Monday 06 October 2003 00:12, Wang Feng wrote:

> how do you know he's using MySQL?

OK, sorry I made an assumption. But whatever, he should be asking on the 
mailing list of whatever DBMS he is using.

> I think some php people would like to answer this question since it makes
> the community stronger.

There are good reasons for having different lists for different subjects.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
polygon:
Dead parrot.
*/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Confused

2003-10-05 Thread Wang Feng
Jason,

> There are good reasons for having different lists for different subjects.

Note, he post the message to the [EMAIL PROTECTED] rather than
[EMAIL PROTECTED] There's nothing wrong to ask questions @ php-DB.
:-)

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Confused

2003-10-05 Thread Wang Feng
I assume you're using MySQL since L.A.M.P seems very popular.

The following command should work anyway:

GRANT permission ON tablename TO [EMAIL PROTECTED] IDENTIFIED BY password

You can list as many permission as needed, separated by commas.


cheers,

feng


- Original Message -
From: "Robin Kopetzky" <[EMAIL PROTECTED]>
To: "PHP DB Group" <[EMAIL PROTECTED]>
Sent: Monday, October 06, 2003 1:44 AM
Subject: [PHP-DB] Confused


> I need to setup a user, 'commerce' with a password, that can be accessed
> from any web server in our farm 'blackmesa-isp.net'. What "GRANT"
statement
> do I need to make this work? I've tried a bunch of the examples in the
> manual and can't get it right. Specifically, I need the user to CONNECT,
> SELECT, INSERT, UPDATE, DELETE and that's all for privileges.
>
> Any help is appreciated.
>
> Robin 'Sparky' Kopetzky
> Black Mesa Computers/Internet Service
> Grants, NM 87020
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Confused

2003-10-05 Thread Jason Wong
On Monday 06 October 2003 00:24, Wang Feng wrote:

> Note, he post the message to the [EMAIL PROTECTED] rather than
> [EMAIL PROTECTED] 

Yes that's a bit better than posting on [EMAIL PROTECTED]

But the point is that php-db is for questions about using various DBs *with* 
PHP. The question being asked is solely about how to use the DBMS in 
question. It has nothing, nothing at all to do with PHP.

> There's nothing wrong to ask questions @ php-DB.

As long as they're relevant.


And 3 more points while I'm still in rant mode:

1) The subject (of this thread) is non-descriptive.
2) The OP has posted this same question *twice* in as many days, at the 
weekend, when most people will not be reading the list until they return to 
work on Monday.
3) And twice he's declined to disclose what DB is being used.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
...there can be no public or private virtue unless the foundation of action is
the practice of truth.
- George Jacob Holyoake
*/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Confused

2003-10-05 Thread mike

> As long as they're relevant.

I was just wondering how relevant to php or MySql this nine message thread
about how relevent the original post was...is?

Mike

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Trouble with uploading a file via ftp_put

2003-10-05 Thread Ruprecht Helms
On Sun, 2003-10-05 at 18:12, Jason Wong wrote:
> On Sunday 05 October 2003 21:54, Ruprecht Helms wrote:
> 
> > actual I have the following script.
> > I want to upload a image from the local pc into the subdir html of a
> > webspace. 
> 
> You *are* running this script on the local pc aren't you?

It's running on the destinationhost. So the destinationdirectory can
only be the subdirectory html - the script itselves is html-directory.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Confused

2003-10-05 Thread Robin Kopetzky
To answer your question, yes, I'm using mysql. No, I did not intended for
everyone to go thermonuclear over this question. Next time, I'll go
elsewhere since some one got P.O.'d about my posting twice.

Sparky

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Confused

2003-10-05 Thread Michael Cupp, Jr.
Don't feel bad, I had a MySQL question and posted it to that list and got a similar 
response.

I've been in IT and have been an oracle consultant for 11 years, so I'm far from 
ignorant, but I guess I would have hoped that someone would be more patient in helping 
someone learn a new technology.

M


-Original Message-
From: "Robin Kopetzky" <[EMAIL PROTECTED]>
Date: Sun, 5 Oct 2003 13:56:10 
To:<[EMAIL PROTECTED]>
Subject: RE: [PHP-DB] Confused

To answer your question, yes, I'm using mysql. No, I did not intended for
everyone to go thermonuclear over this question. Next time, I'll go
elsewhere since some one got P.O.'d about my posting twice.

Sparky

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


---
Michael Cupp, Jr.
937/626-2310
[EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Trouble with uploading a file via ftp_put

2003-10-05 Thread Jason Wong
On Monday 06 October 2003 01:00, Ruprecht Helms wrote:
> On Sun, 2003-10-05 at 18:12, Jason Wong wrote:
> > On Sunday 05 October 2003 21:54, Ruprecht Helms wrote:
> > > actual I have the following script.
> > > I want to upload a image from the local pc into the subdir html of a
> > > webspace.
> >
> > You *are* running this script on the local pc aren't you?
>
> It's running on the destinationhost. So the destinationdirectory can
> only be the subdirectory html - the script itselves is html-directory.

Let me get this straight:

You're trying to transfer a file from a local PC (A) to a server (B). And your 
code is running on (B)?

If so, then, (assuming you have things setup correctly, ie have an ftpserver 
running on (A)), you should be using ftp_get() or similar.

If not, could you describe *exactly* what you're trying to do and explain why 
you're not using a standard FTP client on the local pc to transfer the file 
to the remote pc.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Anyone who goes to a psychiatrist ought to have his head examined.
-- Samuel Goldwyn
*/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] SoS

2003-10-05 Thread zxx10
Hi, All:

I'm a beginner of PHP. While trying the code from
a tutorial, I encountered the following problem.

The variable $id can not be transfered to my server.
You can find the code at the end of this email. When
I visit http://mydomain.com/test.php?id=1
it always shows the list of the database instead
of a perticular record.

I appreciate your kind helps!

Zhan Xu
EECS Department
Case Western Reserve University




", $myrow["first"]);

   printf("Last name: %s\n", $myrow["last"]);

   printf("Address: %s\n", $myrow["address"]);

   printf("Position: %s\n", $myrow["position"]);

} else {

// show employee list
   $result = mysql_query("SELECT * FROM employees",$db);

if ($myrow = mysql_fetch_array($result)) {

  // display list if there are records to display

  do {

printf("%s %s\n", $PHP_SELF, $myrow["id"], 
$myrow["first"], $myrow["last"]);

  } while ($myrow = mysql_fetch_array($result));

} else {

  // no records to display

  echo "Sorry, no records were found!"; 

}

}
?>




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] SoS

2003-10-05 Thread Jason Godesky
Your if statement will only be TRUE if $id is set to FALSE, NULL or zero 
(0)--I think you're looking for if the variable is set.  That would be: if 
(isset($id))

--
Jason Godesky
[EMAIL PROTECTED]
http://www.tribaldawn.com/jason/

I'm a beginner of PHP. While trying the code from
a tutorial, I encountered the following problem.
The variable $id can not be transfered to my server.
You can find the code at the end of this email. When
I visit http://mydomain.com/test.php?id=1
it always shows the list of the database instead
of a perticular record.
I appreciate your kind helps!

Zhan Xu
EECS Department
Case Western Reserve University
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] SoS

2003-10-05 Thread zxx10
Hi, Jason:

Thank you very much for your quick reply. I tried
the if (isset($id)) but it doesn't work. Any
thoughts?

By the way, I'm using Php4.3.3 and MySQL4.0.15a.
The tutorial I'm reading is about Php3. Will this
be the problem?

Many thanks.

Zhan Xu
EECS Department
Case Western Reserve University

- Original Message -
From: Jason Godesky <[EMAIL PROTECTED]>
Date: Monday, October 6, 2003 5:52 am
Subject: Re: [PHP-DB] SoS

> 
> Your if statement will only be TRUE if $id is set to FALSE, NULL or 
> zero 
> (0)--I think you're looking for if the variable is set.  That would 
> be: if 
> (isset($id))
> 
> -- 
> Jason Godesky
> [EMAIL PROTECTED]
> http://www.tribaldawn.com/jason/
> 
> 
> > I'm a beginner of PHP. While trying the code from
> > a tutorial, I encountered the following problem.
> >
> > The variable $id can not be transfered to my server.
> > You can find the code at the end of this email. When
> > I visit http://mydomain.com/test.php?id=1
> > it always shows the list of the database instead
> > of a perticular record.
> >
> > I appreciate your kind helps!
> >
> > Zhan Xu
> > EECS Department
> > Case Western Reserve University
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] SoS

2003-10-05 Thread Shahmat Dahlan
if the statement "if (isset($id)) doesn't probably it because 
register_globals has been turned off maybe?

How about "if (isset($_GET["id"]))" ?

[EMAIL PROTECTED] wrote:

Hi, Jason:

Thank you very much for your quick reply. I tried
the if (isset($id)) but it doesn't work. Any
thoughts?
By the way, I'm using Php4.3.3 and MySQL4.0.15a.
The tutorial I'm reading is about Php3. Will this
be the problem?
Many thanks.

Zhan Xu
EECS Department
Case Western Reserve University
- Original Message -
From: Jason Godesky <[EMAIL PROTECTED]>
Date: Monday, October 6, 2003 5:52 am
Subject: Re: [PHP-DB] SoS
 

Your if statement will only be TRUE if $id is set to FALSE, NULL or 
zero 
(0)--I think you're looking for if the variable is set.  That would 
be: if 
(isset($id))

--
Jason Godesky
[EMAIL PROTECTED]
http://www.tribaldawn.com/jason/
   

I'm a beginner of PHP. While trying the code from
a tutorial, I encountered the following problem.
The variable $id can not be transfered to my server.
You can find the code at the end of this email. When
I visit http://mydomain.com/test.php?id=1
it always shows the list of the database instead
of a perticular record.
I appreciate your kind helps!

Zhan Xu
EECS Department
Case Western Reserve University
 

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
   

 



Re: [PHP-DB] SoS

2003-10-05 Thread zxx10
Hi, Shahmat:

Thank you very much!

Yes, I use "echo phpinfo()" and found out that
"register_globals" has been turned off. How can
I turned it on? Do I need to recompile the Php?

I also tried "if (isset($_GET["id"])) and 
found out that $id is NULL. So, there will
be an error in the SQL statement.

Zhan Xu
EECS Department
Case Western Reserve University

- Original Message -
From: Shahmat Dahlan <[EMAIL PROTECTED]>
Date: Monday, October 6, 2003 6:07 am
Subject: Re: [PHP-DB] SoS

> if the statement "if (isset($id)) doesn't probably it because 
> register_globals has been turned off maybe?
> 
> How about "if (isset($_GET["id"]))" ?
> 
> [EMAIL PROTECTED] wrote:
> 
> >Hi, Jason:
> >
> >Thank you very much for your quick reply. I tried
> >the if (isset($id)) but it doesn't work. Any
> >thoughts?
> >
> >By the way, I'm using Php4.3.3 and MySQL4.0.15a.
> >The tutorial I'm reading is about Php3. Will this
> >be the problem?
> >
> >Many thanks.
> >
> >Zhan Xu
> >EECS Department
> >Case Western Reserve University
> >
> >- Original Message -
> >From: Jason Godesky <[EMAIL PROTECTED]>
> >Date: Monday, October 6, 2003 5:52 am
> >Subject: Re: [PHP-DB] SoS
> >
> >  
> >
> >>Your if statement will only be TRUE if $id is set to FALSE, NULL 
> or 
> >>zero 
> >>(0)--I think you're looking for if the variable is set.  That 
> would 
> >>be: if 
> >>(isset($id))
> >>
> >>-- 
> >>Jason Godesky
> >>[EMAIL PROTECTED]
> >>http://www.tribaldawn.com/jason/
> >>
> >>
> >>
> >>
> >>>I'm a beginner of PHP. While trying the code from
> >>>a tutorial, I encountered the following problem.
> >>>
> >>>The variable $id can not be transfered to my server.
> >>>You can find the code at the end of this email. When
> >>>I visit http://mydomain.com/test.php?id=1
> >>>it always shows the list of the database instead
> >>>of a perticular record.
> >>>
> >>>I appreciate your kind helps!
> >>>
> >>>Zhan Xu
> >>>EECS Department
> >>>Case Western Reserve University
> >>>  
> >>>
> >>-- 
> >>PHP Database Mailing List (http://www.php.net/)
> >>To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >>
> >>
> >
> >  
> >
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] SoS

2003-10-05 Thread Jason Godesky

if the statement "if (isset($id)) doesn't probably it because 
register_globals has been turned off maybe?

How about "if (isset($_GET["id"]))" ?
And if you want to keep the flexibility of getting the variable from 
anywhere, you can always use if ((isset($_GET["id"]))||(isset($id)))--that 
would cover query strings, and the case of any possible includes.

--
Jason Godesky
[EMAIL PROTECTED]
http://www.tribaldawn.com/jason/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] SoS

2003-10-05 Thread zxx10
Hi, Jason and Shahmat:

I figured it out! The register_globals is turned
off. To parse the id with this parameter off, I
just need to judge whether $_GET["id"] is set or not. The problem is that I wrote the 
SQL
statement as:

$SQLstr="SELECT * FROM employees WHERE id=$_GET["id"]";

That's a wrong one. To solve this, I do the 
following (a naive one):
$tid=$_GET["id"];
$SQLstr="SELECT * FROM employees WHERE id=$tid";

And it's OK.

Thank you very much for your helps!

Zhan Xu
EECS Department
Case Western Reserve University

- Original Message -
From: Shahmat Dahlan <[EMAIL PROTECTED]>
Date: Monday, October 6, 2003 6:07 am
Subject: Re: [PHP-DB] SoS

> if the statement "if (isset($id)) doesn't probably it because 
> register_globals has been turned off maybe?
> 
> How about "if (isset($_GET["id"]))" ?
> 
> [EMAIL PROTECTED] wrote:
> 
> >Hi, Jason:
> >
> >Thank you very much for your quick reply. I tried
> >the if (isset($id)) but it doesn't work. Any
> >thoughts?
> >
> >By the way, I'm using Php4.3.3 and MySQL4.0.15a.
> >The tutorial I'm reading is about Php3. Will this
> >be the problem?
> >
> >Many thanks.
> >
> >Zhan Xu
> >EECS Department
> >Case Western Reserve University
> >
> >- Original Message -
> >From: Jason Godesky <[EMAIL PROTECTED]>
> >Date: Monday, October 6, 2003 5:52 am
> >Subject: Re: [PHP-DB] SoS
> >
> >  
> >
> >>Your if statement will only be TRUE if $id is set to FALSE, NULL 
> or 
> >>zero 
> >>(0)--I think you're looking for if the variable is set.  That 
> would 
> >>be: if 
> >>(isset($id))
> >>
> >>-- 
> >>Jason Godesky
> >>[EMAIL PROTECTED]
> >>http://www.tribaldawn.com/jason/
> >>
> >>
> >>
> >>
> >>>I'm a beginner of PHP. While trying the code from
> >>>a tutorial, I encountered the following problem.
> >>>
> >>>The variable $id can not be transfered to my server.
> >>>You can find the code at the end of this email. When
> >>>I visit http://mydomain.com/test.php?id=1
> >>>it always shows the list of the database instead
> >>>of a perticular record.
> >>>
> >>>I appreciate your kind helps!
> >>>
> >>>Zhan Xu
> >>>EECS Department
> >>>Case Western Reserve University
> >>>  
> >>>
> >>-- 
> >>PHP Database Mailing List (http://www.php.net/)
> >>To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >>
> >>
> >
> >  
> >
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] SoS

2003-10-05 Thread Shahmat Dahlan
You might want to consider using the autoglobals arrays, $_GET and 
$_POST, this is due to some security concerns... because if you don't 
plan your codings properly, other parties might just be able to exploit 
your codes...

If you still want to insist on turning it on... you can do it via a file 
called php.ini, which should contain the directive register_globals = 
off, or something like that.

Regards

[EMAIL PROTECTED] wrote:

Hi, Shahmat:

Thank you very much!

Yes, I use "echo phpinfo()" and found out that
"register_globals" has been turned off. How can
I turned it on? Do I need to recompile the Php?
I also tried "if (isset($_GET["id"])) and 
found out that $id is NULL. So, there will
be an error in the SQL statement.

Zhan Xu
EECS Department
Case Western Reserve University
- Original Message -
From: Shahmat Dahlan <[EMAIL PROTECTED]>
Date: Monday, October 6, 2003 6:07 am
Subject: Re: [PHP-DB] SoS
 

if the statement "if (isset($id)) doesn't probably it because 
register_globals has been turned off maybe?

How about "if (isset($_GET["id"]))" ?

[EMAIL PROTECTED] wrote:

   

Hi, Jason:

Thank you very much for your quick reply. I tried
the if (isset($id)) but it doesn't work. Any
thoughts?
By the way, I'm using Php4.3.3 and MySQL4.0.15a.
The tutorial I'm reading is about Php3. Will this
be the problem?
Many thanks.

Zhan Xu
EECS Department
Case Western Reserve University
- Original Message -
From: Jason Godesky <[EMAIL PROTECTED]>
Date: Monday, October 6, 2003 5:52 am
Subject: Re: [PHP-DB] SoS


 

Your if statement will only be TRUE if $id is set to FALSE, NULL 
   

or 
   

zero 
(0)--I think you're looking for if the variable is set.  That 
   

would 
   

be: if 
(isset($id))

--
Jason Godesky
[EMAIL PROTECTED]
http://www.tribaldawn.com/jason/
  

   

I'm a beginner of PHP. While trying the code from
a tutorial, I encountered the following problem.
The variable $id can not be transfered to my server.
You can find the code at the end of this email. When
I visit http://mydomain.com/test.php?id=1
it always shows the list of the database instead
of a perticular record.
I appreciate your kind helps!

Zhan Xu
EECS Department
Case Western Reserve University


 

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
  

   



 

 



Re: [PHP-DB] SoS

2003-10-05 Thread Jason Wong
On Monday 06 October 2003 10:18, [EMAIL PROTECTED] wrote:

> I figured it out! The register_globals is turned
> off. To parse the id with this parameter off, I
> just need to judge whether $_GET["id"] is set or not. The problem is that I
> wrote the SQL statement as:
>
> $SQLstr="SELECT * FROM employees WHERE id=$_GET["id"]";
>
> That's a wrong one. To solve this, I do the
> following (a naive one):
> $tid=$_GET["id"];
> $SQLstr="SELECT * FROM employees WHERE id=$tid";
>
> And it's OK.

You can do something like:

  $SQLstr="SELECT * FROM employees WHERE id={$_GET['id']}";

But for security you should always check the integrity of any input that you 
receive from the user.

For example, in this case you should verify that $_GET['id'] is indeed an 
integer and nothing else.


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
God grant me the senility to accept the things I cannot change,
The frustration to try to change things I cannot affect,
and the wisdom to tell the difference.
*/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Re: SoS

2003-10-05 Thread Rahman Haqparast
Hi.
If your id is not a numeric field you should change your query this way:
$result = mysql_query("SELECT * FROM employees WHERE id='$id'",$db);


<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> Hi, All:
>
> I'm a beginner of PHP. While trying the code from
> a tutorial, I encountered the following problem.
>
> The variable $id can not be transfered to my server.
> You can find the code at the end of this email. When
> I visit http://mydomain.com/test.php?id=1
> it always shows the list of the database instead
> of a perticular record.
>
> I appreciate your kind helps!
>
> Zhan Xu
> EECS Department
> Case Western Reserve University
>
>
> 
> 
>  $db = mysql_connect("localhost", "root");
> mysql_select_db("mydb",$db);
> // display individual record
> if ($id) {
>
>$result = mysql_query("SELECT * FROM employees WHERE id=$id",$db);
>
>$myrow = mysql_fetch_array($result);
>
>printf("First name: %s\n", $myrow["first"]);
>
>printf("Last name: %s\n", $myrow["last"]);
>
>printf("Address: %s\n", $myrow["address"]);
>
>printf("Position: %s\n", $myrow["position"]);
>
> } else {
>
> // show employee list
>$result = mysql_query("SELECT * FROM employees",$db);
>
> if ($myrow = mysql_fetch_array($result)) {
>
>   // display list if there are records to display
>
>   do {
>
> printf("%s %s\n", $PHP_SELF,
$myrow["id"], $myrow["first"], $myrow["last"]);
>
>   } while ($myrow = mysql_fetch_array($result));
>
> } else {
>
>   // no records to display
>
>   echo "Sorry, no records were found!";
>
> }
>
> }
> ?>
>
> 
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] SoS

2003-10-05 Thread zxx10
Yes. I'll do that. In this example, the only thing
that I can think about input checking is to use
is_int() function. Is there any other ways to do
the input checking?

Thanks.

Zhan Xu
EECS Department
Case Western Reserve University

- Original Message -
From: Jason Wong <[EMAIL PROTECTED]>
Date: Monday, October 6, 2003 8:13 am
Subject: Re: [PHP-DB] SoS

> On Monday 06 October 2003 10:18, [EMAIL PROTECTED] wrote:
> 
> > I figured it out! The register_globals is turned
> > off. To parse the id with this parameter off, I
> > just need to judge whether $_GET["id"] is set or not. The problem 
> is that I
> > wrote the SQL statement as:
> >
> > $SQLstr="SELECT * FROM employees WHERE id=$_GET["id"]";
> >
> > That's a wrong one. To solve this, I do the
> > following (a naive one):
> > $tid=$_GET["id"];
> > $SQLstr="SELECT * FROM employees WHERE id=$tid";
> >
> > And it's OK.
> 
> You can do something like:
> 
>  $SQLstr="SELECT * FROM employees WHERE id={$_GET['id']}";
> 
> But for security you should always check the integrity of any input 
> that you 
> receive from the user.
> 
> For example, in this case you should verify that $_GET['id'] is 
> indeed an 
> integer and nothing else.
> 
> 
> -- 
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications 
> Development *
> --
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-db
> --
> /*
> God grant me the senility to accept the things I cannot change,
> The frustration to try to change things I cannot affect,
> and the wisdom to tell the difference.
> */
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php