php

keeping db connection active across pages

I'm a learner. Is there a way to stay connected in to the mysql database as the user is taken to the next page. For example, the db connection is made, the user is logged in, and then goes to the next page to access a table in the database. Instead of having to make the db connection again, is there a way to keep the previous connec...

get firefox to decrypt using private portion of client certificate

I am interested in having something that I encrypt using a public key on a LAMPhp server, decrypted using the appropriate private key on the web client (firefox at least, best if it is standard javascript) Note that what I want to do is -not- merely to have an encrypted connection using SSL/https. Or even to use browser-based client ce...

Is there any PHP editor with debugging support?

Is there any PHP editor with debugging support? I am a beginner in PHP and facing very problem while in debugging. It would be very helpful for me. ...

I need to check if multiple items are set and not empty in PHP

Below is a snippet of PHP that I need to get working, I need to make sure that 3 items are not set already and not === '' I have the part to make it check if not set but when I try to see if the values are empty as well (I might not even be thinking clearly right now, I might not need to do all this) But I need to make sure that redir...

Zendesk or tenderapp?

I've been looking at support systems for a webapp I'm going to be pushing really hard over summer. I've narrowed it down to Zendesk and tenderapp. They both seem to offer much of a similar product, price & features. Has anyone out there used the two and can advise how to best make the decision? Thanks :) ...

PHP: variable name as class instance

Hey guys, Im having a problem with using a variable as the class name when calling a static function within the class. My code is as follows: class test { static function getInstance() { return new test(); } } $className = "test"; $test = $className::getInstance(); Ive got to define the class name to a variable a...

Most efficient way of pulling data out of a string

I need to find out the primary key of a sqlite database. Given a string like: CREATE TABLE cia (name PRIMARY KEY, population INTEGER) or: CREATE TABLE casting(movieid INTEGER, actorid INTEGER, PRIMARY KEY (movieid, actorid)) What would the most effective way of getting an array of primary keys be using php? ...

How to add missing elements from from two arrays to first array.

I am currently using SimpleXML to reading an xml file to generate my first array. This array displays a list of images that are found in a directory and written to xml file. This has worked for me in the past until I upload new photos to the same album. I like to know what one does to get a complete list of images that got uploaded to t...

CakePHP: Few questions about models, controllers an retrieving data

Hello, Again me. I was using for a bit long time KohanaPHP and just can't get familiar with CakePHP, but working with it it's a pleasure for me. First of all, I retrieve data from model, send it via controller to view and now got question. Do I really need to use following syntax of data in foreach loop? $item['Model']['field'] It'...

Cannot get PHP to write to a file

Below is a simple database class, well its part of a class, I stripped everything out except the parts related to my question. Basicly it will allow me to build a file with all the queries that were ran on a page load with the time they took, the order they are in, the total count, and then also the actual SQL that was ran. It is ver...

SOLR and PHP help needed

I have understood how to add xml files to SOLR and be able to search them via the SOLR ADMIN interface... I need to know however, how to make SOLR work with PHP, and index MYSQL records... This is what I want to do: I have a mysql table, which I would like to add to SOLR (index it), so that instead of searching the MYSQL table directly...

Is a global PHP CONSTANT available inside of a Class file?

Is a global PHP CONSTANT available inside of a Class file? define('SITE_PATH', 'C:/webserver/htdocs/somefolder/'); Then in my class file I try this public $debug_file = SITE_PATH. 'debug/debug.sql'; This does not seem to work though, Parse error: parse error, expecting ','' or';'' in C:\webserver\htdocs\somefolder\inclu...

How to retrieve the URL of a page using PHP?

Newbie question here, is there any inbuilt PHP tag that can be used to retrieve the URL of a page and echo it on the screen? Thanks. ...

what is the difference between the php imap extenstion and one of the mail classes?

I need my application to send and receive emails on certain events. I think I would like to use a mail server also to implement an in-application mailing ability, like the ability to send/receive/delete messages in applications like linkedin. What would be a good tool, a PHP mailing class, the imap extension, or are they not covering the...

returning JSON and HTML from PHP script

Hi searched through the questions here, but couldn't find anything. I'm new at writing PHP and jQuery, so bear with me. What I'm trying to do is send an ajax request using jQuery to my script which runs a mysql query on data from my database and serializes it into the JSON format using php's json_encode. The response is then parsed with...

Is it bad to include a lot of files in PHP like it is for file based Sessions?

After reading about how file based PHP sessions are not the greatest for performance, it has me thinking. Does this mean a PHP script including a lot of files is bad as well? Since it is including a file or is this different from the way session data files are retrieved? ...

Connect to an online MySQL database from localhost

I am trying to connect to my MySQL database on my online server via PHP on my localhost. $con = mysql_connect("$hostname", "$username", "$password"); if (!$con) {die('Could not connect: ' . mysql_error());} mysql_select_db($databasename, $con); When I upload the script to the server it connects to the database fine. However, when I l...

Calculating Great-Circle Distance with SQLite

Here is my problem, I have a SQLite table with locations and latitudes / longitudes. Basically I need to: SELECT location, HAVERSINE(lat, lon) AS distance FROM location ORDER BY distance ASC; HAVERSINE() is a PHP function that should return the Great-Circle Distance (in miles or km) given a pair of latitude and longitude values. One o...

PHP errors shows orange table and 'call stack'

Recently, if I have PHP errors on my localhost, I'm seeing this layout of an orange table and call stack: Is this caused by something in particular, a PHP module maybe? Or is it now part of PHP by default? I'd like to go back to the simpler plain message. I'm running PHP on Apache 2 on my Ubuntu desktop. ...

Is databases always the answer in web data storage?

I haven't got any experience with databases, but intends to learn it and use it on a web project I'm planning. Though, I've got advice from a pal of mine that the use of databases should be quite more extensive than I planned. He believes in keeping almost all of the data in databases, where I find that databases are most convenient reg...