php

An Efficient way to store table ID in form so user cannot overwrite another table record

Hi, I am creating a website which has user accounts. For each user account, the user can do stuff like update their personal details, write a blog etc. When the user wants to edit a blog, i have the following form (this is a simplied version). <form action="goToThisPage.php" method="get"> <input type="hidden" name="blogID" value=...

Handle Selenium RC open method failure (404)

I have a loop that checks for the existence of urls. If one does not exist Selenium exits: *XHR ERROR: URL = http://localhost/pages/156.php Response_Code = 404 Error_Message = Not Found.* If i catch the exception: try { $this->selenium->open($url); } catch(PHPUnit_Framework_Exception $e) { echo "caught\n"; } Anything i do afterw...

Counterintuitive results from setting the connection character set

I have nearly completed the task of overhauling my web app to be properly "UTF-8 aware". I have found, though, that if I set the connection character set to utf8 using mysqli_set_charset, the result is that output appears incorrectly (indeed it appears as though the page's character encoding had been misidentified), whereas if I do not s...

Best way to apply code updates to a runing website ?

How can I apply code changes to my running website, if I have bug fixes or updates? The simplest way I can think of is to set up the same site in a different directory for testing the updates, and then put my website offline for a period of time to update files. Is there a better way? ...

jquery check checkboxes based on php array

Hi All I have a php array containing the mysql values of checkboxes, which has been selected previously. I am trying to do an edit page of sorts which will show the already selected checkboxes, but seem to be having issues with it. I've tried different ways but can't seem to get it working. Here's my php array of previously selected ch...

Zend Framework _forward to other action inside same controller

How can i forward to other action inside the same controller avoiding repeat all dispatch proccess ? Example: If i point to User Controller the default action is indexAction() inside this funciton i use _forwad('list') ... but all dispatch proccess are repeated.. and i dont that Whats is the right way ? ...

how to prevent this error : Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in ... on line 11

i'm very confused with this error , it shows when I try to return a result from the DB that doesn't exist ... I tried mysql_num_rows() but it returns the same error but instead of mysql_fetch_assoc expects ... it says mysql_num_rows() expects ... I set error_reporting(0) to avoid showing this error, but I'm not satisfied with this solu...

Modifying a PHP page to show a different form

I am trying to modify a php module, which shows a form on a webpage to be different. The original module code is here, and instead of showing menus, I just want to show form fields with names. Here is the code I have so far: http://tinyurl.com/2cjdfuh (redirects to nomorepasting.com) which is essentially just setting up the database ta...

Install Tidy, PHP.

I guess when php was installed on my box --with-tidy arg was not included. When browsing my php.ini the line: ;extension=php_tidy.dll is missing. How can I add the module to my php install? Note I tried adding: extension=php_tidy.dll but with no luck. I checked the docs but all they say is: This extension is bundled with PHP...

Changing 'memory_limit', 'post_max_size', and 'upload_max_filesize' in .htaccess file

I know there are a lot of questions on here about this, but most of them seem to be from people who don't know that 'memory_limit', 'post_max_size', and 'upload_max_filesize' are PHP_INI_PERDIR (i.e. they can't be changed using ini_set()). I already learned that the hard way. However, everything indicates that I should be able to change...

OpenID log in is slow

I have implemented OpenID on my website, so that a user can successfully use the system to authenticate. However, it seems like the redirect from my site to the OpenID provider and the redirect from the provider back to my site takes a long time. I am using PHP and the CodeIgniter framework, with the provided library on their wiki. Wh...

Selecting large amount of rows from database table with MySQL

I have a table with attributes like this: likes(id, message, ip, time) id is the primary key and is auto-incrementing. Whet I want to do is select 30 rows from this table based on an id that I provide. I can build a random array of all IDs I want to grab from the table, now I just need to go about doing that. My usual SQL query would...

How can I change the default database used in Kohana 3?

I've set up a new database config in application/config/database.php called staff. I've then made a new base model, and added a protected $db variable and set it in the constructor to $this->db = Database::instance('staff'). When I try and replace Db::query(Database::SELECT, $query) with $this->db->query(Database::SELECT, $query), it f...

What is going on with my PHP class variable?

I made this stupidly simple PHP file containing <?php class stuff { private $var; } ?> and results in this error when run: Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in . . . on line 4 To make things even more confusing, it functions normally on a different domain...

Left Join duplicates

I have several tables I need to query in order to get all the rows for a certain user. The tables basically look like this contact ======= id_contact PK firstName lastName ... contact_phone =============== id_contact_phone, PK id_contact, FK id_phone_type, FK phone ... phone_type ============ id_phone_type PK phone_type .... And the...

Problem automating login through php + curl - quite possibly due to __VIEWSTATE

Hello, I am trying to automate the login process for the site: winpossible.com. The site is running on .NET and expects the VIEWSTATE variable to be appropriate set and that is what is most probably tripping up the login function? Any tips on what maybe going wrong? The code is attached. Thanks in advance. <?php $username=urlencode('<...

PHP abstract class vs interface (performance)

In PHP 5 and later what's faster - an interface or abstract class ? abstract class MyPluginModel { vs interface MyPluginModel { Any ideas how they compare in terms of memory and time performance? ...

Best way to create a "template interpreter" in PHP

Hi! I'm hosting a multi area solution written in PHP, and each customer has its own template in some HTML files. Now I want these users to be able to use some chunks of dynamic content, but they can't be able to use PHP. I thought something like: In the HTML file, if I put this: <ul>[menu-list]</ul> Will output something like: <ul>...

Edit file download info PHP/JS

Hey, I'm trying to change the name of a file being downloaded through my site off an external server. Currently whenever I modify the header information, it just takes a reallllllyyyyyy long time for the download to start, so is there any way to do it without changing the headers? Or if not any reason why it would be taking forever to l...

How to add a simple IF statement in this PHP file?

Question by a novice, here: I have a simple form returning a person's name, company, and address among other things. Right now, these are returned on separate lines. If there is no entry in the "company" field, there is a blank line in the email that is sent. I'd like to make an IF statement so that if there is no entry in the "compan...