Foreach, special treatment of every n:th item (odd, even for example)
I have a foreach that looks like this: foreach ($blogusers as $bloguser) { $args = array( 'author' => $bloguser->user_id, 'showposts' => 1, 'caller_get_posts' => 1 ); ...
I have a foreach that looks like this: foreach ($blogusers as $bloguser) { $args = array( 'author' => $bloguser->user_id, 'showposts' => 1, 'caller_get_posts' => 1 ); ...
An array arrives with some or all of the following values, in any order. What's the best way to order them in ascending size order? So starting with small and ending with XXL. I can usort but am a bit lost as to how the elements should be ordered in my user defined function Small XXL Medium Large XL EDIT: left out some info so create...
I want to create a textfield element in Zend Form which always type in uppercase whether CapsLock is On or Off. Thanks ...
I have an HTML form that builds a drop-down from json data that is retrieved dynamically on page load from a php script. <html> <head> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> <script type="text/javascript" language="javascript"> $(document).ready(function() { jQuery ....
I wish to control my computer (and usb devices attached to the computer) at home with any computer that is connected to the internet. The computer at home must have a program installed that receives commands from any other computer that is connected to the internet. I thought it would be best if I do this with a web interface as it would...
The following array arrives: Array ( [66-507cddcd16d9786abafccfa78b19acf8] => XL [64-507cddcd16d9786abafccfa78b19acf8] => medium [65-507cddcd16d9786abafccfa78b19acf8] => large [63-507cddcd16d9786abafccfa78b19acf8] => small ) How can I order the values of the array in ascending size order in such a way that the key / va...
I won't tell you I've searched and tried dozens of syntaxes from the internets. You couldn't tell if I'm lying or not. So... This is part of my html (the relevant part): var jsonData = { address: 'address', address1: 'address1', address2: 'address2' }; var out = JSON.stringify(jsonData); $.ajax({ type: "POST", con...
I have an upload system based on SWFUpload which calls PHP script. The problem is that in case of any problem with the uploaded file (too small image dimmensions, too short mp3 file etc) the system is supposed to throw an error, by setting the cookie with error message (this is the way the whole CMS handles errors). The problem is that c...
Hi, I want to delete a folder when the page is refreshed on closed. Here is my code, what exactly is wrong, why is it not deleting the directory window.onunload=closed; function closed() var FolderName = "uploads-temp/"+<? echo $create_temp_dir; ?>+"*"; var fso = new ActiveXObject("Scripting.FileSystemObject"); fso.DeleteFolder(...
In order to do a LIKE search with PDO, I need to add the % to the parameter before passing it. This works: $qry = ' SELECT product_id FROM cart_product WHERE product_manufacturer_num LIKE :search_string '; $sth = $this->pdo->prepare($qry); $sth->execute( array("search_string"=>'%'.$search_string.'%') ); To me this feels ...
Hi all. I usually write this: if ($myvar == null) but sometimes I read this: if (null == $myvar) I remember somebody told me the latter is better but I don't remember why. Do you know which is better and why? Thanks, Dan ...
The title pretty much says it all. A cookie seems to have a few advantages to me; however, I'll wait to see what others say. Also - assuming a cookie is better, what can be done to make passing the session by GET variable better? Specifically I'm thinking about PHP; however, this should apply generally. ...
Hello All, I am trying to render an image with text and images that are on a .swf file. What i am doing is saving all the objects and their properties in an XML and then using imagemagick to render all that. the problem i am facing is that imagemagick treats fonts very different than Flash, so i don't get a perfect copy of what i see in...
hi, Here's a situation, i have a list of support tickets that when you click the title of the ticket takes you to a page that displays the ticket in more detail. If uses URL GET variables to query the database. I've taken SQL injection into account but what if someone modifies the url to an id that doesn't exist? whats the best way to d...
Hello I am using cakePHP 1.3 and I am unable to retreive the last inserted row's id. I actually am using $this->Model->id to retreive the last inserted id but I am unable to get the id. When tried to check what is return type, it says as bool(false), which means nothing is returned. Here I am loading a different model in a different con...
I want to create a command line based tool for PHP Development. It should do something quite similar based on what the rails generator does as well as integrate with rake, as the rake tasks for the DB should also be available. Or is there a ruby framework that allows to build such generators? ...
What is this really? It starts a current session based on cookies? Got that from the PHP Website. How does like...PHP control the session. If I start a session when a user opens up my login page, what do I even use that session for. What does closing a session actually do. Can I use the current session to get info about the logged in use...
well, my question is simple, is a cookie secure in a HTTPS conection? ...
Hi guys, I'm querying a MySQL table to get some data that I display on a php page. The problem is that the col widths are small for a few columns. Is there any-way I can specifically change those (not the rest)? Currently, I'm doing my printing via a loop, so it seems strange to me as to how to pin-point which corresponds to the col...
I wrote simple site and I access by typing http://localhost/test/index.php on mu local machine. I use wamp.Can somebody over net access this site, I need to show ? How to set my default page to be home.php? ...