[PHP-DB] RE: PHP help question
The Database is created on PC A... I'm working on PC B... and my problem is that i am not able to connect to the PC A Database using the IP address as a host (since the database is not on my machine). but if i'm on PC A i can connect with the localhost. The question is that: do i need any configuration so i can access the database? First things first: This has nothing to do with PHP itself, it's just a configuration issue. You need to check the following things: Is your configuration on PC B set up to the right IP (as host), db, username and password? On PC A, what host is associated with the user? If it's localhost, it won't work. I think that you can set up the same user for localhost and any host with different passwords, make sure that's not the case (or that you have the right password on PC B). Finally, do any firewalls on PC B or PC A or other network constraints let the communication through? This is all fairly basic, but I hope it helps. Cheers, Matthias -- Matthias Willerich http://www.contentwithstyle.co.uk -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: [PHP] Help: Get the value of pi up to 200+ digits?
strange, with your code, mine cuts out at 49 significant digits: 3.141592653589793115997963468544185161590576171875 it must be a system-specific limitation. we need more information on what you are trying to do, *exactly*. be as detailed and specific as possible. On Sep 1, 2005, at 10:57 AM, Wong HoWang wrote: Dear Jordan, I know what you mean. But you may try this one and you will know: ?php ini_set('precision',200); echo pi(); ? the result is the same as 16!!! So that's why I ask this question! I am not stupid like that! Please help, thx! Jordan Miller [EMAIL PROTECTED] wrote:[EMAIL PROTECTED] http://us3.php.net/manual/en/ini.core.php#ini.precision precision sets the number of significant digits, *NOT* the number of digits displayed after the decimal point. If you want to get pi out to 16 decimal places you need a precision of *17* because the beginning 3 is a significant digit. Your code does exactly this, displaying pi with 15 decimal places. Jordan On Sep 1, 2005, at 8:06 AM, Wong HoWang wrote: Dear all, I'm trying to do like this but failed: ?php ini_set('precision',16); echo pi(); ? How can I get more digits after . ? Can anyone help? Thx! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- 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
[PHP-DB] Re: PHP help
$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 - Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: PHP help
snip 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(); ? /snip Okay the line $query is wrong. So I quote... QUOTE $query=INSERT INTO login VALUES ('$login'); /QUOTE You have ('$login'); ... Why the before the '$login? It should be: $query=INSERT INTO login VALUES ('$login'); Goodluck! http://mobile.yahoo.com.au - Yahoo! Mobile - Check compose your email via SMS on your Telstra or Vodafone mobile. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[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
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
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
[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
RE: [PHP-DB] RE: [PHP] help, array values echoed as Array on loop!
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
[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
Re: [PHP-DB] RE: [PHP] Help needed - need to access a value from DB into all pages
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
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