Portal Home > Knowledgebase > Articles Database > XAMPP Problem


XAMPP Problem




Posted by argenty, 01-04-2012, 05:27 PM
I installed XAMPP Server to start learning PHP, i liked to test but it is not working. this is my code here is the result I tested the same code on my website and there is not any warning can you tell me where is the problem?

Posted by argenty, 01-04-2012, 05:34 PM
i just checked the phpinfo() but seems i'm running on different versions PHP Version 5.3.8 - xampp server PHP Version 5.2.17 - my website This could be the problem ?

Posted by crazylane, 01-04-2012, 05:37 PM
Your website has Notice warnings suppressed. You could use isset. if (isset($_COOKIE['pseudo'])) { $pseudo = $_COOKIE['pseudo']; }

Posted by argenty, 01-04-2012, 05:53 PM
ooops, there is no another solution?

Posted by Jack Sparrow, 01-04-2012, 08:37 PM
Their is always solution add this at the top of the page error_reporting(E_ALL ^ E_NOTICE); to be like this

Posted by argenty, 01-05-2012, 02:57 AM
This sounds very nice, but when we are talking about programming, this code is bad ? in the older version of PHP, it works, but i'm still seeing warning if i didn't put what do you suggest me, should i use always ? Thanks

Posted by Jack Sparrow, 01-05-2012, 03:40 AM
Most of professional programmers using error_reporting(E_ALL ^ E_NOTICE); to hide the PHP notices if you want to create a page or script without adding this line to hide the Notics then you need to define all Vars you are using like here ull got Notice about $username not defined so you have 2 solutions 1- to add hide notics line 2- to define all the undefined vars and to define all the undefined vars you need to make it blank before you make it handle something like so its normal if you add hide all notic's into your script

Posted by argenty, 01-05-2012, 05:06 AM
QUOTE=Jack Sparrow;7886386]but when $_COOKIE is empty the warning will be shown.

Posted by Jack Sparrow, 01-05-2012, 09:03 AM
for session and cookie use isset like $username = ( isset($_cookie['username']) ) ? $_cookie['username'] : '' ;

Posted by argenty, 01-06-2012, 01:21 AM
nothin printed

Posted by Jack Sparrow, 01-06-2012, 02:22 AM
first u define the $session with session_id() , then you define again the session with cookie if set if its not make $session blank to fix this you need to add the var $session again to false statement to be like this here if $_COOKIE['session'] is set from another page or previous time its well be printed else if its not set print the session_id()



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
DIYHosting Down! (Views: 678)

Language: