php

Can I rewrite this using Zend_Db_Select?

I need to write the following query: SELECT forum_threads.id AS id_thread, forum_threads.topic, forum_threads.date_created, forum_posts.content, CONCAT(users.first, ' ', users.last) AS author_name FROM forum_threads,forum_posts,users WHERE forum_threads.category_id=1 AND forum_threads.author_id=users.id AND forum...

php header() above document root

I am trying to user header() to direct to a page above the document root. I'm running XAMPP so I'm trying to call a script above htdocs. My problem is it gives me the 404 error and can't find the document. My question: can you use header() to call a script above the document root or is it better to use an include() to accomplish this?...

Is it possible to have complete control over zend_form layout?

I've been working with Zend Framework for a couple weeks so this might be a complete noobie question but I'm wondering if there's a way to customize the layout of forms in an explicit way using Zend_Form. I've looked all over the place but every example of Zen-Form I've found use the echo example. For example, when I work with Smarty an...

XML items to Form Select Menu (in php?)

Hi all, I was wondering if anyone knows how to get information from an XML file and turn it into a form select/list using php.. This is the XML schema: <?xml version="1.0" encoding="utf-8"?> <expose version="2.1"> <collection _mngid="1"> <collection _mngid="1"> <title>Heatherton Football Club</title> <thumb> <...

how to generate the snippet like generated by google with PHP and MySQL?

Say,it just returns the snippet around which the searching keyword exists. And part of the text is replaced by "...". Is it possible to achieve that goal with PHP and MySQL? ...

Creating a php function to return mysql results

Im trying to create a function, that will return a mysql query, which i can then loop through and handle the results, but it doesnt seem to be working. I might not even be doing this the right way. function GetAccounts($username){ require("dbconn.php"); $result = mysql_query("SELECT * FROM `accounts` WHERE `username` = '$username' ") or...

Is php not case sensitive?

I am using mysql and php. In my database I have this table called users, inside users table have a record: username: admin password: password In my login page, I tried login as (password: password): username : ADMIN -> result : can login username : admin -> result : can login I store the username in my database as "admin" all low...

List of all tables in database, and number of rows in each one?

Does anyone know what MySQL statement I would use to return results containing a list of all the tables in a database and the number of rows in each one? ...

Using SimpleXML to get twitter avatar url (weird)

Im using simplexml to get the twitter profile avatar url from the xml status page. this is the code im using <? $username = twitter; $xml = simplexml_load_file("http://twitter.com/users/".$username.".xml"); echo $xml->user->profile_image_url; ?> The xml page loads when i visit it, but for some reason nothing is being echoed. No error...

Adodb Active Record vs Zend db_table

Hello I use Adodb and Active Record for database abstraction. I have started to use Zend Framework, and one of the reasons I like it so much is due to it's "Use at Will" architecture which allows me to continue using Adodb rather than Zend's db_table functionality. I have taken a look at Zend_DB_Table on paper, but really want to know...

using array in sql query

Hi, I have the following that grabs all the categories under a parent category: <?php $childrows = array(); $result2 = mysql_query("SELECT * FROM categories WHERE category_parent_id='$cid'"); while ($row = mysql_fetch_array($result2)){ $childrows [] = $row['category_id']; print_r($childrows); } ?> This returns: Array ( [0] => 47 ) A...

PayPal module in Joomla

Hi friends, I want to download a module or extension or component for Joomla to integrate with PayPal. I have tried a lot but I haven't found any. Can you help? ...

Problem in maintaining session between two different domains on a website done in CakePHP [Closed]

Well as I have posted earlier too...I have created a site in two languages. One with URL www.mainDomain.com (English) and other with www.fr.subDomain.com (French). Both are done in CakePHP,in french I have just changed the views of it to French. But the problem is, when anybody login's in English version and then switches to the French ...

how the opcode cache actually works?

hi.. im doing my final project and its about optimizing web performance (focus on caching). i plan to use eaccelearator as a tool in my final project. i need to know the background process of it, the flow diagram about how it works and how an opcode cache can boost performance of websites. it can be eaccelerator, or anykind of opcode cac...

php to silverlight base64 encode/decode

My question is quite similar with this one. But it is php to silverlight. my php code (server encode): $str = 'This is the string'; $encoded = base64_encode($str); How could I achieved the decoded string in Silverlight 2? ...

PHP variables in classes

I have the following code (I'm a Dot Net developers and I thought if I can bring my OOP knowledge to PHP) class user { var $_un; function user($un) { $_un = $un; } function adduser() { } function checkuser() { } function printuser () { echo $_un; } } $newuser = new user('Omar Abid'); $newus...

using a loop in a template

I started writing my own small scaled framework and i have gotten to the templating part of it. So far i have been able to do simple variable replacing with the following code: public function view($page, $vars) { if(!file_exists('system/views/' . $page . '.php')) { trigger_error("No Template found", E_USER_ERROR); }...

utf8 problem with swedish characters from command line

I have a script that gets a string from the database, splits it into words and writes the words to the database. It works perfectly when i call the script via http (using apache web server). It also works to run it from a windows command line. However, when i try to run it from the command line (shell) in ubuntu all swedish chars ÅÄÖ is ...

Existing class name clash in PHP, need a creative solution

I realize that you cannot "undeclare" or "redeclare" a class in PHP, nor can I use extension methods as in C# > 3.0. So, here's my situation. I'm working with someone else's code base. They must have been using a slightly older version of PHP where a DateTime class did not exist, so they included an open source library that adds Time...

How to convince my boss to use Django?

I have an unusual problem: I have to convince my superiors to use Django for our new project. Alternative is some PHP framework. I've programmed in PHP for 2 years and then switched to Python and have about 3 years of experience in it. However I'm not too good in business speech. I know all the technical pros and cons but when it comes...