php

Formulas to Calculate Geo Proximity

I need to implement a Geo proximity search in my application but I'm very confused regarding the correct formula to use. After some searches in the Web and in StackOverflow I found that the solutions are: Use the Haversine Formula Use the Great-Circle Distance Formula Use a Spatial Search Engine in the Database Option #3 is really no...

Next / Prev pages with Javascript?

I'm creating a online training 'powerpoint' like series of pages. It will be pretty straight forward and have the pages set out as such: page1.php page2.php page3.php ... page20.php I'll be going old school and use an iframe to hide the address bar as people shouldn't be able to catch onto the naming convention and skip ahead. (Its not...

Numbers from database refuse to be added/multiplied

I am pulling a set of numbers from a MySQL database and am trying to do some simple math on them to calculate a total price to put into an invoice, but PHP isn't cooperating. I thought it might be a type-coercion issue, so I tried adding some intval and floatval calls, but still the total always comes out to 0. Here is the relevant cod...

PHP drop down return to previous selection

Ok this is a very small section of my original code. I have two pages a page full of forms and boxes then another page that puts the information into my DB. Oasis.php page This right here is the code that changes the client name and code. On this entire page. On the change event. $sql = "SELECT * FROM client_lookup ORDER BY Client_Ful...

php poll loop query

i want to make a multi-question poll in steps. i want the questions to be displayed one after the other in sequence and the questions should be pulled from the DB. i am successfully fetching one question from the DB. but the way i want to make it work is when the user clicks on Submit for one question it should take the user to the next...

Doctrine - Can I use real SQL (not DQL) in a ->andWhere() ?

I'm using Doctrine, a PHP ORM. I have created a Doctrine Query, and I need more control. So I've started to use the ->andWhere(...) methods to add new where clauses. However I need to do a subquery based on another table, like so: $query->andWhere("id in (SELECT id from other_table where value = ?)", $myvar); The above doesn't work. H...

Network Diagram Libraries

Does anyone know if there is a tool or lib for creating network diagrams dynamically. Either in C++ or PHP as this will be used within a web page. Thanks ...

check for number anywhere in a string

$vari = "testing 245"; $numb = 0..9; $numb_pos = strpos($vari,$numb); echo substr($vari,0,$numb_pos); The $numb is numbers from 0 to 9 Where am I wrong here, all I need to echo is testing ...

How to refresh a PHP database calendar after using jQuery drag and drop?

I have a calendar built using PHP, with events on it. I'm using jQuery UI to enable drag and drop to move the events around. The .droppable() function has a callback function attached that updates the database with the new information. But the calendar needs to refresh so that it reads from the new database values. Can you force a pag...

PHP Sanity Check

I am looking for applications or methods for performing sanity checks of php code. I hope to to avoid finding out about the coding mistakes the hard way, but instead find them before publishing the website. display_errors = on and similar run-time methods find the problems too late. So far I have found the following ways, which I think...

Pass multiple variables by reference to a foreach loop (PHP)

Scenario/Problem Isolation: Lets suppose my program uses MULTIPLE variables. At the program beginning I want to manipulate MANY of the variables AT ONCE through a general function with LITTLE CODE, before then later in the process using only distinctive few variables in specific functions. Question: How do I pass multiple variables by r...

Static Functions / Classes.. Reasonsing?

Possible Duplicate: When should I use static methods in a class and what are the benefits? I'm working in PHP right now. I'm working on two groups of Functions. I have a class which consists of Date Handling Functions. In this class I have no need for properties as each function/method is more or less a utility. As such I hav...

How to send info to LCD from web

I have seen applications capable of sending information to Logitech LCD panels and played with that a bit a few years ago. Currently, I have four small LCD panels. Two are CrystalFontz 633s, one came from a 1U EMC data storage box and one was taken from an old ethernet-based KVM, so I've no idea what it's capabilities are. Using eithe...

Can this PHP function be improved?

Below is some code I am working on for a navigation menu, if you are on a certain page, it will add a "current" css class to the proper tab. I am curious if there is a better way to do this in PHP because it really seems like a lot of code to do such a simple task? My pages will also have a jquery library already loaded, would it be ...

PHP: Last file in directory

How do I get the name of the last file (alphabetically) in a directory with php? Thanks. ...

How to add OpenID to a php site?

I absolutely love StackOverflow's usage of OpenID for registration. How would I go about adding this to my site? It is PHP based. I went to openid.net and looked at the libraries there, but could find little in the way of documentation or examples. ...

mysql query only returning a single row

the following mysql query is only returning a single row when it should be returning 4. $query = "SELECT * FROM questions"; $result = mysql_query($query) or die("ERROR: $query.".mysql_error()); // if records are present if (mysql_num_rows($result) > 0) { while ( $row = mysql_fetch_object($result) ){ // get question ...

Authorizing a Facebook Fan Page for Status Updates

I'm able to update the status on my PROFILE wall using this code: require_once 'facebook-platform/php/facebook.php'; $facebook = new Facebook('APP API KEY','APP SECRET KEY'); $user_id = 'MY USER ID'; $facebook->api_client->users_setStatus('This is a new status'); ...after authorizing using this address: http://facebook.com/authorize.p...

Cache Expiration On Static Images

I have a php site using html5 run on a linux server on godaddy. I need to set a cache expiration date on static images and a css file. I also need to gzip a css file and cannot seem to find the correct syntax for either. I am not sure if I am making this too complicated or what. Am I correct to think I can get this done with an exp...

PHP Insert into database not working

Greetings I made the following php script so that I could edit text and it would save to a db for future use. However I'm hitting a slight snag at the update / insert queries. I'm not sure what I'm doing wrong but only one of the commands will execute. I'm not sure if this is a hosting issue or am I doing something wrong. Any ideas? ...