php

PHP stdClass question

Scenario: $x = json_decode( $x ); foreach ( $x as $item ) { $info[] = $item; //ERROR } I am looping though a datafeed to get the data. I want to add items to a stdClass object in a loop. How would I do that? I'm not that familiar with stdobj's. ...

How to implement max/min without comparation operations(if,<,> and so on)?

SHould be implemented in PHP. ...

Pattern in while loop

<table> while ($row = mysql_fetch_assoc($result)) { <tr> <td> echo $row['test'] . " " . ' ($' . $row['test2'] . ")<br>"; </td> </tr> } </table> How do I make a pattern for the background color? For ex, grey, blue, grey blue. ...

Generating many nested lists using PHP and MySQL?

I've been looking around this site but could not find a good answer on how to create a menu with many nested lists. I personally don't know how to code in the PHP and MySQL to do this and I'm trying to learn the best way to do this. I'm a rookie. All I got created is the MySQL table called categories which is listed below. id | paren...

PHP function call from form not working

Guys, I'm trying to call a function from a form within the same .php file, but when the Submit button is hit, the table doesn't get generated. Here's the code: <p> <?php function selectQuery() { $con = mysql_connect("localhost","readonly",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_s...

i18n with gettext but without the locale hassle?

I am looking for a standards-compliant way to store multi-language content for a Web Application. Until now, I have employed my own "translate()" functions that read data from a file or a dictionary table in a database. However, keeping the dictionaries up to date in a database table is very cumbersome if you work with different copies o...

OSX: Convert all files in folder to same encoding

Hi folks, I have a rather large php project with all kinds of different third party includes. Its all managed with Netbeans PHP. I have a few problems i would like some oppinions on. Does anyone build there php-project? When i upload to server via ftp i get all kinds of project files which doesnt belong to live environment. Would be n...

nested xml document in Simplexml document

Hi, I have a problem when using simplexml to read a xml document that I am getting back from a webservice call. Reading the data is fine however one node called UserArea contains a nested XMLdocument which contains namespaces. From this question on SO I've looked at how to deal with child nodes. However when I call the node that has t...

PHP: use default value when calling a function.

in PHP you can call a function. by not calling all parameters by using these statement. function test($t1 ='test1',$t2 ='test2',$t3 ='test3') { echo "$t1, $t2, $t3"; } and you can just use the function like this test(); lets just say I want the last one to be different but not the others. the only way i know is by doing this with n...

Active link state help WORDPRESS

Hello everyone, looking for some help:) http://69.65.3.168/~doubleop/pro.sperity/blog is the site i am working on, you can see the navigation is a drop down. I want the green to hover over active pages. This is a drop down menu, so i created parent pages as the main nav links, and the drop down contains child pages. All the links are...

How to debug a PHP file that is being called by AJAX?

I have a php file for uploading a picture (it uploads the picture, creates its thumbnail and also adds watermark to the picture). The file is being called by AJAX. It was working on on my localhost on Windows XP with WAMPSERVER 2.0. Now I have installed Windows Vista and suddenly it doesn't work properly (the picture gets uploaded but t...

Send and receive messages via (libpurple) messenger protocols

I had an idea that would require me be able to send and receive messages via the standard messenger protocols such as msn, icq, aim, skype, etc... I am currently only familiar with PHP and Python and would thus enjoy a library which I can access from said languages. I have found phurple (http://sourceforge.net/projects/phurple/) for php...

writing a php script to download youtube videos

hi all, i am looking for a way to download youtube videos from within php. but i dont have any experience about this sort of programming. i dont know whether it is about API programming, socket programming, curl or .... any help or reference will be appreciate. ...

[PHP]: Can someone help me fix this DataGrid class?

I am using following PHP class to display records. I also want to open another webpage when a row is selected according to a column value. This class is doing everything fine when this line is like: $x->setQuery("*", "people"); If instead of *, I define columns like: $x->setQuery("fname,lname,age", "people"); it stops identifying t...

WAMPSERVER GD2 - doesn't support jpeg images?

I have WAMPSERVER 2.0 installed on my localhost with php_gd2 extension enabled, however when I'm trying to save a jpeg image I get this exception: Your GD installation does not support JPG image types How to enable JPG images? ...

Large dynamic side-nav menus using PHP and MySQL?

What is the best way to display a large tree side-nav menu with many nested list levels using PHP and MySQL? How many tables should I use and how should I code the PHP? ...

Doctrine migration foreign keys

In PHP Doctrine, is it possible to create one migration class that creates a table and creates a foreign key on that table? For some reason, I can't get the foreign key to work ... class Migration_001 extends Doctrine_Migration_Base { public function up() { $this->createTable('table_name', array(...)) $this->createFo...

advice on php parsing

Hi all, I am using phpTumblr, a wrapper around the tumblr blog api that allows you to access posts via php. I want the site to display new posts dynamically, so I am using php to write html code. I find myself writing things like print(blablabla); or print(); ... and so on, and setting the header of the document to text/html, so that t...

Json and Mysql problem

hi here is my code for json php include("connect.php"); $id = $_GET['lid']; function countRec($fname,$tname) { $sql = "SELECT * FROM `mail` WHERE confirmed = 'no' AND label_id = '". $id ."'"; $result = mysql_query($sql) or die ('test'); $num = mysql_num_rows($result); return $num; } $page = $_POST['page']; $rp = $_POST['rp']; $sort...

mySQL caching - Memory or Hard disk?

Hi all, I am working on a grid based treasure hunt like game in PHP , mySQL and I am trying to decide between two caching options. Game Description The user has a 1000 cell grid, clicking on some cells will have no effect, others will direct you to a "this item has been found!" page :)... many items are accessible via any of a number o...