php

How can I print number in 4 digit?

I want to print a list of numbers in php. But I want to print 4 digits of numbers (preceding with zero if necessary), e.g. 0001, 0009, 0076, 0129, 1234 What should I do? ...

how post and get specialchars in url?

how post and get "&" symbol in url? in php. please help me ........ ...

PHP loop inside Javascript at header - is this code valid at all?

Hello Dear StackOverflowers, I am new to web programming and finding the server-client mixture confusing. I have written very simple code which accepts a PHP 2D array [index][keys] (from a query) to just draw markers on a Google map (JavaScript). It works. But it doesn't look right to me! Is this indeed the correct way to pass the val...

php mailing function - get /'s in the mail

Hi IN my php project i am using php mail funcion . i have send test's as the content . But in my mail it look test\'s . How i avoid this special charector . I put nl2br function .. i also tried add slashes and stripslashes function. But still appear that special charector .. Please help me urgently.. ...

How to open multiple socket connections and do callbacks in PHP

I'm writing some code which processes a queue of items. The way it works is this: Get the next item flagged as needing to be processed from the mysql database row. Request some info from a google API using Curl, wait until the info is returned. Do the remainder of the processing based on the info returned. Flag the item as processed in...

Is it ok to call a Registry Pattern object inside of the objects that make up the Registry?

I have asked a few question lately about the use of the singleton and registry patterns but here is a new question I have. Let's say I have 3 main class object in PHP that I need to have access to inside 20 other class files and sitewide. Database object Cache object Core object I then can use a Registry pattern to store all...

How to use linebreaks in a textbox?

Hi, I am saving text from a textarea in the database and display it in another textarea. The linebreaks are displayed as \n which should be right, but the textarea is displaying them instead of doing the breaks! How can I fix this? ...

Root Nodes in JSON

I'm tasked with defining communication between two web apps. I've decided to use JSON for this. How common is it to have a root node in the JSON? Let's say we have a car object. This is the JSON with "Car" being the root node: {"Car": { "Make":"Mustang", "YearBuilt":"1999"}} So now let's say I have a Tire object and since w...

can a POST file handle multiple requests?

i have a file user_submit.php that handle all the POST requests. what i am doing is i am sending small integer values through jquery POST method. these integer values are sent one at a time around 10 times. what i want to do is i want to add all these values up and provide a final result after the last step. so i am doing: $score = in...

use mysql_real_escape_string() but allow names with apostrophes

I use mysql_real_escape_string() to validate all user inputs before I insert them in a sql database. One of the fields is name, and we've had issues with users with names like O'Reilly. Is there any way to use mysql_real_escape_string() to block injections but allow these names in the db? ...

Simplexml is giving me the wrong results

I have a simple xml below: <?xml version="1.0" encoding="utf-8"?> <catalogue> <category name="textbook" id="100" parent="books"> <product id="20000"> <author>Gambardella, Matthew</author> <title>XML Developer's Guide</title> <genre>Computer</genre> <price>44.95</price> <publish_date>2000-10-01</publis...

PHP file_get_contents() and headers

With PHP, is it possible to send HTTP headers with file_get_contents() ? I know you can send the user agent from your php.ini file. However, can you also send other information such as HTTP_ACCEPT, HTTP_ACCEPT_LANGUAGE, and HTTP_CONNECTION with file_get_contents() ? Or is there another function that will accomplish this? ...

In PHP, what is a fast way to search an array for values which contain a substring?

I have an array of street names sorted alphabetically that I have gathered from a web service. This array exists on the server side. On the client side, a user starts typing the name of the street he lives on and AJAX is used to return a list of the closest match to the partial street name, plus the next 9 street names in the array (the...

Get Browser to send both If-None-Match and If-Modified-Since

My Browser isn't sending back an If-Modified-Since Header for PHP generated Content on the first request my script sends: (Status-Line) HTTP/1.1 200 OK Date Thu, 21 Jan 2010 08:55:25 GMT Server Apache/2.2.11 (Win32) PHP/5.2.9-1 X-Powered-By PHP/5.2.9-1 Pragma no-cache x-ua-compatible IE=8;FF=3;OtherUA=4 Last-Modfied Sat, 02 Jan 2010 02...

automatic web shop creation

In one of my prject i need automatic webshop creation. it will similer to bigcartel.com. can anyone hint me what to do? is there any tutorial available? Thanks for your comments. regards Tarique ...

open source php search and pagination script ?

i have a database full of rows of data. i need an open source php search and pagination script. so all i need to do is hook it up to the database, and results will be paginated. also the searching function optimized already.... ...

Is there a decent HTML-table-generator class in PHP?

I'm looking for a decent class in PHP which will generate complex HTML tables, i.e. it should support colspan/rowspan and individual CSS classes for rows, columns and cells. ...

Adding ajax loading gif to script

Hi one and all, Thanks for looking, I have the below script that updates a series of drop down boxes, populated depending on the users previous answer. Data comes from SQL tables. I was wondering how I could add an Ajax loading gif to each drop down while the data is loading. I hope this makes sense, if not please ask. <script language...

PHP function not returning string

Hi there I have constructed a function that takes a filename, and increments a counter in the filename and returns it, however, everything is correct, except the return does not return the filename. Any help, please? My code: $filename = join("", array_reverse($date)); $filename .= ".xml"; $dir = "../gigs"; $file = $dir."/".$filename...

Use file_put_contents as Upload Function?

Can i also use file_put_contents($fileapp,$content,FILE_BINARY); to move uploaded files? ...