php

php poor man's cache

I have some small sets of data from the database (mysql) who are seldom updated. Basically 3 or 4 small bi dimensional arrays (50-200 items). This is the ideal case for memcached, but I'm on a shared server and can't install anything. I only have PHP and MySQL. I'm thinking about storing the arrays on file and regenerate the file via a ...

Passing a string to Flash from PHP

Hi guys, how can I pass a string from PHP to Flash? I need to pass this to flash, $var = 'uid_'.$uid.'_'.'likes_'.$likes; Any ideas on how I can accomplish this? Thanx in advance! ...

Can a base64 encoded string contain whitespace?

Might a base64 encoded string contain whitespace? Specifically, could it contain whitespace at the end of the string? PS. I'm thinking about the whole "MySQL will trim trailing whitespace when storing strings in VARCHAR fields" here ;-) ...

I can't post to Twitter using cURL and PHP

I am unable to tweet continuously in twitter - every three tweets I get: Error posting to Twitter. Retry How do I fix this? My code is as follows: $host = "http://twitter.com/statuses/update.xmlstatus=".urlencode(stripslashes(urldecode($message))); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $host); curl_setopt($ch, CURLOPT_...

Wordpress - List all Tags in dropdown (select) list

Hello all, I found the solution from this website about listing all tags in dropdown (select) list. Here is the code snippets. <?php function dropdown_tag_cloud( $args = '' ) { $defaults = array( 'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45, 'format' => 'flat', 'orderby' => 'name', 'order' =>...

Read HTTP headers in Controller (Zend Framework)

Long story short: I'm building a skeleton application for Zend Framework and I got to the part where I need to setup the api module. I'm using Zend_Rest_Controller for this job. All is ok up to this part where I need to get the HTTP headers in a controller to verify the api key. On various tutorials I've read on the web the thing is do...

Does a memory_limit set in included script apply to a complete request?

When I set ini_set('memory_limit', '100M'); in an included script, does this apply to the complete request, in which this script is included? ...

Deployment to shared host without SSH (PHP)

Hello, I have a Web-Application running on Shared Hosting. I need to Update the Project and I don't have SSH. All the Best-Practice-Solutions so far for SHared Hosting included SSH. So does anyone have experiences with deployment without SSH, not using manual uploading with FTP? --dazz edit: My dev environment is WinXP with XAMPP, I ...

Wordpress theme: force creation of newly created thumbnail size

I just added a new Wordpress thumbnail size using add_image_size call, but now all the photos I already uploaded are not of the correct size. If I request them, all I get is the original image with width and height attributes correctly set. How can I force the creation of that thumb, saving the data to the database as well, given an att...

PHP form generation and validation standalone class

Hi all, I am looking for a form class that: Is standalone/doesnt need a framework to run Has easily configurable validation Has validation and generation for all form fields including checkboxes(one solution I found was great except it didnt have any check box functionality) I have had a look on google and stackoverflow but most eve...

facebook api confusion

I am coming back to facebook app development after a long time. And I am confused :) Am I required to use the Graph API or can I still use the REST Api? Because I am unable to make calls with the old REST api methods. I am using PHP. Do I need to use the (now) official SDK? thanks a lot in advance. ...

reduce http requests by saving images in database?

Would it make sense to improve pageload speed by serving smaller images from the database rather than make multiple HTTP requests given that the website is PHP driven? I'm thinking of smaller page design elements, buttons, thumbnails for galleries etc. ...

Does a Join table (association table) have a primary key ? many to many relationship

Does a Join table (association table) have a primary key ? many to many relationship. I've seen some Join tables with a primary key and some without can someone please explain when you would have a primary key in a join table and why? Thank you in advance;-) ...

PHP OOP - How to handle authorisation?

I'm building a management system for an idea I have. I'm well versed in PHP (at least enough to do everything I need to do) but I'm not that experienced with using OOP. I use it as much as I can but a lot of the best practices I'm not familiar with so when I do things I worry I'm doing them in the wrong order. For this project I have a ...

How to Combine Post and Upload in HTML

<body> <form method="post" action="xx.php" > Enter Title of the Post<INPUT type="text" name="title"> <br/> Enter Description <textarea rows="10" cols="50" wrap="physical" name="post"> </textarea><br/> <input type="Submit" value="Post"> <br/><br/> <form enctype="multipart/form-data" action="xx.php"...

How do I convert 12 hour clock time into 24 hour clock time in PHP?

I am using following function and I want time in 24hr clock format but this gives me time in 12hrs: <?php date_default_timezone_set('Asia/Kolkata'); $timestamp = date("d/m/Y h:i:s", time()); print $timestamp ; ?> What am I doing wrong? ...

What is the best way to store Binary data (images, pdf's, mp3's, videos ect) in mysql and why?

What is the best way to store Binary data (images, pdf's, mp3's, videos ect) in mysql and why? What i would love to know is how you do it(as developers) and why? Also how the big sites do it? Thank you in advance ;-) ...

Creating a photo collage image as attached using PHP from several images

How can i create a collage from a large number of images as per below using PHP scripts? I am also looking at creating different sizes A0, A1, A2 sized images depending on the number of pictures used in the collage. Thanks ...

session_set_save_handler wamp crash

Hi, I am trying to use session_set_save_handler to allow me to save sessions within a mySQL database using the code below. Everytime I try to load the page I recieve an Application Error regarding the httpd.exe, as demonstrated by the image below. http://i48.tinypic.com/2i9l2ip.jpg if I remove the following line the page works fine. ...

How to make website more SEO friendly when the content is coming from the database?

How can i make my database content search-able on SE, so basically how to make a website more SEO friendly where the data is not static, it will come from the database. ...