php

[PHP] using the magic __set() method with 2D arrays

If I have the following registry class: Class registry { private $_vars; public function __construct() { $this->_vars = array(); } public function __set($key, $val) { $this->_vars[$key] = $val; } public function __get($key) { if (isset($this->_vars[$key])) retur...

I made a horrible loop.... help fix my logic please

I know I'm doing this a bad way... but I'm having trouble seeing any alternatives. I have an array of products that I need to select 4 of randomly. $rawUpsellList is an array of all of the possible upsells based off of the items in their cart. Each value is a product object. I know this is horribly ugly code but I don't see an altern...

how calculate the count of views?

just yesterday i finished one site, which provides video watching. but now i need to show the number of views of each film. i never wrote such thing, so i don't know what to do. maybe i must add one field in mysql database, and increase it every time the video opened? but i use flash player, and i can't wrote script onclick of player....

Silverlight and PHP nuSOAP communication problem

I am writting a silverlight application in which I want to call the php webservice written using NuSOAP. here is the WSDL of webservice <?xml version="1.0" encoding="ISO-8859-1" ?> - <definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/20...

Find top "n" nearby coordinates.

I have a coordinate. I want to find the top "n" (n being a variable value) nearest coordinates out of several thousand rows stored on a MySQL database. I also want to be able to define maximum and minimum distances between the coordinate in question and the coordinates in the database. How best am I to go about this? Would it be bonkers...

Variables are "lost" somewhere, then reappear... all with no error thrown.

Hi All, I'm probably going to make myself look like a fool with my horrible scripting but here we go. I have a form that I am collecting a bunch of checkbox info from using a binary method. ON/SET=1 !ISSET=0 Anyway, all seems to be going as planned except for the query bit. When I run the script, it runs through and throws no erro...

Connecting to external MySQL DB from a web server not running MySQL

While I've been working with MySQL for years, this is the first time I've run across this very newbie-esq issue. Due to a client demand, I must host their website files (PHP) on a IIS server that is not running MySQL (instead, they are running MSSQL). However, I have developed the site using a MySQL database which is located on an extern...

text editor that works direct on a server? (aptana?)

Are there any good free text editors i can use directly on the server if i give it my ftp details? failing that one with a good save-to-ftp shortcut (ie ctrl-shift-s) I work with mainly php and jquery, my primary editor is aptana? ...

How can I pass an HTML file content from PHP to CGI (Perl) Script

The content of the an HTML file generated by a PHP is stored in a string variable called $output I am trying to send the contents in $output to a CGI script. I have tried the following CURL in PHP... $output = "long string, with strange non HTML characters..." $c = curl_init(); curl_setopt($c, CURLOPT_URL, 'http://www.example.com/cg...

Repository - PHP

Hello, I am new to repositories and am currently looking around to find the best possible option. I need something that can handle multiple versions of our website, and allow multiple collaborators to all push to the repo together. Our current project is built in PHP, and we have a MySQL database. I am short on funding and need the ...

Fastest PHP Routine To Match Words

What is the fastest way in PHP to take a keyword list and match it to a search result (like an array of titles) for all words? For instance, if my keyword phrase is "great leather shoes", then the following titles would be a match... Get Some Really Great Leather Shoes Leather Shoes Are Great Great Day! Those Are Some Cool Leather Sho...

SimpleXML not pulling correct link

My code does not pull the proper link for the item. Instead it's getting the previous item's link. Any suggestions? Thanks! <?php // Load the XML data from the specified file name. // The second argument (NULL) allows us to specify additional libxml parameters, // we don't need this so we'll leave it as NULL. The third argument howe...

In PHP given an extended date string, how can I extract the month Year in long format?

My attempted solution was: $date = "Nov 30 2009 03:00:00:000PM"; echo date("F Y", strtotime($date)); Expected result should be: "November 2009" Any other simple solutions? ...

Convert PHP Joomla to the HTML

Hi, I've downloaded a PHP Joomla template, and I want to remove all PHP/Joomla statements from the code (I want to convert that code to the static HTML code) I don't know what to do with the e.g. <jdoc:include type="modules" name="left" style="user" /> <jdoc:include type="modules" name="user4" /> here is the code from the Index.php p...

Conditional statements bug in Google Chrome

When I use a conditional statement targeting IE6 and below with some PHP code Google Chrome disregards the statement and inserts the code. Example: <!--[if lte IE 6]> <?php require_once("ie6.php"); ?> <![endif]--> It will insert the content of ie6.php in the body anyway. The code in ie6.php is something like this: <?php print '<p>T...

Warning: array_multisort() [function.array-multisort]: Argument #1 is expected to be an array or a sort flag in

Hi, the following code produces the error in the title. I've tried to google it, but all I got were pages who got the same error (and not an explanation thereof). This isn't really a problem since it's actually working and cancelling the error out with the @ works out just fine. Though I'm still wondering why I haven't been able to execu...

where to use array() in PHP

can you give me examples of using array() function ? ...

Can't declare even the most simple class in PHP - Am I going insane?

I'm getting this error whenever I attempt to declare a class: Parse error: syntax error, unexpected T_VARIABLE, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home3/foundloc/public_html/booka/page2.php on line 7 (line 7 is the class declaration by the way). Here's the incredibly simple class I am attempting to declare: Cl...

Fatal error: Call to a member function getAttribute() on a non-object in C:\xampp\htdocs\giftshoes\system\database\doctrine\Doctrine\Record.php on line 1424

I am getting following error message when using Doctrine ORM in Codeigniter. Please help me... ------------------Doctrin Table Defination------------- abstract class BaseShoes extends Doctrine_Record { public function setTableDefinition() { $this->setTableName('shoes'); $this->hasColumn('sku', 'integer', 11, arra...

Should I refactor this code?

The code is for a view debate page. The code is supposed to determine whether or not to show an add reply form to the viewing user. If the user is logged in, and the user is not the creator of the debate, then check if the user already replied to the debate. If the user did not already reply to the debate then show the form... Otherw...