CakePHP Session vaiable use in view page?
hi i have a varible contaning "username" and want to get these values via session to any of the view page. How can i use session vaible in view ...
hi i have a varible contaning "username" and want to get these values via session to any of the view page. How can i use session vaible in view ...
I'm studying for the Zend PHP certification. Not sure the answer to this question. Question: What is the best way to iterate and modify every element of an array using PHP 5? a) You cannot modify an array during iteration b) for($i = 0; $i < count($array); $i++) { /* ... */ } c) foreach($array as $key => &$val) { /* ...
I am currently re-writing my functions script (PHP) for my login system. Is the below code safe and a "good" way to check if the user is logged in? function loggedin() { $ID = ($_SESSION['ID']); $sql = "SELECT `online` FROM `users` WHERE `ID` = '$ID'"; $result=mysql_query($sql); $count=mysql_num_r...
I'm working on a web UI control called Folder - it basically mimics Windows Explorer folder - you see a grid of items inside a rectangle and can drag an item around, drop an item inside a different instance of the control, add new items and so on. each item is made of an item template - basically some php code that dictates the look of t...
I want to create a less than or equal to 10 character unique string for an input string which could be a url http://stackoverflow.com/questions/ask OR an alpha numeric string programming124 but the result should be unique for every input...Is their any function or class that you use for your projects in php... Thanks... ...
i have a problem with my session files... if i go to my site directly (www.example.com) then php session files owner is www-data:www-data but if i go do the site via www.example.com/index.php then the owner of the session files is ftp:www-data and the resulting problem is when i want to start the session but the session file allready ex...
Hi, I have two classes in a PHP application, B extending A for example. Class A has a function which returns some of its other properties in the form of an array of SQL insert queries eg Class A { $property_a; $property_b; $property_c; $property_d; function queries() { $queries = array(); $queries[] = "INSERT INTO xxx VALUES " . $this-...
so i have my website, which i did in wordpress - http://chrisgruggen.com/class/mpm35/interactive-self-portrait/ my goal is to make the left sidebar have a list of my top bands (19 or 20 will do). i want them to be organized in order of how many play counts they have (using last.fm api) with the highest being at the top. i also want each...
I was having trouble sending up a url containing accent characters using IE. Here's a simple function: function runjQueryTest(){ var url = "/test/Beyoncé/"; $.get( url, function(){}); } On the server (PHP) I record the value of the request uri ($_SERVER["REQUEST_URI"]) and I see a difference between what FF/Chrome send up ver...
I've the following players, each value corresponds to a result in percentage of right answers in a given game. $players = array ( 'A' => array(0, 0, 0, 0), 'B' => array(50, 50, 0, 0), 'C' => array(50, 50, 50, 50), 'D' => array(75, 90, 100, 25), 'E' => array(50, 50, 50, 50), 'F' => array(100, 100, 0, 0), 'G' =...
About 2 years ago I made the mistake of starting a large website using iso-8859-1. I now am having issues with some characters, especially when sending data to the server using ajax. Because of this, I would like to switch to using UTF-8. What issues do you see coming from this? I know I would have to search the site to look for ch...
Hi, I have a php file which has multiple classes in it. I noticed that __autoload is being called when I instantiate any of the classes, even after the 'package' file has been autoloaded. This is worrying me, because surely if the initial 'package' .php file has been loaded, it is unnecessary overhead for __autoload when the classes hav...
Hy guys! I need to print all matches using preg_match_all. $search = preg_match_all($pattern, $string, $matches); foreach ($matches as $match) { echo $match[0]; echo $match[1]; echo $match[...]; } The problem is I don't know how many matches there in my string, and even if I knew and if it was 1000 that would be pretty d...
Folks, I know there have been lots of threads about forcing the download dialog to pop up, but none of the solutions worked for me yet. My app sends mail to the user's email account, notifying them that "another user sent them a message". Those messages might have links to Excel files. When the user clicks on a link in their GMail/Yaho...
Tough to explain so here's an example: $inventory = array( array("type"=>"fruit", "price"=>3.50), array("type"=>"milk", "price"=>2.90), array("type"=>"pork", "price"=>5.43), ); I would like to sort inventory's element by price so I would like: $inventory = array( array("type"=>"pork", "price"=>5.43), array("type"=>"...
Hello I have an api response in xml format with a series of items such as this: <item> <title>blah balh</title> <pubDate>Tue, 20 Oct 2009 </pubDate> <media:file date="today" data="example text string"/> </item> I want to use DOMDocument to get the attribute "data" from the tag "media:file". My attempt below doesn't work: $xmldoc = n...
I have the following mod_rewrite rule: RewriteRule ^([^/.]+)/?$ search.php?action=procedure&procedureName=$1 This works fine in redirecting things like /blabla to /search.php?action=procedure&procedureName=blabla The problem is that sometimes I want to pass a 'start' value (for pagination). For example, /blabla/?start=20. Currently,...
I recently experienced a flood of traffic on a Facebook app I created (mostly for the sake of education, not with any intention of marketing) Needless to say, I did not think about scalability when I created the app. I'm now in a position where my meager virtual server hosted by MediaTemple isn't cutting it at all, and it's really comin...
I'm trying to echo the key of a custom field (value, such as a URL set while editing a post) back into the document. Here's the overall code: <div id="feature" class="clearfix"> <?php $feature_post = get_posts('category=3&numberposts=1'); foreach( $feature_post as $post ) : ?> <div clas...
I am using Netbeans and programming with PHP. I have seen debugging tools like watches and call stacks. What exactly are watches and call stacks? How do I use them in Netbeans? ...