Re: [PHP-DB] Re: PHP help

2003-06-30 Thread Terry Riley
Surely this will fail because $login has not been defined, by use of 
something like

$login = $_REQUEST['login'];

I tried the naked code as given, and (as expected) got an error - 
undefined variable - $login 

I was under the impression that had to be done for all 'incoming', if it 
was to be used for anything.

Terry Riley

--Original Message-  

 
   $query=INSERT INTO login VALUES ('$login');
 
 have fun
 
 
 Bill Pilgrim wrote:
  My System:  
  Windows 98
  Apache 1.3.27
  PHP 4
  mysql
  
  Hello all, I am a PHP beginner and was wondering if I could get some 
  help from some of the more experienced on this list.  I have been 
 trying to use an html form (with textboxes, radio buttons, and 
 textareas) to input data into a mysql database.  I am able to connect 
 fully with the database and am able to create tables in it, but when I 
 try to input information into the tables nothing happens. ever...  I 
 don't really know what to do from here, but I assume that a 
 configuration is not set properly between mysql, apache, windows, or 
 php.  I really don't know what it could be.  My code is here and I have 
 tried to simplify the form in order to get it working, so here is my 
 barebones code that hopefully has some errors:
  HTML:
  html
  head
  titleSimplify/title
  /head
  body
  form action=addform.php method=post
  Login: input type=text name=login
  input type=submit
  /form
  /body
  /html
  
  PHP file called addform.php:
  
  ?
  
  $user=chris;
  $database=test;
  mysql_connect(localhost,$user);
  @mysql_select_db($database) or die(unable to select database);
  $query=INSERT INTO login VALUES ('$login');
  mysql_query($query);
  mysql_close();
  ?
  
  Login is the name of the table on the database named test.
  
  I stopped using a password because it wouldn't let anything work even 
  table creation when I tried to use a password.  Any help that anyone 
 could give would be greatly appreciated; there is probably some 
 grievious error in this script.  Thanks, Chris

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



RE: [PHP-DB] Re: PHP help

2003-06-30 Thread Snijders, Mark
think you miss something


try this : 

print_r($_POST);


cause from a specific php version (above 4) al lthe form vars are in a
special array called ($_POST)   (when submitted by a form)


so you should do:

query=INSERT INTO login VALUES ('$_POST[login]');

I also removed a   you got one to many


hope this works!


-mark-




-Original Message-
From: Shivanischal A [mailto:[EMAIL PROTECTED]
Sent: maandag 30 juni 2003 13:13
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: PHP help


 My System:
 Windows 98
 Apache 1.3.27
 PHP 4
 mysql

 Hello all, I am a PHP beginner and was wondering if I could get some help
from some of the more experienced on this list.  I have been trying to use
an html form (with textboxes, radio buttons, and textareas) to input data
into a mysql database.  I am able to connect fully with the database and am
able to create tables in it, but when I try to input information into the
tables nothing happens. ever...  I don't really know what to do from here,
but I assume that a configuration is not set properly between mysql, apache,
windows, or php.  I really don't know what it could be.  My code is here and
I have tried to simplify the form in order to get it working, so here is my
barebones code that hopefully has some errors:
 HTML:
 html
 head
 titleSimplify/title
 /head
 body
 form action=addform.php method=post
 Login: input type=text name=login
 input type=submit
 /form
 /body
 /html

 PHP file called addform.php:

 ?

 $user=chris;
 $database=test;
 mysql_connect(localhost,$user);


localhost should probably be  $localhost  OR'localhost'(?)


 @mysql_select_db($database) or die(unable to select database);
 $query=INSERT INTO login VALUES ('$login');


you can safely say -  $query=INSERT INTO login VALUES ('$login') ;


 mysql_query($query);
 mysql_close();
 ?

 Login is the name of the table on the database named test.

 I stopped using a password because it wouldn't let anything work even
table creation when I tried to use a password.  Any help that anyone could
give would be greatly appreciated; there is probably some grievious error in
this script.  Thanks, Chris


mentioning a password should do no harm. try  $query=INSERT INTO login
VALUES ('$login', password($password));
password() is a mysql function. its irreversible; somehting on the like that
we have on LiNUX systems

regards,
-shiva



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



RE: [PHP-DB] RE: [PHP] help, array values echoed as Array on loop!

2002-09-02 Thread victor

Ok, wrong mailing list!

- Victor  www.argilent.com

-Original Message-
From: victor [mailto:[EMAIL PROTECTED]] 
Sent: Monday, September 02, 2002 3:46 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] RE: [PHP] help, array values echoed as Array on loop!

Ok, if I change $ID_arr[] to $ID_arr I think it gives me what I want.

- Victor  www.argilent.com

-Original Message-
From: Victor [mailto:[EMAIL PROTECTED]] 
Sent: Monday, September 02, 2002 3:39 PM
To: 'PHP'
Subject: [PHP] help, array values echoed as Array on loop!

