php

a list with different css classes and php query

I have this php query $sql = "SELECT * FROM db"; $query = mysql_query($sql); while($row = mysql_fetch_assoc($query)) { echo "<ul>"; echo "<li>{$row['title']}</li>"; echo "</ul>"; } and my xhtml code is: <ul> <li class="pdn5">one</li> <li class="pdn5">two</li> <li class="no-pdn">three</li> </ul> In this case, how can w...

How to fetch only certain rows from an MySql database table

I have a php array of "primary key" values, which correspond to just a few rows of a very long table of data, saved on a MySql database. How can I fetch with just one query only those rows. Is it possible or will I need to make one query per primary key? eg: SELECT * FROM table1 WHERE key = 8573 Thanks, Patrick ...

Determine minimum required PHP version

I have to find out the earliest PHP4 version my code will run under (I already know it runs on PHP5 and on PHP 4.4.9 (the last PHP4 version -- included in MAMP). Are there code inspection tools that will do this? Do I need to install each PHP version and see what happens :-) ...

What is causing this strange PHP fatal error?

I have a generic Logger class that looks like this: class Logger { ... public function add($userId, $siteId, $logTypeId, $message) { $Log = LogMapper::create(); $Log->setUserId($userId); $Log->setSiteId($siteId); $Log->setLogTypeId($logTypeId); $Log->setMessage($message); $Log->save(); ... } ... ...

Prefixing MySQL Tables or Many MySQL databases?

So, first things first, I'm a student. I'm developing an application where other students can have access to a MySQL database. Basically, I wanted to spare the students the need to search for hosting or even installing MySQL on their computers. Another plus is the fact that they can present their works to the class just by browsing a web...

Multiple cookies with same name

I just figured out that I have a problem in IE while working with one of my pages. I set cookie with: setcookie('page', '12345', '2000000', '/'); And if I login I reset the cookie calling that function again. In firefox everything works fine cause the old cookie is deleted but in IE both cookies stay? How can this happen? Isn't that i...

Php $_REQUEST vs $_GET and $_POST

Hello everyone. Can you please guide me which of the below code will be more efficient and fast. $temp = $_REQUEST['s']; OR if (isset($_GET['s'])) { $temp = $_GET['s']; } else { $temp = $_POST['s']; } Thanks ...

Joomla User creation hooks

Hey! Is it possible to create a hook when a user creates an account? I have googled and found some stuff on hooks and joomla but nothing really concrete. Anyone knows if this is possible? Or do I really have to mess with the code. I just want to create code that is upgrade safe. Thanks ...

Problem with plugin - Zend Framework

Hello friends, I have this problem with a plugin in zend framework. I've created on this route: library/Mis/Plugins/Unpluginmas.php in application.ini autoloaderNamespaces[] = "Mis_" resources.frontController.plugins.Unpluginmas = "Mis_Plugins_Unpluginmas" Unpluginmas.php class Mis_Plugins_Unpluginmas extends Zend_Controller_Plug...

best way to refactor my form (procedural to oop?)

(Note: this is related to this question, but I think it could have been written more clearly, so I'm trying again -- my update only helped to a limited extent.) I've inherited some code that creates a complex form with numerous sections, and lots of possible views, depending on a number of parameters. I've been working with it for a whi...

What characters need to be escaped when echoing Javascript in PHP?

I'm trying to echo out the Javascript for the Google AdWords conversion tracking code within a PHP if statement. I've done a bunch of googling but can't seem to find a definitive list of what characters I'd need to escape to have the code execute properly. Anybody have suggestions? This first bit of code is the beginning of the if sta...

How can I re-initialize Uploadify script without adding extra button?

I'm walking you through a processs here: Step 1 1. Select product from dropdownlist 2. A form is populated with data 3. An hidden ID get's the product ID from the selected item 4. Uploadify is initialized and retrieves the product ID. An uploadbutton is added to form. Step 2 1. Select new product from dropdownlist 2. The form is re-pop...

PHP: variable-length argument list by reference?

Is it possible to create a PHP function that takes a variable number of parameters all of them by reference? It doesn't help me a function that receives by reference an array of values nor a function that takes its arguments wrapped in an object because I'm working on function composition and argument binding. Don't think about call-tim...

PHP 5.3.0 funky problem with including

I have php file with a class in it that needs to read a variable from my config file. The config file is getting included in both the page thats including the class and the class itself (both with require_once). However, the variable i need to read ($cfg) is apparently undefined in the class file, according to the errors i'm getting: ...

Handling Complex WHERE clauses with a PHP Query Builder

There are several ActiveRecord styled query builder libraries out there. Some are stand alone and some come built into frameworks. However, they really have trouble with WHERE and HAVING clauses when it comes to complex SQL. Setting other databases aside - I am trying to come up with a MySQL and PostgreSQL compatible WHERE() method that ...

How to mimic StackOverflow Auto-Link Behavior

With PHP how can I mimic the auto-link behavior of StackOverflow (which BTW is awesomely cool)? For instance, the following URL: http://www.stackoverflow.com/questions/1925455/how-to-mimic-stackoverflow-auto-link-behavior Is converted into this: <a title="how to mimic stackoverflow auto link behavior" rel="nofollow" href="http://...

jQuery AJAX $_POST on document.ready?

I'm about a week into learning PHP, jQuery and AJAX and am picking up quickly. I'm building a new video website with a comment system that I need a little help on. The site shows a list of video thumbnails, and when the user clicks the thumbnail, jquery automatically changes the html on that page to show the correct video: $(".thumb...

Strange Character on IMG Link?

Exact Duplicate: strange characters on IMG Link? Hello all im using an open source Auto Dealer database made in PHP CMS style. usally when you copy and paste html code on the comments text box on any cms you can edit the page layout with images and fonts. I did this and it did change the layout as i wanted but one problem is that t...

Is it worth learning C as a web developer? Will I ever use it?

As a web developer, is it worth me learning the programming language C? Will I ever need to use it? I am currently using PHP and Ruby on Rails. Thank you in advance to all you good people out there ...

How do I display a follow "us on twiter" and 'xxx on Facebook, become a fan' on my web page?

I would like to show the following links (I think they are called badges) on my homepage. Assume my website is called 'abc' 1). An image saying 'abc' on FaceBook, become a fan (and display a set of random pictures of some of my members) 2). A 'follow us' on twitter link 3). Ability to publish changes to my site (e.g. new news etc) to ...