php

Query string processing

While doing some query string processing I stumbled upon this: <?php $in='a=6&b=7&8=c'; parse_str($in,$qs); $out=array_merge($qs,array('9'=>'d')); print_r($out); ?> We get: Array ( [a] => 6 [b] => 7 [0] => c [1] => d ) Instead of: Array ( [a] => 6 [b] => 7 [8] => c [9] => d ) I understand why this...

oracle php ORA-00911 invalid character on UPDATE

Hi Gurus I'm running a PHP Script that updates a table from a Oracle DB. First I receive an object with JSON: [{"lot":"KLMHA17N9N00","requestor":"B10078","id":"FRESHLOT","username":"B26696","password":"B26696"},{"lot":"KLMHA17R1800","requestor":"B10078","id":"FRESHLOT"}] That with no problems since I've been using JSON in other proje...

strtotime - always return NEXT [date here]

I'm trying to use the strtotime function in order to return the following date specified. For example: strtotime('thursday'); //Need to get NEXT Thurs, not today (assuming today is Th) Using next thursday would work in this case, but does not work with absolute dates, such as: strtotime('next aug 19'); //Should return 08-19-2011, but...

A RegEx problem in PHP.

I could not think of a proper title. I have some data like - $data = <<<EOD <strong> HHHHH <strong> TTTTT <strong> RRRRRRR <strong> EOD; Basically above one is just an example. In real, the data is like - <strong>Some Title</strong> DATA <strong>Some other Title</strong> OTHER DATA Sample: http://pastebin.com/cxzZWDZ8 Now I apply ...

Looking for a CSS optimizer (php script or online services)

Hi, I'm looking for a css optimizer. It should be a php script so I can install on my host or online services. I need some feature like below. Any recommended? from: margin-top:5px; margin-right:10px; margin-bottom:8px; margin-left:2px; to: => margin:5px 10px 8px 2px; from: -moz-border-radius-topleft: 5px; to: => -moz-border-r...

PHP MySql query 2 tables that have no common attributes at the same time???

Hello All, I am trying to query 2 tables in a database, each query having nothing to do with each other, other then being on the same page. Query 1 - The first query on the page will retrieve text and images that are found throughout the page from Table A. Query 2 - The second query will retrieve several products with a image, descrip...

How can I display the latest activity for my Facebook group's wall on my website using php?

Sample code is appreciated. Thank you. ...

Changing the location of site/user/login

There's a login page at http://site.com/user/login Is there a clean way to change the the path of that page to something like http://site.com/log so that /user/login leads to a 404 page. ...

I am using CodeIgnitor and trying to set a varable based on a return from a query

I am able to use print_r and return this data: Array ( [array] => Array ( [status] => false [message] => The %s subscription code is out of date. ) ) i need to be able to set the elements "status" and "message" to variables. (in this case status = false) Thanks for the help. William ...

Wrap DOM element in another DOM element in PHP

I originally asked a question along these lines using Regex but was recommended to use the PHP DOM library instead...which is superior, but I am still stuck. Basically I want to wrap the contents of an <a> in a <span> if it is not already wrapped in <span>. <?php $input = <<<EOT <html><head></head> <body bgcolor="#393a36"> <a hre...

How to do a rotation in R^2?

hi there! i'm stuck with a seemingly simple problem in mathematics: i need to rotate points in a 2-dimensional cartesian coordinate system, i.e. i have a point given by (x/y) and an angle gamma and i need to get the coordinates of this point if rotated by gamma... example: if x = 2 and y = 0 and the angle of rotation is 90°, the result...

Facebook Application Tab -> External Linking with PHP

I currently have an Application on the Facebook Tab, and am wondering if there is a way for me to deep link into an item on that app tab. Example: User is in the application (which is searching books), finds a book they like, and wants to share it with a friend. They click to share it, and I can pull all the info, however I don't have...

PHP function to check if 2 variables are empty

I have an index page, I want it to include a page called splash.php and not display.php when a user lands on index.php, but once a user does something (sets a variable) ie if a user searches (variable "query") i want it to include display.php and not include splash.php What is wrong with this code? function hasGet() { return !empty...

Load file into PHP array, best way?

I have a text file that is around 1.7MB that has a list of words that I need for my application. I need to have it loaded into an array when the page loads and then be available to other PHP files that AJAX requests are made to. Right now I am loading it into an array on page load and then storing it in a session so that the AJAX file ha...

Pulling values from an array in separate file

Hello, again. Right now I'm having issues with some pretty basic functionality in PHP. I have a web page which includes the following code: function laserOn() { $_SESSION['laser'] = TRUE; $num_victims = rand(2,125); $vic = rand(0, count($victims) - 1); print $num_victims." ".$victims[$vic]." have been vaporized!<br...

Unit testing a class that returns SQL

I'm trying to use PHPUnit to unit test some class methods that return SQL. These classes should work with any Zend_Db adapter, so I would like the tests to do the same. My tests look a little like this: public function testEtcGeneratesCorrectSQL() { $model = new ClassBeingTested(); // do some stuff $sql = $model->__toStrin...

PDO refuses to switch between multiple Databases!

Please I am very new to PDO, rather a novice at PHP as well. I am currently working on a project that involves connections to many databases: MySQL, MSSQL and Oracle. So I am using the class below, with PDO, for my connection. The class code is below. class db { private static $objInstance; /* * Class Constructor - Create a new data...

PHP and HTML Echo

I want to query a result from a table. The problem I run into is if the text is very long it will not auto-wrap to another line"best way i can think to explain it". It displays the text on one line and will go way off to the side of the page if the text is long. How can I get the text to space correctly. Thanks here is my code: <?php ...

is_unique syntax in mysql?

I have a table entity called position. I am storing the value using smallint(2) datatype, where I intend to store the value from 0 to 9 (max). I want to make sure the value is just a single integer and an integer should not be repeated at any cost. There should be a unique value assigned to each id of the position entity in the table ran...

ebay API need a quick solution

I need to know how to buy an item using ebay API. Here is the reference http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/PlaceOffer.html but I dont have a clue how to do that. What I have is the item ID from ebay in my database table ebay_items having column item ID. please tell me step by step how to do that and any help will b...