CodeIgniter: problem using foreach in view
I have a model and controller who gets some data from my database and returns the following array Array ( [2010] => Array ( [year] => 2010 [months] => Array ( [0] => stdClass Object ( [sales] => 2 ...
I have a model and controller who gets some data from my database and returns the following array Array ( [2010] => Array ( [year] => 2010 [months] => Array ( [0] => stdClass Object ( [sales] => 2 ...
how do i highlight search results from mysql query using php? this is my [modified] code: $search_result = ""; $search_result = $_GET["q"]; $result = mysql_query('SELECT cQuotes, vAuthor, cArabic, vReference FROM thquotes WHERE cQuotes LIKE "%' . $search_result .'%" ORDER BY idQuotes DESC', $conn) or die ('Error: '.mysql_error()); ...
Hello, I have developed a competition page for a client, and they wish for the email the customer receives be more than simply text. The tutorial I used only provided simple text, within the 'send body message'. I am required to add html to thank the customer for entering, with introducing images to this email. The code is: //send the...
I've created a class in PHP that allows you to create custom HTML markup. It basically works a bit like FB Markup or EE tags. It works off a tag prefix, so you can add tags like this. <ctag:pagination per_page="20" total="500" page="0" base="http://localhost/page?page={page}" mode="smart" adjecents="5" /> My question is: Is the markup...
I have got this little snippet of code, I want to be able to define each array element as a new data member. class Core_User { protected $data_members = array( 'id' => '%d', 'email' => '"%s"', 'password' => '"%s"', 'title' => '"%s"', 'first_...
I want to access private methods and variables from outside the classes in very rare specific cases. I've seen that this is not be possible although introspection is used. The specific case is the next one: I would like to have something like this: class Console { final public static function run() { while (TRUE != FAL...
I'm working on a class to manipulate html hex color codes in php. Internally, the class treats RGB values as decimals. When I'm adding or subtracting, I never want the value to exceed 255 nor 'subceed' zero. If course, I can do something piecemeal like if ( $val > 255 ) { $val = 255; } if ( $val < 0 ) { $val = 0; } But th...
Is there anyone who has a good (basic) UML class diagram to get me started on an object oriented CMS? I want to start using OOP in PHP but can't seem to find a good starting point. ...
Hi, I've implemented a mysql-based session interface in php. I just found out that if I log in to my account using browser A (e.g. Chrome), and then I log in to the same account in another browser B (e.g. IE), each browser is assigned 2 separate session ids. How can I make it such that when I log in again using browser B, I retain the...
Hi folks, I'm learning PHP. Having trouble understanding why this piece of code isn't working. In particular: why is the result of array_sum($x) (1596) greater than $cap? Perhaps I'm not understanding the nature of while loops, but it seems to me (looking at a print_r($x)), the loop should cut out a step before it actually does. <?...
I need SwA (Soap with Attachments) support in php for a project. I can't find a reference in ZF docs about supporting SwA or not. Anybody knows if it is supported? If not supported, I have heard about WSO2 WSF/PHP which it does support SwA. My question would be... is it possible to integrate both ZF and WSF/PHP? Thanks in advance! Pab...
I am starting with a new site (it's my first one) and I am getting big troubles ! I wrote this code <?php include("misc.inc"); $cxn=mysqli_connect($host,$user,$password,$database) or die("couldn't connect to server"); $query="SELECT DISTINCT country FROM stamps"; $result=mysqli_query($cxn,$query) or die ("couldn't execu...
I'm trying to bind input parameters into my SELECT query and then fetch the resulting rows, but MySQLi seems to be different to other APIs I'm used to and I'm getting lost in the PHP manual. Is the following approach correct? $sql = 'SELECT product_id, product_name, area_id FROM product WHERE product_id = ?'; $stmt = $myMySQLi-...
Hi there, A conversion question relating to prices in oscommerce: I am needing for a custom currency conversion to round the USD prices up to the nearest 5$ to avoid prices being displayed at silly prices such as $263. I am trying to convert to an int and round the following line : $curr->display_price($listing['products_price'], te...
Hello I am working on cakephp and totally a newbie to php/cakephp. Can you please tell me what is wrong with my route configuration here? Router::connect( '/news/:q/:page', array('controller' => 'news', 'action' => 'onDemand', 'mode'=>'news', 'page'=>1), array('pass'=>array('q','mode','page'), 'page' => ...
I've got a fully custom PHP site with a lot of database calls. I just got injection hacked. This little chunk of code below showed up in dozens of my PHP pages. <?php /**/ eval(base64_decode(big string of code.... I've been pretty careful about my SQL calls and such; they're all in this format: $query = sprintf("UPDATE Sales SET `S...
I installed lucia's linky love on my site and comments are showing up as (new comment) instead of showing the count. I don't even know what that means. How do I make it show the actual count and what does "new comment" mean? I know this text is included but don't understand it: if (($oldCommentDate < mysql2date('U', $comment->comment_...
I'm trying to transfer a site from one hosting company to another. I was using 000webhost until the client had hosting and a domain. Now that the client has their domain and hosting, using FatCow.com, I can not for the life of me, debug my PHP code. I'm not getting any errors. I have a successful DB connection. If you procedurally displa...
I'm dealing with an outdated PHP4 IIS server which has odd settings and I absolutely cannot update PHP or modify any server settings. This legacy site on the server basically has subdirectories which have an includes directory so there are multiple includes directories, and in my root I do something like include 'includes/nav.php'; T...
I have a function that checks multiple form items and returns either boolean(true) if the check passed or the name of the check that was run if it didn't pass. I built the function to run multiple checks at once, so it will return an array of these results (one result for each check that was run). When I run the function, I get this arra...