php

PHP: path / unpack 64bit int in 64bit architecture

Can anyone tell me why I get the following output on x64 architecture: $ php -r 'echo pow(2, 33) . "\n";print_r(unpack("Ivalue", pack("I", pow(2, 33))));' 8589934592 Array ( [value] => 0 ) It seems as though it can handle signed 64bit ints, but can't pack / unpack them. According to the docs: http://us3.php.net/pack, the size of ...

php loops and grouping mysql

Hi There, I am currently adding a purchase history section to payment system, the system is built in PHP (codeigniter framework) and mysql. The idea of the payment history section is that all the customer purchases are grouped together by date, so in the end the HTML would look similar to this, My question is I can get the data out o...

Is there any way to prevent a .php file from being requested?

Hello, I have certain files like header.php and footer.php. I would like to disable these files from being directly requested from the browser address bar. If I have include 'file.php' in the code, then it should be included, but if it's directly requested, I don't want it to be shown since it serves no purpose. Is it possible? Than...

PHP & PDO PHP Notice: Undefined property: Database::$photo ???

Okay so here is the code that I am using function AddProducts($aTitle, $aDescription, $aPrice, $aQty, $aPhoto) { try { $stmt = $this->pdo->prepare("INSERT INTO products(title, price, description, qty, photo) VALUES(:title, :price, :description, :qty, :photo)"); if(!$stmt){ $err = ...

PHP do-while with HTML in between

I am trying to write PHP code to loop through an array to create an HTML table. I have been trying to do something like: <div id="results"> <table class="sortable"> <?php $results = $statement->fetchAll(PDO::FETCH_ASSOC); ?> <?php do: ?> <tr> <?php for ($i = 0; $i < count($columns); $i++): ?> ...

CSS issue when using PHP

What is the error in this CSS class? .ux-row-action-cell .x-grid3-cell-inner { padding:1px 0 0 0; } I don't see any error in ASP.NET, but when I am using the same CSS in PHP, Firebug says "syntax error". ...

How to create php RSS simulator?

So I have RSS feed of 10 000 records in file.xml (I collected them from 10 feeds in 1 hour time so there timestamps will not help, btw I used yahoo pipes). I need some class to simulate that records appearing 24 per a day with 1 per hour. How I see it: 1) turn file.xml into sql table (if you know a class for this please help) 2) cr...

Eclipse cannot open php editor (Phpeclipse and PDT conflict)

I have Eclipse with the PTD from http://www.eclipse.org/. I just installed Phpeclipse http://www.phpeclipse.com/ because it has some features I want. Now when I double click on a PHP file a dialog opens that says "Unsupported Content Type", so I go to the File association section and add *.php - there a three editors and they are all l...

PHP UTF-8 to GB2312

Part of our web app has a little Ajax method that will load a page in an iFrame or allow you to download it. We store a bunch of search results from search engines and we have script opens the file containing our info and the search html. We strip out the stuff we don't need from the top (our info) and then we serve that up either by ec...

Is it possible to call function from parent class directly in PHP

I have class P { function fun() { echo "P"; } } class Ch { function fun() { echo "Ch"; } } $x = new Ch(); How to call parent function fun from $x? Is it possible to do it directly or I have to write: function callParent { parent::fun(); } ...

Using PHP to request errors information and post if errors has anything

Hi everyone, I have an HTML form that takes inputted data and sends it via the mail() function. I also have some validation techniques that validate the inputs, and I created an array variable $errors to log all of the errors; for example, if the name was left empty, $errors[]="Name empty"; If the email was left empty, $errors[]="email...

file_get_contents create file is not exists

Is there any alternative to file_get_contents that would create the file if it did not exist. I am basically looking for a one line command. I am using it to count download stats for a program. I use this PHP code in the pre-download page: Download #: <?php $hits = file_get_contents("downloads.txt"); echo $hits; ?> and then in the dow...

Run php script remotely

I have a php script (qa.php) that my app points to on my current server. I just recently switched servers and want the qa.php script running from this new server. Is there a way to have a php script redirect or automatically run the remote php script? ...

PHP: strtotime is returning false for a future date?

here are some debug expressions i put into eclipse, if you don't believe me: "strtotime("2110-07-16 10:07:47")" = (boolean) false "strtotime("2110-07-16")" = (boolean) false i'm using it in my function which returns a random date between the start and end dates: public static function randomDate($start_date, $end_date, $format =...

free calendar with timestamp

I am working on form and I am looking for a free calendar/date/timestamp app that i can include in my form. basically, in the input text, i want users to click on the calendar icon and pick a date and a time stamp. that value should populate in the input text. my next question is, in my mysql db, i am calling this field as "datetime", s...

Some nifty regex to parse some javascript inside HTML

I have some HTML that looks like this: $(document).ready(function(){ $('#cumulative-returns').graph({ width: 400, height: 180, type: 'bar', x_label: 'Month', x_data: ['Jan','Feb','Mar','Apr'], y_label: 'Cumulative Return', y_data: ['5','10','...

strip HTML tags with certain content from string

$text = "<p>keep me</p> <p>strip me &nbsp;</p> $pattern = "/<[^\/>]*>(\&nbsp\;)*<\/[^>]*>/"; $text = preg_replace($pattern, '', $text); Hi, I need to strip "quasi-empty" p tags from a html string. there's always only a &nbsp; as a trigger in the p element. how can I strip it with regex? ...

Godaddy PHP SMTP using other mail service like google..

Dear All, I hosted my website on Godaddy shared linux environment and using PHP simple mail function to send emails to the registered users .But in some cases the email is not going and also I am crossing daily limit 1000 emails some times . I send maximum 1500 emails . Is there any way I can use google smtp server in PHP code there in ...

PHP mail() function does not work on web-host

Hi everyone, I'm having issues sending emails using the php mail() function. I know the php script I have works because I have an identical copy of it on another web-hosting company and it works there. I think it has to do with the web-hosting company itself. Do any of you know what I need to do in order to make it work? Is there some...

How to format incoming email text for HTML display

I've set up a script that processes incoming emails and creates blog entries on Blogger. I'm using PEAR's Mail_Mime libs (for now) to read the incoming message. The messages often have characters in them that cannot be read by browsers--this happens most often when people use Outlook or cut/paste from MS Word. So the output at the othe...