Posts

Showing posts from September, 2012

Difference between session_register and $_SESSION[] in phpsession_register and $_SESSION[] in php

We can use either   session_register   or $_SESSION for registering session variable in php. Find below the difference between both of them.   session_register () is a   function   and   $_SESSION   is a superglobal   array . session_register() is used to register a session variable and it works only when register_globals is   turned on . ( Turning ON register_globals will create mesh-ups, but some applications (e.g OScommerce) requires turning ON of register_globals) But $_SESSION works even when register_globals is turned off. If   session_start()   was not called before   session_register()   is called, an implicit call to session_start() with no parameters will be made. But $_SESSION requires session_start() before use. session_register function returns boolean value and $_SESSION returns string value session_register() function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 6.0.0. We know that Webpages are getting displayed using stateless Protocol. So there should be

how to set time_zone in php [solve] joomla ,cakephp,codeingiter ,core php

ini_set('date.timezone', 'Asia/Calcatta'); or date_default_timezone_set( 'Asia/Calcatta')

PHP and MySQL Stored Procedure Exec Problem

<? php $Server = "127.0.0.1" ; $DataBase = "tedt" ; $UserName = "root" ; $PassWord = "124@#" ; $Conn = mysqli_connect ( $host , $UserName , $PassWord ); if (! $Conn ) { die ( "Could not connect to server : " . mysqli_error ()); } else { mysqli_select_db ( $Conn , $DataBase ) or die ( "Could not connect to database" ); } ?> <? php print "Procedure #1" ; $res = $Conn ->query ( "CALL storepro;" ); print_r($ res ) ; ? >

json using php tutorial

After reading this post, you will be able to understand, work and test JSON code with PHP. There are already lots of tutorials out there on handling JSON with PHP, but most of them don't go much deeper than throwing an array against json_encode and hoping for the best. This article aims to be a solid introduction into JSON and how to handle it correctly in combination with PHP. Also, readers who don't use PHP as their programming language can benefit from the first part that acts as a general overview on JSON. JSON (JavaScript Object Notation) is a data exchange format that is both lightweight and human-readable (like XML, but without the bunch of markup around your actual payload). Its syntax is a subset of the JavaScript language that was standardized in 1999 . If you want to find out more, visit the official website . The cool thing about JSON is that you can handle it natively in JavaScript, so it acts as the perfect glue between server- and client-side appli

curl service example in php

<?php $ch = curl_init("http://rss.news.yahoo.com/rss/oddlyenough"); $fp = fopen("example_homepage.html", "w"); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); curl_close($ch); fclose($fp); $xml = simplexml_load_file('example_homepage.html'); print "<ul>\n"; foreach ($xml->channel->item as $item){ print "<li>$item->title</li>\n"; } print "</ul>"; ?>

top core php interview questions and answers

1) What is PHP? PHP is a web language based on scripts that allows developers to dynamically create generated web pages. 2) What does the initials of PHP stand for? PHP means PHP: Hypertext Preprocessor. 3) Which programming language does PHP resemble to? PHP syntax resembles Perl and C 4) What does PEAR stands for? PEAR means “PHP Extension and Application Repository”. it extends PHP and provides a higher level of programming for web developers. 5) What is the actually used PHP version? Version 5 is the actually used version of PHP. 6) How do you execute a PHP script from the command line? Just use the PHP command line interface (CLI) and specify the file name of the script to be executed as follows: ? 1 php script.php 7) How to run the interactive PHP shell from the command line interface? Just use the PHP CLI program with the option -a as follows: ? 1 php -a 8 What are the correct and the most two common way to start and finish a PHP block of code? The two most  common ways to start