I have tried both ways to loop through an array and output the data and
verify that the array is an array and I get no erros but I get this
value, which should not be so.


Here I'm checking if it's an array:

if (!is_array($ID_arr)) { # show error if no array
echo '$ID_arr is not an array.';
}

here I'm counting the keys but it only outputs as 1:

$key = count($ID_arr);
echo $key;

here are two loops that do the same thing and they both output Array:

for($i = 0; $i  count($ID_arr); $i++) {
echo $ID_arr[$i];
}

foreach($ID_arr as $ind_picture) {
echo $ind_picture;
}

Why? If it helps, in order to get the array, the values were taken from
a database and exploded from a coma delimited string.

$ID_arr[] = explode(',', $pictures); # make db data into array

This is the string:

15,16,17,18,19

I want each array element to contain 

= 15 
= 16
= 17
etc...

why does it echo as Array?

- Victor  www.argilent.com


__ 
Post your free ad now! http://personals.yahoo.ca

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

__ 
Post your free ad now! http://personals.yahoo.ca

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

__ 
Post your free ad now! http://personals.yahoo.ca

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




Re: [PHP-DB] RE: [PHP] Help needed - need to access a value from DB into all pages

2002-02-21 Thread William Fong

Sessions seems to be the popular way to go.  It's stored at the server, so
you don't have to worry about any clients disabling cookie support.



--
William Fong - [EMAIL PROTECTED]
Phone: 626.968.6424 x210  |  Fax: 626.968.6877
Wireless #: 805.490.7732|  Wireless E-mail: [EMAIL PROTECTED]




- Original Message -
From: Martin Towell [EMAIL PROTECTED]
To: 'WG4- Cook, Janet' [EMAIL PROTECTED]; PHP db list
[EMAIL PROTECTED]; PHP List [EMAIL PROTECTED]
Sent: Thursday, February 21, 2002 4:06 PM
Subject: [PHP-DB] RE: [PHP] Help needed - need to access a value from DB
into all pages


: I can think of three ways you could do this.
:
: 1. as a cookie
: 2. using sessions
: 3. put it in every link
:
: Martin
:
: -Original Message-
: From: WG4- Cook, Janet [mailto:[EMAIL PROTECTED]]
: Sent: Friday, February 22, 2002 10:59 AM
: To: PHP db list; PHP List
: Subject: [PHP] Help needed - need to access a value from DB into all
: pages
:
:
: Hi there,
:
: I am struggling with a concept and can't seem to find a way to do it so
: hoping you all can help.
:
: We want to use PHP with MySql Db.
: For security reasons on the DB, it is to be accessed only through this
front
: end i.e. via the internal web
: Each user will have a number of levels of access to various parts of the
: system, so the obvious design is one where there is only 1 real login to
the
: MySQL db (i.e. the system will auto log everyone in as this without them
: knowing it), and then the user is validated against a table in my DB which
: holds the access rights. I can get through the login OK, and get my table
to
: return USERID for this person. Now I need that USERID available to ALL
: other pages so I can use it to determine what parts of screens to show,
and
: what to allow them to do.
:
: My question is how do I make this variable available to all pages??  Do I
: have to include it with the variables passed to each page or is there a
: simpler way of doing it.  Can I put the variable in an include file and
: include it in every page - will that work?.
:
: Surely someone must have had a similar situation before and can tell me
how
: they solved it.
:
: Many thanks
:
: Janet
:
:
:
:
: --
: PHP General 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] Re: [PHP] help - to get client IP

2002-02-11 Thread Jonathan Underfoot

This is what I use, I think I got it off the online documentation.  I use it
to track users and it checks for proxys.

if ($HTTP_SERVER_VARS[HTTP_X_FORWARDED_FOR] != )
{$IP = $HTTP_SERVER_VARS[HTTP_X_FORWARDED_FOR];
$proxy = $HTTP_SERVER_VARS[REMOTE_ADDR];
$host = @gethostbyaddr($HTTP_SERVER_VARS[HTTP_X_FORWARDED_FOR]);}

else
{$IP = $HTTP_SERVER_VARS[REMOTE_ADDR];
$host = @gethostbyaddr($HTTP_SERVER_VARS[REMOTE_ADDR]);}

-Jonathan

- Original Message -
From: Jeroen Timmers [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: [PHP-DB] [EMAIL PROTECTED]
Sent: Monday, February 11, 2002 7:43 AM
Subject: [PHP-DB] Re: [PHP] help - to get client IP


 Someone please help me of how I could get the client IP using PHP, when i
 use $remote_addr it gives me the server IP, Kindly help how I could get
the
 IP of clients who are connected to my server or website.

 $ip = gethostbyname($REMOTE_HOST);

 the you got the IP of the remote user.

 Jeroen Timmers




 --
 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