Current location: Hot Scripts Forums » Programming Languages » PHP » README: Common Questions


README: Common Questions

Reply
  #1 (permalink)  
Old 07-13-05, 03:51 AM
perleo perleo is offline
Coding Addict
 
Join Date: Jul 2003
Location: Ireland
Posts: 269
Thanks: 0
Thanked 0 Times in 0 Posts
README: Common Questions

I have watched this forum for a good while and I decided to make this post, hopefully it will go sticky and be a reference for people who ask the common questions. So here are some questions commonly asked

1) Warning: session_start(): Cannot send session cache limiter

This is usually casued when the session_start() function is NOT called at the top of the
PHP script. This function must be the first line of code in a script. EG
PHP Code:

  <?php

   
/* You can put comments here as the PHP parser ignores any comments */
  
session_start();

  
//continue on with your code.....
  
?>
Ref: http://ie2.php.net/manual/en/function.session-start.php

2)How do I do index.php?foo=bar
This is repeated several times on the forum. To pass values through the URL you can use the HTTP GET feature or $_GET in PHP. In this URL , index.php?foo=bar , the foo is the variable and bar is the value, so to get it in PHP do the following

PHP Code:

  $foo $_GET['foo'];

  
//print foo
  
echo $foo;  //this will printout bar 
Several variables can be passed over the url , after the first one, the & separates the variables like so: index.php?foo=bar&car=wheels

Ref:


Iam sure there is alot more, so hopefully we can add to this post...http://ie2.php.net/manual/en/reserve....variables.get
Reply With Quote
  #2 (permalink)  
Old 07-13-05, 03:56 AM
FiRe FiRe is offline
Code Guru
 
Join Date: Oct 2004
Location: UK
Posts: 801
Thanks: 0
Thanked 0 Times in 0 Posts
I made a similar post a few pages back...
__________________
Alexa Share <-- Trade virtual shares in websites with this online game.

codR.us <-- Submit and vote for your favorite code snippets with codR.us.

XEWeb.net <-- The ultimate PHP resource network.
Reply With Quote
  #3 (permalink)  
Old 07-13-05, 04:08 AM
perleo perleo is offline
Coding Addict
 
Join Date: Jul 2003
Location: Ireland
Posts: 269
Thanks: 0
Thanked 0 Times in 0 Posts
well have to bump this up, or get the admin to make it sticky...
Reply With Quote
  #4 (permalink)  
Old 07-13-05, 04:08 AM
dennispopel dennispopel is offline
Coding Addict
 
Join Date: Mar 2005
Posts: 263
Thanks: 0
Thanked 0 Times in 0 Posts
Hello,

Just to clear thing up: sometimes PHP gurus giving wrong answers to common problems or just do not explain everything. Problems with session_start() do not arise form not being called at the top of the page (like perleo says). It must be called before the first output to the client. The most common problem for this is not the fact that it is not called at the top of the page, but whitespace before the opening <? of whitespace after the closing ?> in included files.

In general this is not true that session_start() must be the first statement. It must occur before anything gets sent to browser, including whitespace outside the php blocks. Moreover, preceding session_start() can be any number of statements that do not output anyhting.
__________________
onPHP5.com - PHP5: Articles, News, Tutorials, Interviews, Software and more
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Really **wonderful** website for C interview questions!!!!! raja_narayan_2005 General Advertisements 7 05-07-11 03:09 PM
Frequently Asked PHP Questions FiRe PHP 1 07-01-05 03:08 AM
Really **wonderful** website for C interview questions!!!!! raja_narayan_2005 General Advertisements 0 06-22-05 01:32 AM
Really **wonderful** website for C interview questions!!!!! raja_narayan_2005 C/C++ 0 06-22-05 01:30 AM
Questions Script ... gillweb Job Offers & Assistance 0 02-08-05 02:14 PM


All times are GMT -5. The time now is 06:55 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.