php

How to get delay of 30 sec in current time in php ?

Date("F d Y H:i:s") gives current time in php. How can I get delay of 30 secs and 1 min in current time using php, not sure but something like Date ("F d Y H:i:s-30") or Date("F d Y H:i-1:s") ? ...

PHP MVC Framework Design

Hi there, I currently ran into a problem I can not really solve by myself: I ve started to code a "small" framework (browsergame-framework), which follows the MVC pattern in some way. Now I have my index, bootstrap, db adapter, dispatcher, wrapper, but I do not really know "how" to link them. I coded their methods etc. but I do not kn...

Facing issue generating pdf using fpdf

I am getting http500 for the code below,I am not sure what is wrong. I am new to php. I have checked that PDF.php is in the right directory and so does fonts <?php define('FPDF_FONTPATH','/home/php/File/PDF/fonts/'); require('/home/php/File/PDF.php'); $pdf=new FPDF('P', 'mm', array(100,150)); $pdf->AddPage(); $pdf->SetFont('times'); $pd...

Why do I get 31 Dec 1969 as my last modified filename using filemtime in php ?

I am newbie to php and so please do not mind me asking this question but am really getting confused as to why filemtime(filename.txt)gives me as 31 Dec 1969 as my last modified time ? ...

Modified preorder tree traversal - finding the next node

Hi, I have this data: id | parent_id | lft | rgt | name ===================================== 1 | 0 | 1 | 8 | abc 2 | 3 | 5 | 6 | jkl 3 | 1 | 2 | 3 | def 4 | 0 | 9 | 10 | mnno 5 | 1 | 4 | 7 | ghi I need to traverse this hierarchy in this order (ids): 1 > 3 > 5 > 2 > 4 H...

How to get instance ID with PHP

I'm looking for a way to get the instance ID of a given object / resource with PHP, the same way var_dump() does: var_dump(curl_init()); // resource #1 of type curl var_dump(curl_init()); // resource #2 of type curl How can I get the instance count without calling var_dump()? Is it possible? ...

taskkill from PHP exec

Hello all, I have just tried to execute this: function kill_hr(){ exec("taskkill /IM uper.exe", $output = array(), $return); print_r($output); echo "<br />".$return; } However, the output is this and its not very useful: Array ( ) 1 When the process doesn't exist its this: Array ( ) 128 I am trying to work...

Best Step by Step tutorial for Symfony - (I am running PHP on Windows)

I have tried to follow the symfony tutorial here: http://www.symfony-project.org/book/1_2/03-Running-Symfony It's incoherent : It says to download the sandbox but the rest of the tutorial seems for the non-sandbox version. It's not a step by step as it seems and I can't get the same result. This is really frustrating and if I haven't a...

Problem with login button value

Hi I've just started couple of days ago with codeigniter, I have a following problem. When I set value of login button to "" (no value) in order to style it with css properly the login form won't work, the value needs to be login, is there a way arround it I'm sure there is got to be the way.. Here is some code .. Controller : <?php c...

How to take out the first part of array?

The following function out-puts an array and html. I don't want to have <li><a href="http://127.0.0.1/ci_okadadesign/index.php/admin/menus/r"&gt;r&lt;/a&gt;&lt;/li&gt; Could anyone tell me how to achive it please? Function function getTopMenus(){ $data[0] = 'root'; $this->db->where('parentid',0); $Q = $this->db->ge...

Php <? tags on WAMP

Hi, I just installed WAMP, and I can't get my <? to work. Is there a module I need to enable? Thanks. ...

Php form validation with an array - print the name of a variable

Hi, I am trying to do form validation by putting the post values into variables and those variables into an array and then cycling through them and outputting error messages for fields that are not filled in. I am having two issues. Firstly, the if statement is running for all the values even if the field is empty or is == to 'undefined...

Replacing a string inside a string in PHP

I have strings in my application that users can send via a form, and they can optionally replace words in that string with replacements that they also specify. For example if one of my users entered this string: I am a user string and I need to be parsed. And chose to replace and with foo the resulting string should be: I am a user s...

How to have pages without filenames (e.g. http://localhost/site/logoff)

I have a test site. I want the user to be able to logoff, but it looks ugly to go to: 'localhost/site/index.php?logoff=y'. I'm a newby at PHP, and it's probably pretty obvious how to do this, but... How would I do this? I want the logoff link to go to 'localhost/site/logoff' Any help appreciated. Thanks ...

Display resulst from a query with PHP (Wordpress)

Trying to display results from an sql query in PHP: SELECT * FROM wp_celebcount ORDER BY count DESC I'm trying to display two columns: wp_celebcount.name & wp_celebcount.count Having trouble getting the result to show with PHP - I want to show this result on my index.php Wordpress theme file. Thanks for the help... ...

get a date 6 years from now?

i want to have a date 6 years from now? how do i do that? ...

trigger jquery with php?

my php code will check after a condition. if the condition is true i want it to trigger a jquery code that displays a box. i wonder how i can trigger a jquery code with php? ...

How to reset a variable to NULL in PHP?

I can use isset($var) to check if the variable is not defined or null. (eg. checking if a session variable has been set before) But after setting a variable, how do I reset it to the default such that isset($var) returns false? ...

How to determine if a PHP file is loaded via cron/command line

I need to determine whether the PHP file is being loaded via cron or command line within the code. How can I do this? ...

Need help with windows live api contacts importer example in php

I am trying to find a php example code where it imports contacts from the windows live contacts api. I have examined the microsoft api manual - but it only gives code examples in C# (http://msdn.microsoft.com/en-us/library/bb463989.aspx) . I am new to this and need help to get started. This is the place where it looks like I could get i...