php

Calling JAX webservices from php is not working

Hi, I am trying to call Java webservices developed using JAX-WS 2.1.4 from php but it doesnt seem to work as expected. All the parameter values being passed to the method has been intrepreted as "null" value, but i am passing the proper values from php side. Can anyone please help me on this? Thanks, Mani ...

Concurrency Problem

Hello, I'm having what seems to be a concurrency problem while using MySQL and PHP + Propel 1.3. Below is a small example of the "save" method of a Propel object. public function save(PropelPDO $con = null) { $con = Propel::getConnection(); try { $con->beginTransaction(); sleep(3); // ignore this, used for testi...

PHP: keep track of requests by user and by product brand?

I have a MySQL table that has price requests in it, it has date, first, last, and product_id fields. The product brand can be found from the product table from the product_id. Given a date range, they want to know the total number of requests, by people and by brand for each day in the date range, and total for date range. Here is the t...

Pass all arguments to another function

I have two functions like this: function mysql_safe_query($format) { $args = array_slice(func_get_args(),1); $args = array_map('mysql_safe_string',$args); $query = vsprintf($format,$args); $result = mysql_query($query); if($result === false) echo '<div class="mysql-error">',mysql_error(),'<br/>',$query,'</div>'; return $result; } ...

Storing sort order for items held in an HABTM association - CakePHP

In an ActiveRecord (CakePHP flavored) setup I have a HasAndBelongsToMany association setup on Videos and Bins: A Bin can store n references to Videos, and Videos can belong to n Bins. I need to be able to manually set and store the display order of the Videos within a particular Bin (so the client can have his Videos in a particular ord...

PHP: How do you determine every Nth iteration of a loop?

I wanted to echo an image every after 3 post via XML here is my code : <?php // URL of the XML feed. $feed = 'test.xml'; // How many items do we want to display? //$display = 3; // Check our XML file exists if(!file_exists($feed)) { die('The XML file could not be found!'); } // First, open the XML file. $xml = simplexml_load_file($fee...

Make mysql_fetch_assoc automatically detect return data types?

When using mysql_fetch_assoc in PHP, how can I make it return the correct data types? Right now it appears to convert everything to strings, I'd prefer if it left the Ints as Ints, and somehow designated the Date/Time as either Object or somehow different than strings. The reason for this is that I am using PHP as a backend to a Flex ap...

PHP XML Simple Load

I have a light box currently working www.idgc.ca/web-design-samples.php but when I converted the whole page in a Simple XML www.idgc.ca/web-design-samples-testing.php it stopped working.... ...

Batch inserts with PHP

Java has the PreparedStatement addBatch + executeBatch to do multiple insertions efficiently. What is the fasted way to do a batch of inserts using php's mysqli extension? Thanks! ...

php command that returns entire url including get action

How do I return the entire url of a page including get. $_SERVER['HTTP_REFERER'] and php_self doesn't do it. they return www.domain.com/example instead of www.domain.com/example?user=2 ...

How would I call a method from a class with a variable?

Given this class: class Tacobell{ public function order_taco(){ echo "3 Tacos, thank you."; } public function order_burrito(){ echo "Cheesy bean and rice, please"; } } $lunch = new Tacobell; $lunch->order_burrito(); $lunch->order_taco(); How would I do something like this? $myOrder = 'burrito'; $lunch->order_.$myOrder; ...

Is there an easy way to get a Unix timestamp from an SQL timestamp in php?

My database table has a column that contains SQL timestamps (eg. 2009-05-30 19:43:41). I need the Unix timestamp equivalent (an integer) in my php program. $posts = mysql_query("SELECT * FROM Posts ORDER BY Created DESC"); $array = mysql_fetch_array($posts); echo $array[Created]; Where it now echoes the SQL timestamp, I want a Unix ti...

Php comments script

Anyone know where I can find a simple comments script in php/mysql, i just want a system that has the basic font enhancements, url links, image and reply functions. Thanks. ...

Login system just like stackoverflow's, written in php

The question Is there a simple way to implement the login system that stackoverflow uses using php? For a long time I have developed websites, and have used a typical web form username/password with a mysql db for login systems. I would like to have it so users can log into the system using google, yahoo, facebook, etc, and without th...

how to adhere to the Don't-Repeat-Yourself (DRY) principle when there will be too many if-then-else making the code unreadable?

I'd like to adhere to the Don't-Repeat-Yourself principle, but sometimes when I write PHP together with HTML and CSS, if I re-use the same code for different situations, my code soon will have so many if-then-else that the code is not easily maintainable. This may be a bigger issue if Smarty, the templating engine is used, because most ...

using php and curl to update mediawiki

I've been working on a php script to update mediawiki entries, however whenever I run it it doesn't seem to update the wiki at all and just returns the article page unedited. I've included a section which logs into the wiki first and I've successfully read information off the wiki but I have not been able to update it. Is there somethi...

where do i find the wordpress "promote" class?

I created a site using wordpress. I installed the 'starkers' theme and modified it. However, inside the of the single.php, there's a bunch of text promoting the blog. This is enclosed within a class of promote. I have been searching for where this text is located throughout my site but I cant seem to find it. I had initially thought th...

How should 'raw binary data' hashes be stored in MySQL?

I'm wanting to store hashed passwords in MySQL, I'm using PHP: <?php $salt = '!£$%^&*()#'; $username = 'abc'; $password = '123'; $hash = hash('sha1', $username . $salt . $password, true); ?> The true parameter in hash() will return the value as raw binary data. But I don't understand what this means exactly. How should...

XSLT Cache problems

I'm trying to install this PHP module from NYTimes (http://code.nytimes.com/projects/xslcache) I unfortunately am falling at the last hurdle. I've installed it, added to my php.ini, but I am getting this error when running in my PHP code. Fatal error: Class 'xsltCache' not found in... My php code is as described by the NYTimes websit...

how to redirect STDOUT to a file in PHP?

The code below almost works, but it's not what I really meant: ob_start(); echo 'xxx'; $contents = ob_get_contents(); ob_end_clean(); file_put_contents($file,$contents); Is there a more natural way? ...