php

PHP mysql_fetch_array

$n=mysql_num_rows($rs); $i=0; while($n>0) { while(($row=mysql_fetch_array($rs))&&$i<=5) { echo $row['room_name']; $i=$i+1; //echo $n."<br>"; } echo "<br>"; //echo "n1=".$n; $n=$n...

Facebook Custom Page and App directions ?

I have to develop Facebook app and put it into custom made facebook page as a side widget. what are alternatives on customizing Fan page (one I googled is through static FBML - FBML)? also I need to provide backend part in clients site so banner in the page can be changed from there. considering this I assume the "static FBML" is not an ...

DOM: how to import nodes and give them different namespace prefix

I'm familiar with the DOMDocument::importNode method for importing a tree of nodes from some other document element. However, what I was wondering is if I can automatically change the namespace prefix on a tree of nodes as I import them, that is, specify a new prefix for all nodes of that namespace. Say the nodes, in their existing doc...

How to make this regular expression?

I want to replace all line break (<br> or <br />) in a string with PHP. What regular expression I should have to do this, using preg_replace? Thanks! ...

How to delete refClass record in Doctrine?

Hi all! I have many-to-many relations with the following tables. post tag post_tag I created three classes with Doctrine, so I have the following classes as well. BasePost BaseTag BasePostTag in the setUp() method, I defined relations. I like to delete tag record when I delete post record. So I simply put cascade as descirbed on Doc...

Building html tables from query data... faster?

With my limited experience/knowledge I am using the following structure to generate HTML tables on the fly from MySQL queries: $c = 0; $t = count($results); $table = '<table>'; while ($c < $t) { $table .= "<tr><td>$results[0]</td><td>$results[1]</td> (etc etc) </tr>"; ++$c; } $table .= '</table>'; this works, obviously. But f...

How do I call a function using a function name generated from a string variable.

In the process of automating some code, I am looking to call upon a function based on what a string is. For example, I have a variable $somevar which is set to the string "This". Now I want to run a function doThis(); So, I was hoping I could write do.$somevar($var,$var2) . I want it to run doThis($var1,$var2). Is this possible? ...

Finding out the common / uncommon elements between two Arrays in PHP

Consider I have two arrays: $friends = Array('foo', 'bar', 'alpha'); $attendees = Array('foo', 'bar'); Now I need to populate a new array $nonattendees which contains only the elements which are in $friends array and not in $attendees array. i.e, $nonattendees array should be populated with 'alpha'. Is there any in built array operat...

zen cart- pop up page on home

Hai I have a zen cart project. Here I want to show an Ajax pop up box (on body load). But I am new to Zen cart. Pop up must be shown only on the home page. Is it possible? Please help me. Thanks in advance ...

reply to a comment via email and directly post it on the website commenting system

Hello Everybody, I have developed a website using PHP and MYSQL. The website has a commenting system through which registered users of the website can post comments on the feedback posted by different users. When a comment is posted for a feedback an email is sent to the user who posted that feedback notifying him of new comments on hi...

Set Action Controller name for Zend_Tool create controller

Hi All, All my controllers use a custom Action Controller class, is there anyway to set the action controller class it uses when generating the the controller code? Or would be even better if I could set it up to map the action controller class to use based on the module the class is being created under. Cheers. ...

Order object simplexml_load_file by field of this.

Hi i have a problems with simplexml_load_file, i'm not pretty sure how to do to order my array by a $item->padre. I need to do foreach and order by $item->padre.=, i don't know how to do this. function create_sitemap($sitemap){ $xml = file_exists('sitemap.xml') ? $xml = simplexml_load_file('sitemap.xml'): exit('Failed to open sitema...

XPath query returning 'false' in SimpleXML

Hi all, I have an xml fragment as such: <meta_tree type="root"> <meta_data> <meta_cat>Content Provider</meta_cat> <data>Mammoth</data> </meta_data> <meta_data> <meta_cat>Genre</meta_cat> <data>Games</data> </meta_data> <meta_data> <meta_cat>Channel Name</meta_cat> <dat...

Erroneous Matches with Regular Expression

$regexp = '/(?:<input\stype="hidden"\sname="){1}([a-zA-Z0-9]*)(?:"\svalue="1"\s\/>)/'; $response = '<input type="hidden" name="7d37dddd0eb2c85b8d394ef36b35f54f" value="1" />'; preg_match($regexp, $response, $matches); echo $matches[1]; // Outputs: 7d37dddd0eb2c85b8d394ef36b35f54f So I'm using this regular expression to search for an a...

How to list records for a query and to display 'no records' when no rows returned using a single query?

How to list records for a query and to display 'no records' when no rows returned using a single query? Now i'm using a count(*) query or using the mysql_num_rows and then another query in different result set to list data.. Please tell me whether its possible with a single query..? ...

The css is not displayed in opera mini and balckberry browsers

Hi All, I 'm a php developer. I develope a site for mobile using php hawhaw.inc. i use the page sim for set the css for my page as $myPage->use_simulator("http://".$_SERVER["SERVER_NAME"].":".$_SERVER['SERVER_PORT'].dirname($_SERVER['PHP_SELF'])."/css/style.css") im my css file i write the css for table. it set in the windows mobi...

PHP FTP Upload thousands of files

Hi, I've written a small FTP class which I used to move files from a local server to a remote server. It does this by checking an array of local files with an array of files on the remote server. If the file exists on the remote server, it won't bother uploading it. The script works fine for small amounts of files, but I've noticed tha...

flex actionscript not uploading file to PHP page HELP!

hello, please help! I am using actionscript 3 with flex sdk 3.5 and PHP to allow a user to upload a file -that is my goal. However, when I check my server directory for the file... NOTHING is there! For some reason SOMETHING is going wrong, even though the actionscript alerts a successful upload (and I have even tried all the event lis...

Is there any website where they have php 5 excersizes and problems for the beginner?

A website where there are questions for beginner php5 learners. Any websites would be helpful, thanks. ...

what are the difference between for loop & for each loop in php

what are the difference between for loop & for each loop in php? ...