php

[fb:request-form] invitation never arrive in wall friend

Hi, i try to create invite form in my fb app, using this code <?php // Prepare the invitation text that all invited users will receive. $content = <<<FBML <fb:name uid="$user_id" firstnameonly="true" shownetwork="false"/> wants to know what your Favorite Games are! <fb:req-choice url="{$facebook->get_add_url()}" label="Add Favorite Ga...

Read XML from Youtube Videos

Hello how i can read XML from youtube $xml = new XMLReader(); $xml->open('http://gdata.youtube.com/feeds/api/videos/1uwOL4rB-go'); $r = array(); while($xml->read()) { $r[] = array($xml->name => $xml->value); } i got this far but it doesnt get the necesary info i need like video duration.... ...

Problem with DOMXPath query in PHP

I have a got piece of HTML code: <form method="post" action="/"> <input type="hidden" name="example-name" value="example-value"> <button type="submit">Submit</button> </form> How can I extract value of the hidden input using DOMXPath in PHP? I have tried somethig like this: //$site - the html code $doc = new DOMDocument(); $doc->...

Why is there a mime type inconsistency with firefox, chrome?

I was puzzled at first why my files weren't uploading for some users and I found out it was everyone who wasn't using chrome which was the browser I was testing. Basically I'm doing a file check to make sure they are only able to upload mp3s. This this was working for chrome, but not firefox. if ($_FILES['uploaded']['type']=="audio/mp...

Retrieve messages from RabbitMQ queue(s)

Hey guys, I'm looking to implement RabbitMQ into my PHP application, and am using the php-amqp extension. My only question is this, how do I easily query to return the contents of the queue in PHP? php-amqp seems to not enable me to do this. If I am going wrong, please help me out here :) ...

Mapping javascript objects to their ids in an MySQL database

Hey all, This is a question that I have been pondering for a long time, but didn't want to ask because I wasn't sure how to describe it.. I'm still not sure if I can describe it well but here it goes.. I have a web app that allows you to manipulate a bunch of elements on the page, but has one save button. When I hit save I would like ...

excluding previously randomized integer, and randomize again without it

<?php if (isset($_POST['Roll!'])) { $sides = $_POST['sides']; $rolled = rand(1,$sides); echo "$rolled was rolled by the dice, it is now out!"; } ?> This is the code I currently have. After rolling that number, however, I want it to roll again, but without the ...

wordpress - how to get php variable in page from sidebar

I wrote my own custom page template for my Wordpress page, now I want to change sidebar.php to insert a small menu whenever that page template is loaded. // sidebar.php if ( isset($event_name) ) { // do something } But apparently sidebar.php doesn't recognize variable $event_name. How do I come about solving this? ...

Advanced SQL query. Top 12 from each category (MYSQL)

I have a MYSQL5 database and PHP 5. I need a query for a games websites index page that only selects the first 12 from each category of games. Here is what I have so far. $db->query("SELECT * FROM `games` WHERE status = 'game_published' AND `featured` = '1' ORDER BY `category`"); The php code then groups games of the same category ...

Integrating a javascript object with jquery

I have this js object which I got from php through jason_encode(). This object has 2 objects, Name and Video. Then through a for loop I distribute the names into divs. My problem is I need to create a link in each div that would create a dialog that displays the video. I'm basing this idea from the jquery UI example: http://jqueryui.co...

Extracting portions of a loaded page in PHP (RegEx)

I have a newsletter system I am trying to incorporate within a PHP site. The PHP site loads a content area and also loads scripts into the head of the page. This works fine for the code that is generated for the site but now I have the newsletter I am trying to incorporate. Originally I was going to use an iFrame but the amount of AJAX ...

PHP Convert Unix time to ISO and Subtract an Hour

Hello, I'm restructuring my MySQL database, which has several columns in Unix format. Because I already have several rows in the database in Unix format. How can I convert the Unix fields to iso, and then subtract an hour using PHP? For example, I currently have: <?php $unix_time = 1267840800; $conversion = date("c", $unix_time...

AI template needs to be added to cakePHP framework

I have an AI template that was designed for this page but not sure if i need a front end person or a back end person to make the bridge from design to an actual live page using the cake framework... i know there is some documentation on templates using cake, do we slice it up normally and then just add the content to the framework? ...

PHP date() format when inserting into datetime in MySQL

Whats the correct format using the date() function in PHP to insert into a MySQL datetime type column? I've been trying this date("Y-M-D G:i:s"); but that just inserts "0000-00-00 00:00:00" everytime. ...

How to populate html textbox with mysql data

I'm trying to make an update form. The update part is already working but it would be better if I'm going to put a view button so that the users will not input the data all over again just to update it. I'm working on this code, it there's a button in the html form that with this code as its form action. It's job is to populate the text...

How can I filter a product's availability using isSaleable attribute?

Instead of stating that an item is out of stock, I like to have it available for order with the exception of a warning that states the availability of product for shipment. I created an attribute and assigned a date input type. Below is my attempt to get this working with no luck so far. Appreciate some help. Thanks. <?php $empty="" ?>...

Howcome my SQL query is not sorting the column?

http://new.monmouthchineseschool.com/curriculum/cantonese/textbook.php if you take a look at 'C1' 一 十 十一 十二 十三 二 三 四 五 六 七 八 九 that is how all the links look like. this is the mysql db for that class CREATE TABLE IF NOT EXISTS `mon_textbook` ( `id` int(11) NOT NULL auto_increment, `class` varchar(255) NOT NULL, `ch` va...

Elegant practices on "random utility functions"

Hey all, I was wondering how you all organize your random functions to improve a language's functionality outside of OOP classes (global functions). I've seen libraries, but I'm still not sold on this being a good solution, especially if you don't have enough functions. I'm specifically interested in how people organize random PHP and ...

PHP: Simple regular expressions to match length?

I'm creating a registration system that needs to check the name/pass etc. with REGEX (and prefer to), what I've got so far is: //Check so numbers aren't first, such as 00foobar preg_match('/^(?!\d)[a-z0-9]+$/iD',$usrname); //Just simple check preg_match('/^[a-zA-Z0-9]+$/',$psword); But I have to do stupid things in IF statements like:...

How do PHP/MySQL database queries work exactly?

I have used mysql a lot but I always wondered exactly how does it work - when I get a positive result, where is the data stored exactly? For example, I write like this: $sql = "SELECT * FROM TABLE"; $result = mysql_query($sql); while ($row = mysql_fetch_object($result)) { echo $row->column_name; } When a result is returned, I am as...