php

Do proxied assets get cached?

I have an application and in order to get the images to load into the app I had to use a proxy. So the urls for the images are not .jpg they are .php?var=value They seem to load much slower even after they have already loaded once, I don't really know how it works, but I am thinking that the proxied images are not being cached. Am I corr...

Cannot retrieve output parameters from MSSQL stored procedure using PHP

I am executing a MSSQL stored procedure that is supposed to return an output parameter (ErrCode), as well as a resultset. I am calling the procedure from PHP using the following code, but so far have been unable to retrieve the output parameter: $stmt = mssql_init("addFaculty", $this->db); mssql_bind($stmt, "@FacultyID", $FacultyID, S...

Why I should use __get() and __set()-magic methods in php?

Duplicate: When do/should I use __construct(), __get(), __set(), and __call() in PHP? Well, the title says it all. This is one area that I have not found any good answer. Can anyone explain to me why/how to use them correctly? Aren't they just a bad design decision? ...

How to get the total number of rows before reading in a large file in PHP

I am already using this example of how to read large data files in PHP line by line Now, what it'd like to do, is obtain the total number of rows in the file so that I may display a percentage complete or at least what the total number of rows are so I can provide some idea of how much processing is left to be done. Is there a way to g...

can cURL be used to read php code from php files?

I am sorry if this is a dumb question but if I didn't ask I wouldn't know. I don't really understand how cURL works, can it read the unparsed php code from a php file? If so, what is to stop some hacker from reading the script that connects to my data-base and stealing the login info? Thanks. ...

Parse an xml document located on the internet and convert to json

I found http://www.ibm.com/developerworks/xml/library/x-xml2jsonphp/ , but I don't know how to use this code to get the xml from my web server. any ideas? ...

What's the best way to abstract the database from a PHP application?

My question is how does one abstract a database connection from the model layer of an application? The primary concern is to be able to easily change from different types of databases. Maybe you start with a flat file, comma-delimited database. Then you want to move to a SQL database. Then later you decide an LDAP implementation would be...

Best alternative exception handling model

Sadly, I have a legacy PHP4 system that I continuously need to add features to. It doesn't look like there will be resources to do a port to PHP5 for several months if not several years. Over the course of the past few years, one of the major things that has bothered me is not having the ability to throw exceptions cleanly. Because of th...

PHP function that creates a nested ul li?

Hello, I am attemptting to attach a small CMS to a website I am creating. However I have come across a small problem. The CMS uses PHP functions for inserting menus, these PHP functions create the HTML. The particular function I wish to use (treemenu) creates a nested ul li that can then be used for a drop down menu. However the nested ...

Creating a PHP Webservice with binary-encoded parameters?

Hi, I'm trying to build a PHP webservice for an iPhone project I'm developing. I need to be able to send an image (picture) to the webservice, where I'll then store this in a database. I also need to write a service that will, of course, return this data when requested. I'm not sure where to start though. I've 'googled' for how I can b...

JSONP in CodeIgniter

Hello. I have a problem with using the jQuery JSONP function $.getJSON in CodeIgniter. The url from which the json is grabbed from is: http://spinly.000space.com/index.php/admin/isloggedin Now, the problem, is that I have a demo.html file that runs the $.getJSON function and grabs the data from the url I denoted above. DEMO.html l...

How do I control the order of appearance in PHP?

I currently have a page setup like this: PHP Variable Declarations HTML header, then a form to submit GET query The PHP that processes some stuff based on the GET data a bit of JavaScript that makes a pretty graph from the retrieved, processed data What I want to do is have only the form show up when the page is first loaded, and then...

PHP - Store Images in SESSION data ???

Can you store an image in a PHP SESSION ? I have a multi-step registration process using PHP on my site. On one of the steps, the users can upload their company logo (image). The last step is to process their credit card. So before I write any images to the web server and image location to the database, I want to make sure their cred...

Loading progress in php, ajax or javascript?

Any one know how can I display the loading progress with completed % on my client side while the system is still getting data in the server side. For example, when I press 'ok' button in the client side, it will call to server side to collect data from the database, the whole process may take 2 to 3 mins. How can I display the loading p...

Conditional prepared statement not switching

I have the following PHP code, which is meant to insert data in the event that the username field is empty for a given username, or update data if a username exists. At the moment, the insert was previously working fine, but it would never switch to the update clause. Now however, the insert clause fails to recognise my test variable, f...

Some Basic Python Questions

I'm a total python noob so please bear with me. I want to have python scan a page of html and replace instances of Microsoft Word entities with something UTF-8 compatible. My question is, how do you do that in Python (I've Googled this but haven't found a clear answer so far)? I want to dip my toe in the Python waters so I figure somet...

Best system for multiple language support in PHP?

I have an PHP application that I want localized. Currently, the way I'm doing this is a very ugly way: $loc['hello'] = "Hello", echo $loc['hello']; will show Hello, and you can change the file to change the language. What I want is a better way and a faster of doing this, what I'm considering: 1 XML file with language data for all page...

Use Ajax to call PHP function for HTML button Onclick

I have a an HTML button where I want the onclick to call a PHP function. I need to use AJAX to do this but I am totally lost. There is more that occurs inside the php function, but I didn't see the need of including it. Below is code thus far: <HTML> <BODY> <FORM> <input text="text" name=airport1 id=airport1 /> <input text="text...

sql - updating without overriding existing information

I have the following conditional code, which will insert a new record if a record with the appropriate username does not exist, and update the record if it does exist. This works fine. However, at the moment, if I insert a new record, and only insert the firstname and lastname, and maybe address details with say phone information being ...

Read session value with Javascript

Is it possible to read a session value with Javascript? For example, if I assigned a value into a session in PHP: $_SESSION['msg'] = "ABC Message"; Is it possible to read $_SESSION['msg'] with Javascript? ...