[PHP-DB] RE: PHP4 on Windows using MSSQL
Thanks Ollie I guess this means using PHP4 MSSQL functions in Windows and PHP4 Sybase functions in Linux? On Tue, 2003-02-25 at 04:47, Oliver Cronk wrote: The MSSQL module for PHP DOES NOT USE ODBC. It uses the C library direct style of connecting to MSSQL. Use your enterprise manager to configure the appropriate users and permissions and you should be fine. Ollie Cronk www.cronky.net -Original Message- From: Kevin Gordon [mailto:[EMAIL PROTECTED] Sent: 24 February 2003 07:09 To: PHP Mail Subject: PHP4 on Windows using MSSQL Hi Everyone, From a Linux session: ~ # telnet 10.1.1.1 1433 Trying 10.1.1.1... Connected to 10.1.1.1. Escape character is '^]'. Connection closed by foreign host. From within NT4 Primary Domain Server: SQL Server Query Analyzer using the user login password applied in PHP (and created in MSSQL) Queries processed ok. In PHP must I use NT authenticated login / password? Both a PHP client on Linux and Windows receive the same error message: Warning: SQL error: [Microsoft][ODBC SQL Server Driver][Named Pipes]Specified SQL server not found., SQL state 08001 in SQLConnect in E:\Inetpub\wwwroot\php\ODBC_Driver.php on line 174 The PHP.ini file on NT4 has: ** [MSSQL] ; Allow or prevent persistent links. mssql.allow_persistent = On ; Maximum number of persistent links. -1 means no limit. mssql.max_persistent = -1 ; Maximum number of links (persistent+non persistent). -1 means no limit. mssql.max_links = -1 ; Minimum error severity to display. mssql.min_error_severity = 10 ; Minimum message severity to display. mssql.min_message_severity = 10 ; Compatability mode with old versions of PHP 3.0. mssql.compatability_mode = Off ; Valid range 0 - 2147483647. Default = 4096. ;mssql.textlimit = 4096 ; Valid range 0 - 2147483647. Default = 4096. ;mssql.textsize = 4096 ; Limits the number of records in each batch. 0 = all records in one batch. ;mssql.batchsize = 0 ; Use NT authentication when connecting to the server mssql.secure_connection = Off ; Specify max number of processes. Default = 25 ;mssql.max_procs = 25 ntwdblib.dll is in the correct Windows directory. Using a System DNS for ODBC. Should I be using a File DNS? Can I open up NT4 PDS to telenet to it? Any thoughts, comments? Many thanks, Kevin Gordon New Zealand -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Checkboxes to gather rows to delete
print input type=checkbox name=\rowid[.$row['rowid'].]\ value=\.$row['rowid'].\; You must put all of those checkbox values into an array and then use the foreach loop, to process the selected checkbox items)... print_r($rowid); would print out the contents of the generated array should be something like: Array( 4=4, 6=6, 1024=1024 ); with this you could generate a where clause with: where rowid in (4,6,1024) and you're done! :-) kind regards Christoph I have a mysql database with a table using one column as a primary key. (rowID). On a php page I use a query to list all of the rows of the table and have a checkbox beside each row that should be used to check if you would like to delete this row. Can someone give me an example using post to pull the boxes that need to be deleted. Thanks! Lewis -- CC -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Reporting tool for stats pulled from MySQL db
I have a stats tracking program and a page that displays stats for various dates/items depending on what options the user selects. I need to add some kind of external reporting tool, i.e. they'd like to download the information, preferably in Excel. I tried forcing Excel to open the data instead of the browser by sending headers: Header(Content-Type: application/vnd.ms-excel); Header(Content-Disposition: attachment; filename='stats.xls'); When I sent just the first one, all I got was a blank broswer page with a picture (application?) icon in the top left hand corner. Then I added the second header, which I found in a previous post in the archives, and that forced a download but of the page itself (stats_print.php). 1) What am I doing wrong? 2) Every posting I found in the archives said this is the easiest way. Is there another, harder but might work for me, way anyone would suggest of doing this? Thanks in advance, -Lisi -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Reporting tool for stats pulled from MySQL db
This is the easiest way but depending on what brouser you use and what version of excel you have the results vary somewhat, try using Content-Disposition: inline and then saving the the file from there, this works best for me, but its by no means perfect. I seem to recall that someone posted a php class on here that would output in excel format correctly but it only works if your using IIS etc. hope this helps -Original Message- From: Lisi [mailto:[EMAIL PROTECTED] Sent: 25 February 2003 09:41 To: PHP-DB Subject: [PHP-DB] Reporting tool for stats pulled from MySQL db I have a stats tracking program and a page that displays stats for various dates/items depending on what options the user selects. I need to add some kind of external reporting tool, i.e. they'd like to download the information, preferably in Excel. I tried forcing Excel to open the data instead of the browser by sending headers: Header(Content-Type: application/vnd.ms-excel); Header(Content-Disposition: attachment; filename='stats.xls'); When I sent just the first one, all I got was a blank broswer page with a picture (application?) icon in the top left hand corner. Then I added the second header, which I found in a previous post in the archives, and that forced a download but of the page itself (stats_print.php). 1) What am I doing wrong? 2) Every posting I found in the archives said this is the easiest way. Is there another, harder but might work for me, way anyone would suggest of doing this? Thanks in advance, -Lisi -- 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] Reporting tool for stats pulled from MySQL db
In the first line, what do you mean where the file is? Where I want it to be? It doesn't exist yet, I want to generate an Excel file from dynamic data. And I don't want it to be saved on the server, I just want the user to download it. Anyway, I tried changing Header(Content-Disposition: attachment; filename='stats.xls'); to Header(Content-Disposition: inline; filename='stats.xls'); without adding any of your other changes but I got the same icon in the corner. I'm using IE 6. -Lisi At 09:46 AM 2/25/03 +, George Pitcher wrote: Lisi, This is a modification of a script I use to download pdfs. It might just work ?php $fpd = E:\\MyFolder\\ . $fp . .xls; // where the file is $len = filesize($fpd); header(Content-Type: application/vnd.ms-excel); header(Content-Disposition: inline; filename=$fpd); header(Content-Title: $fpd); header(Content-Length: $len); readfile($fpd); ? George -Original Message- From: Lisi [mailto:[EMAIL PROTECTED] Sent: 25 February 2003 9:41 am To: PHP-DB Subject: [PHP-DB] Reporting tool for stats pulled from MySQL db I have a stats tracking program and a page that displays stats for various dates/items depending on what options the user selects. I need to add some kind of external reporting tool, i.e. they'd like to download the information, preferably in Excel. I tried forcing Excel to open the data instead of the browser by sending headers: Header(Content-Type: application/vnd.ms-excel); Header(Content-Disposition: attachment; filename='stats.xls'); When I sent just the first one, all I got was a blank broswer page with a picture (application?) icon in the top left hand corner. Then I added the second header, which I found in a previous post in the archives, and that forced a download but of the page itself (stats_print.php). 1) What am I doing wrong? 2) Every posting I found in the archives said this is the easiest way. Is there another, harder but might work for me, way anyone would suggest of doing this? Thanks in advance, -Lisi -- 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
[PHP-DB] RE: PHP4 on Windows using MSSQL
Yes, but I have never personally used Linux to connect to MSSQL so I can't really help you on that one. Although I hear that several people have done this I would really recommend it (as Linux isn't a supported client O/S for MSSQL). It is *fairly* straightforward on Windows - the hardest bit is making sure you have all the correct DLL's in the right places etc etc. I use MySQL/ Postgres these days so I can't really remember all the stuff I had to do to get MSSQL working with PHP but I will have a think and let you know if I think of anything that might be useful. After having another quick look at your error message at the bottom of your original email it might be worth looking at your MSSQL Server connection config dialogs - make sure that TCP/IP has been enabled (looks like you might just have named pipes). Regards Ollie Cronk -Original Message- From: Kevin Gordon [mailto:[EMAIL PROTECTED] Sent: 25 February 2003 08:05 To: Oliver Cronk Cc: PHP Mail Subject: RE: PHP4 on Windows using MSSQL Thanks Ollie I guess this means using PHP4 MSSQL functions in Windows and PHP4 Sybase functions in Linux? On Tue, 2003-02-25 at 04:47, Oliver Cronk wrote: The MSSQL module for PHP DOES NOT USE ODBC. It uses the C library direct style of connecting to MSSQL. Use your enterprise manager to configure the appropriate users and permissions and you should be fine. Ollie Cronk www.cronky.net -Original Message- From: Kevin Gordon [mailto:[EMAIL PROTECTED] Sent: 24 February 2003 07:09 To: PHP Mail Subject: PHP4 on Windows using MSSQL Hi Everyone, From a Linux session: ~ # telnet 10.1.1.1 1433 Trying 10.1.1.1... Connected to 10.1.1.1. Escape character is '^]'. Connection closed by foreign host. From within NT4 Primary Domain Server: SQL Server Query Analyzer using the user login password applied in PHP (and created in MSSQL) Queries processed ok. In PHP must I use NT authenticated login / password? Both a PHP client on Linux and Windows receive the same error message: Warning: SQL error: [Microsoft][ODBC SQL Server Driver][Named Pipes]Specified SQL server not found., SQL state 08001 in SQLConnect in E:\Inetpub\wwwroot\php\ODBC_Driver.php on line 174 The PHP.ini file on NT4 has: ** [MSSQL] ; Allow or prevent persistent links. mssql.allow_persistent = On ; Maximum number of persistent links. -1 means no limit. mssql.max_persistent = -1 ; Maximum number of links (persistent+non persistent). -1 means no limit. mssql.max_links = -1 ; Minimum error severity to display. mssql.min_error_severity = 10 ; Minimum message severity to display. mssql.min_message_severity = 10 ; Compatability mode with old versions of PHP 3.0. mssql.compatability_mode = Off ; Valid range 0 - 2147483647. Default = 4096. ;mssql.textlimit = 4096 ; Valid range 0 - 2147483647. Default = 4096. ;mssql.textsize = 4096 ; Limits the number of records in each batch. 0 = all records in one batch. ;mssql.batchsize = 0 ; Use NT authentication when connecting to the server mssql.secure_connection = Off ; Specify max number of processes. Default = 25 ;mssql.max_procs = 25 ntwdblib.dll is in the correct Windows directory. Using a System DNS for ODBC. Should I be using a File DNS? Can I open up NT4 PDS to telenet to it? Any thoughts, comments? Many thanks, Kevin Gordon New Zealand -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] mysql_fetch_array
Hi, Here is my code: ? require(util.php); $sql= new MySQL_class; $sql-Setup(user,user,localhost); $sql-connexion(materiel); $sql-Query(select nom from personne); $cpt=0; while($row=mysql_fetch_array($sql-result)) { print($cpt); print(br); print($row[nom]); print(br); $cpt++; } $sql-close; ? The personne table has 14 articles. but with this code i can see only 13 articles here is the output on a browser: 0BRUYÈRE 1COLLINEAU 2ELIAS 3GLOANEC 4HUGOT 5LE BRIS 6LE FLOCH 7LEMAUVIEL 8LOUVEL 9MARTINIERE 10OGUET 11THOMAS 12VASSELET What is the problem ? Thanks Franck -- Faites un voeu et puis Voila ! www.voila.fr -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Question concerning hostnames
I know this isn't the right group for this, but here we go. I have 2 URLs, on has some webspace attachted to it, the other one is being redirected the the first one. Example: http://www.pageOne.com has webspace. At the moment when you got to http://www.pageTwo.com you get to see http://www.pageOne.com in the address bar and the pageOne.com contents on the page. I want http://www.pageTwo.com to be redirected to http://www.pageOne.com/pageTwoindex.html, without losing the address http://www.pageTwo.com. Is there a way to catch and keep the original typed URL (http://www.pageTwo.com in this example) and redirect it to any other address? TIA Fedde -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Question concerning hostnames
[EMAIL PROTECTED] (2b4ever Php) writes: I want http://www.pageTwo.com to be redirected to http://www.pageOne.com/pageTwoindex.html, without losing the address http://www.pageTwo.com. Maybe something like header(location: http://www.pageOne.com/pageTwoindex.html?ref=http://.$_SERVER[HTTP_HOST].$_SERVER[PHP_SELF;]); on http://www.pageTwo.com Then $_GET[ref] will contain the referers url provided http://www.pageOne.com/pageTwoindex.html is a PHP file. If you just want it for logging purposes, the url will still be saved in the server log (at least if you use apache). -- --Fredrik In an organization, each person rises to the level of his own incompetency -- The Peter Principle -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: mysql_fetch_array
Maybe on the 14th record the while statement is false. Try do...while ??? Jochem F.Collineau wrote: Hi, Here is my code: ? require(util.php); $sql= new MySQL_class; $sql-Setup(user,user,localhost); $sql-connexion(materiel); $sql-Query(select nom from personne); $cpt=0; while($row=mysql_fetch_array($sql-result)) { print($cpt); print(br); print($row[nom]); print(br); $cpt++; } $sql-close; ? The personne table has 14 articles. but with this code i can see only 13 articles here is the output on a browser: 0BRUYÈRE 1COLLINEAU 2ELIAS 3GLOANEC 4HUGOT 5LE BRIS 6LE FLOCH 7LEMAUVIEL 8LOUVEL 9MARTINIERE 10OGUET 11THOMAS 12VASSELET What is the problem ? Thanks Franck -- Faites un voeu et puis Voila ! www.voila.fr -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP session problems
I have been having trouble with PHP sessions, the session variables are not able to be called through the script. If have commented the area at the bottome where the session variable is NULL when var dump is called to check it (about 20 lines from the bottom... depending on if the text is wrapping or not) here is the actual code == ? session_start(); session_register('valid_user'); session_register('name'); /* Start A Session */ include library/include/header.php ; include library/include/database.php ; /* Include a header file and a database connections/functions file */ if ( ( !isset ( $HTTP_COOKIE_VARS[username] ) ) ( !isset ( $proceed ) ) ( !isset ( $submit ) ) ) { /* The Cookie is not set, so load the page as if it is the first time */ ? form name=login method=post action=? echo $PHP_SELF; ? select name=staff ? $query = SELECT * FROM Staff ; $result = mysql_query($query) or die( mysql_error () ); While( $row = mysql_fetch_array($result) ) { ? option value=? echo $row[0]; ?? echo $row[1]; echo ; echo $row[2] ;?/option ? } ? /select input type=submit name=proceed value=proceed /form ? } elseif( ( !isset ( $HTTP_COOKIE_VARS[username] ) ) ( !isset ( $submit ) ) ( isset ( $proceed ) ) ) { /* The User is now attempting to register */ ? form name=register method=post action=? echo $PHP_SELF; ? ? $staffid = $HTTP_POST_VARS[staff]; $query = SELECT * FROM Staff WHERE StaffId = '$staffid'; $result = mysql_query($query) or die( mysql_error () ); $row = mysql_fetch_array($result); session_register('valid_user'); $_SESSION[valid_user] = $staffid; $_SESSION['name'] = $row[1]; ? table width=536 border=0 tr td width=274Welcome ? echo $row[1] ; ?/td td width=252nbsp;/td /tr tr tdnbsp;/td tdnbsp;/td /tr tr td height=30What is your National Insurance Number/td tdinput name=ni1 type=text size=2 maxlength=2 input name=ni2 type=text size=2 maxlength=2 input name=ni3 type=text size=2 maxlength=2 input name=ni4 type=text size=2 maxlength=2 input name=ni5 type=text size=1 maxlength=1/td /tr tr tdChoose a password/td tdinput name=pass1 type=password size=20/td /tr tr tdEnter it again/td tdinput name=pass2 type=password size=20 maxlength=20/td /tr tr tdinput type=submit name=submit value=submit /tr /table /form ? } elseif( ( !isset ( $HTTP_COOKIE_VARS[username] ) ) ( isset ( $submit ) ) ) { /* information for registration has been entered, lets check if it is valid */ $_SESSION['valid_user'] = $staffid ; $ni = $HTTP_POST_VARS[ni1] . $HTTP_POST_VARS[ni2] . $HTTP_POST_VARS[ni3] . $HTTP_POST_VARS[ni4] . $HTTP_POST_VARS[ni5] ; $query = SELECT * FROM Staff WHERE StaffId = '$staffid'; $result = mysql_query($query) or die( mysql_error () ); $row = mysql_fetch_array($result); /* HERE THE SESSION VARIABLE HAS NO VALUE... WHEN I CALL VARDUMP IT IS NULL */ var_dump($_SESSION[valid_user]); echo $ni ; echo $staffid; if( $ni == $row[4]){ echo ni check successful; if( $pass1 != $pass2 ){ echo Your Passwords are not the same ; } else{ $query = INSERT INTO Staff WHERE StaffId = '$staffid' password values ('$pass1'); if($result=mysql_query($query)){ echo your password has been set, Continue to the site; } } } } include library/include/footer.php ; ? _ Stay in touch with MSN Messenger http://messenger.msn.co.uk -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: PHP session problems
Is the session.save_path in php.ini set and does the directory it refers to exist? Jochem David Rice wrote: I have been having trouble with PHP sessions, the session variables are not able to be called through the script. If have commented the area at the bottome where the session variable is NULL when var dump is called to check it (about 20 lines from the bottom... depending on if the text is wrapping or not) here is the actual code == ? session_start(); session_register('valid_user'); session_register('name'); /* Start A Session */ include library/include/header.php ; include library/include/database.php ; /* Include a header file and a database connections/functions file */ if ( ( !isset ( $HTTP_COOKIE_VARS[username] ) ) ( !isset ( $proceed ) ) ( !isset ( $submit ) ) ) { /* The Cookie is not set, so load the page as if it is the first time */ ? form name=login method=post action=? echo $PHP_SELF; ? select name=staff ? $query = SELECT * FROM Staff ; $result = mysql_query($query) or die( mysql_error () ); While( $row = mysql_fetch_array($result) ) { ? option value=? echo $row[0]; ?? echo $row[1]; echo ; echo $row[2] ;?/option ? } ? /select input type=submit name=proceed value=proceed /form ? } elseif( ( !isset ( $HTTP_COOKIE_VARS[username] ) ) ( !isset ( $submit ) ) ( isset ( $proceed ) ) ) { /* The User is now attempting to register */ ? form name=register method=post action=? echo $PHP_SELF; ? ? $staffid = $HTTP_POST_VARS[staff]; $query = SELECT * FROM Staff WHERE StaffId = '$staffid'; $result = mysql_query($query) or die( mysql_error () ); $row = mysql_fetch_array($result); session_register('valid_user'); $_SESSION[valid_user] = $staffid; $_SESSION['name'] = $row[1]; ? table width=536 border=0 tr td width=274Welcome ? echo $row[1] ; ?/td td width=252nbsp;/td /tr tr tdnbsp;/td tdnbsp;/td /tr tr td height=30What is your National Insurance Number/td tdinput name=ni1 type=text size=2 maxlength=2 input name=ni2 type=text size=2 maxlength=2 input name=ni3 type=text size=2 maxlength=2 input name=ni4 type=text size=2 maxlength=2 input name=ni5 type=text size=1 maxlength=1/td /tr tr tdChoose a password/td tdinput name=pass1 type=password size=20/td /tr tr tdEnter it again/td tdinput name=pass2 type=password size=20 maxlength=20/td /tr tr tdinput type=submit name=submit value=submit /tr /table /form ? } elseif( ( !isset ( $HTTP_COOKIE_VARS[username] ) ) ( isset ( $submit ) ) ) { /* information for registration has been entered, lets check if it is valid */ $_SESSION['valid_user'] = $staffid ; $ni = $HTTP_POST_VARS[ni1] . $HTTP_POST_VARS[ni2] . $HTTP_POST_VARS[ni3] . $HTTP_POST_VARS[ni4] . $HTTP_POST_VARS[ni5] ; $query = SELECT * FROM Staff WHERE StaffId = '$staffid'; $result = mysql_query($query) or die( mysql_error () ); $row = mysql_fetch_array($result); /* HERE THE SESSION VARIABLE HAS NO VALUE... WHEN I CALL VARDUMP IT IS NULL */ var_dump($_SESSION[valid_user]); echo $ni ; echo $staffid; if( $ni == $row[4]){ echo ni check successful; if( $pass1 != $pass2 ){ echo Your Passwords are not the same ; } else{ $query = INSERT INTO Staff WHERE StaffId = '$staffid' password values ('$pass1'); if($result=mysql_query($query)){ echo your password has been set, Continue to the site; } } } } include library/include/footer.php ; ? _ Stay in touch with MSN Messenger http://messenger.msn.co.uk -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: PHP session problems
[EMAIL PROTECTED] (David Rice) writes: I have been having trouble with PHP sessions, the session variables are not able to be called through the script. If have commented the area at the bottome where the session variable is NULL when var dump is called to check it (about 20 lines from the bottom... depending on if the text is wrapping or not) [ snip ] ? session_start(); session_register('valid_user'); session_register('name'); /* Start A Session */ - Is register_globals on or off? - Which PHP version? In PHP 4.2, I think, you have to use $_SESSION[foo] = bar instead of session_register(foo) if register_globals is off. This is afaicr fixed in 4.3. [ snip ] form name=register method=post action=? echo $PHP_SELF; ? ? [ snip ] session_register('valid_user'); You can't register a session variable after output. You have already registered it, just set $valid_user = 'something'. I might not remember everything completely, but the manual will at least give you the correct answers if mine are wrong. ;-) -- --Fredrik In an organization, each person rises to the level of his own incompetency -- The Peter Principle -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Problem with session
Hello everyone, I was wondering if anyone can help me with solvoing this problem. For some reason, the session_is_registered() function does not seem to see the session when the page is reloaded. The pages following through all work, except if the user comes back to the index page. At that point the session_ID is incremented. If at the index page, the reload button is continuously pressed, even-though the browser has not been closed, session_is_registered() function fails to find the session and starts a whole new session. I would sincerely appreciate it if anyone may be able to help me out with this. Thanks, -AM p.s. The code I'm talking about is below: ? session_start(); $user_ip= getenv('REMOTE_ADDR'); $user_host = getenv('REMOTE_HOST'); $user_agent = getenv('HTTP_USER_AGENT'); if (!session_is_registered(session_id)) { $db_conn = mysql_pconnect(pals.wright.edu, pals_user, bytes); if (!$db_conn) { $message = $message . Error: Could not connect to database pals.brbr; } mysql_select_db(pals); $query = INSERT INTO session (begdateTime, ip_address, platform) VALUES (now(), '.$user_ip.', '.$user_agent.'); $result = mysql_query($query); $session_id = mysql_insert_id(); if ($result) { $status = session_register(session_id); $isit = session_is_registered(session_id); $message = $message . brbrYour session ID is: $session_idbrbr; } else { $message = $message . Error: Failed to register session id into database.brbr; } } else { $message = $message . You already have a session id: $session_idbrbr; } ?
[PHP-DB] Array key problem
Hi! Anyone got an idea what the problem may be with the following code $test[]=a; $test[]=b; foreach ($test as $key=$value) { if($key == something) echo $key } even though theres no key in the array named something the code will print the key 0 Thanks
Re: [PHP-DB] Array key problem
On Wednesday 26 February 2003 00:37, Jorge Miguel Fonseca Martins wrote: As this has nothing to do with databases you should post to the php-general list. $test[]=a; $test[]=b; foreach ($test as $key=$value) { if($key == something) echo $key } even though theres no key in the array named something the code will print the key 0 PHP is doing automatic type conversion for you. Use: if ($key === something { ... } instead. See manual for details. -- 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 -- /* If I were a grave-digger or even a hangman, there are some people I could work for with a great deal of enjoyment. -- Douglas Jerrold */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] SESSIONS
Here's something i can't get working it won't go to the last clause of this page i don't think it can set the session variable anyone see what im doing wrong? i need more caffeine to get my brain fired up today lol.. === ? session_start();? HTML head /head body ? if ( !$SUBMIT ){ ? form action=? echo $PHP_SELF; ? method=post name=TEST input name=name type=text value=name size=20 maxlength=20 input name=SUBMIT type=submit value=SUBMIT /form ? } elseif($SUBMIT){ $_SESSION[name] = $HTTP_POST_VARS[name]; ? a href=? echo $PHP_SELF; ? next /a ? } elseif( ( $SUBMIT ) ( isset ( $_SESSION[name] ) ) ) { echo $_SESSION[name]; } ? /body /HTML _ Stay in touch with absent friends - get MSN Messenger http://messenger.msn.co.uk -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] SESSIONS
You need to register you varible first with the session -Original Message- From: David Rice [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 25, 2003 3:10 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] SESSIONS Here's something i can't get working it won't go to the last clause of this page i don't think it can set the session variable anyone see what im doing wrong? i need more caffeine to get my brain fired up today lol.. === ? session_start();? HTML head /head body ? if ( !$SUBMIT ){ ? form action=? echo $PHP_SELF; ? method=post name=TEST input name=name type=text value=name size=20 maxlength=20 input name=SUBMIT type=submit value=SUBMIT /form ? } elseif($SUBMIT){ $_SESSION[name] = $HTTP_POST_VARS[name]; ? a href=? echo $PHP_SELF; ? next /a ? } elseif( ( $SUBMIT ) ( isset ( $_SESSION[name] ) ) ) { echo $_SESSION[name]; } ? /body /HTML _ Stay in touch with absent friends - get MSN Messenger http://messenger.msn.co.uk -- 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
[PHP-DB] Session troubles, could this be my isp's fault?
I Have made two pages, sess2.php and sess3.php trying to create a session variable then access it in the other page. now when i try and call the session in the second page i get no value, and i have tried var_dump, and it gives me NULL anyone know if there is a reason for this?! page 1 is like this = ? session_start();? html head titleSession Test/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /head body ? session_register(name); $_SESSION[name] = dave; echo $_SESSION[name]; ? br a href=sess3.php next /a /body /html _ Surf together with new Shared Browsing http://join.msn.com/?page=features/browsepgmarket=en-gbXAPID=74DI=1059 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: PHP session problems
[EMAIL PROTECTED] (Fredrik De Vibe) writes: You can't register a session variable after output. You have already registered it, just set $valid_user = 'something'. Sorry, I was a bit too quick here. You _can_ register session variables after output... -- --Fredrik The chief cause of problems is solutions. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php