New Interview Questions

1. how to get the ip address. 2. diff. b/w echo,print, print_r. 3. ftp php (how we connect to ftp)(ans: ftp_connect() “Opens an FTP connection”) 4. paypal 5. php oops 6. pconnect, connect 7. Explain join queries 8. Example of Join Query(join,left,right) 9. step of joomla template 10. function overriding and overloading. 11. array merge … Read more

Categories PHP

paging in PHP

$count_rec=400; //give here the total number of records if($count_rec>0) { $total_pages=ceil($count_rec/20); $page=$_REQUEST[‘page’]; $start=($page-1)*20+1; $end=$start+19; $x=$start; //foreach ($photosetList[photoset] as $setList) { //$sizes = $f->photos_getSizes($setList[primary]); if($end%$x<=19) { echo “”; } //} } echo ” “; if($end>$count_rec) { $end=$count_rec; } if($page==1) { echo “<<“; }else { $back=$page-1; ?> <a href=”pagingPhp.php?page=”><<<</a> $val=ceil($count_rec/20); echo “Page :- “.$_REQUEST[‘page’]; if($page==$val) { echo … Read more

Categories PHP

How to increase your session time out PHP

$values = $_SESSION; // keep session config $trans = ini_get( ‘session.use_trans_sid’ ); if( $trans ) { ini_set( ‘session.use_trans_sid’, 0 ); } $cookie = session_get_cookie_params(); // create new session id $id = 0; while (strlen($id) < 32) { $id .= mt_rand(0, mt_getrandmax()); } $id = md5( uniqid($id, true)); // kill session session_destroy(); $cookie[‘lifetime’] = 7*60; // … Read more

Categories PHP

Prime Number Program

function IsPrime($number) { if ($number < 2) { /* We don’t want zero or one showing up as prime */ return FALSE; } for ($i=2; $i<=($number / 2); $i++) { if($number % $i == 0) { /* Modulus operator, very useful */ return FALSE; } } return TRUE; } for($i = 0; $i < 100; … Read more

Categories PHP

change date format very easy in php

If you have date in this 11-07-08 format, you can easily change the date according to you. like this: formatted_date = date(‘Y-m-d’,strtotime($date)); strtotime() returns the unix timestamp and you can use this timestamp in date() and get your date. I hope its help you. Thanks! Enjoy Programming 🙂

Categories PHP