php

how to change the way of GET variables work in php

I dont like something like this: example.com/?id=2222. How to change it into example.com/2222? ...

Compatibility with IIS and Apache -- PHP, Python, etc?

I'm currently planning out a web app that I want to host for people and allow them to host themselves on either Linux/Apache of IIS6 or IIS7 (for the benefits of bandwidth, directory services [login, etc.]). I see that PHP is supported on both platforms. I've heard people serving Django and Python in IIS using PyISAPIe. I'm not sure ab...

Turning HTML character entities to 'regular' letters... why is it only partially working?

I'm using all of the below to take a field called 'code' from my database, get rid of all the HTML entities, and print it 'as usual' to the site: <?php $code = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $code); $code = preg_replace('~&#([0-9]+);~e', 'chr("\\1")', $code); $code = html_entity_decode($code); ?> H...

mysql php query HAVING clause

Hi! Im trying to get this query to work but i get this error: Unknown column 'zips.city' in 'having clause' `$query = "SELECT zips.* FROM zips HAVING zips.city LIKE '%$city%' AND zips.stateabbr LIKE '%$state%' LIMIT 1"; $result = mysql_query($query) or die (mysql_error());` my zips table has a...

Rotate Text with Javascript

Can anyone suggest a way of rotating text by any angle without using something like Flash or Silverlight. I'd like to use a slanted image with the text following the same angle. ...

Running a query with PHP/MySQL then reordering the results by another column.

This SQL query gives me the results I want; however, I want the results ordered by a different column: SELECT * FROM post INNER JOIN account ON post.account_id = account.account_id WHERE post_id > neww ORDER BY post_date ASC LIMIT 10; I can not simply change 'ORDER BY post_date ASC' to 'ORDER BY post_id DESC', while that will...

Optimizations to reduce website loading time

What are some important optimizations that can be made to a website to reduce the loading time? ...

MySQL problem reconnecting (mysqld.exe) keeps giving error...

Need some guidance figuring out what went wrong. I've been using mysql, phpmyadmin for just under a year on my home computer while I develop a webapp. 3 days ago I updated my windows vista with all the "wonderful" microsoft updates, security patches, etc...and now it's broke. I tried uninstalling all the upgrades, but there are 4 of th...

file upload limited at 1MB?

i can't understand why my server isn't accepting files larger than 1MB. i am using cpanel and my host has told me that i can't edit my php.ini file directly. below is my upload code: <?php if (array_key_exists('uploadfile',$_POST)) { $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['...

Deleting large chunks of PHP effectively

I've just inherited a project, and been told that an entire folder, "includes/" needs to be removed due to licensing issues -- We don't have the right to redistribute the files in that folder, so we need to cut our dependencies on them, and fix whatever breaks. I've been told "Less than 5% of the lines in that folder are ever even called...

How do I move an array element with a known key to the end of an array in PHP?

Having a brain freeze over a fairly trivial problem. If I start with an array like this: $my_array = array( 'monkey' => array(...), 'giraffe' => array(...), 'lion' => array(...) ); ...and new elements might get added with different keys but always an array value. Now I can be s...

Remote debugging won't stop at breakpoints

I'm having a problem with xdebug not stopping at breakpoints when using remote debugging (everything is fine when running scripts via the command line). It will break at the first line of the program, then exit, not catching any breakpoints. It used to work fine, until I switched over to using MacPorts for Apache and PHP. I've tried re-...

PHP Speed Vs Other Languages

I have heard a lot that PHP is slow compared other languages. Is the speed difference noticeable enough that I should switch to another language? And if so what other language would you recommend? Or what would be some good optimizations that could speed up the PHP? ...

Can't get the right characters to display from the database.

Hello, I'm re-designing a Web site and I have a problem with the existing data base: The database collate is set to utf8_unicode_ci and in the table row I'm calling the collate seems to be set to latin1_swedish_ci the characters store in it are Japanese (but even in phpmyadmin) you see other characters (I guess because of the latin1_swed...

Need help converting a script from PDO to Mysql

Im trying to convert this script, in my Zend program. http://github.com/jackmoore/colorrating/raw/master/rating/rating.php <?php class rating{ public $average = 0; public $votes; public $status; public $table; private $path; function __construct($table){ try{ $pathinfo = pathinfo(__FILE__); $this->path = realpath($pathi...

Need help with regex to remove square brackets and anything between

How can I remove text from between square brackets and the brackets themselves? For example, I need hello [quote="im sneaky"] world to become hello world Here's what I'm trying to use, but it's not doing the trick preg_replace("/[\[(.)\]]/", '', $str); I just end up with hello quote="im sneaky" world Thanks ...

read only property for checkbox

Is there a read only property for a checkbox? Because I can still tick on the checkbox even if I have this code, is the read only property only for text box? What's the code if you want the check box to be read-only? <td><input name="stats1" type="checkbox" id="SSS" readonly="readonly" value="<?php echo $row["STAT"]; ?>" <?php echo $row...

PHP is changing the value of my variable because i bind it as a mysqli paramter?

im tracking down a weird bug where a variable i have is being changed at some point, and this is where I found the problem: echo "2. page is $page<br>"; $h = $page; //Ok everything is done. Now need to update the view counter $query = "UPDATE pages SET views=views+1 WHERE id=? LIMIT 1"; if($stmt = $db -> prepare($query)) { $stmt -> ...

Jobs site search engine doubt - Sphinx is the solution??

Hi... im developing a web app to manager jobs, curriculum and etc... For example in my case: I have a CV table which contain some information about... and same fields in my table, is a reference to others tables like (Kind of company, kind of job looking for, education, languages the guy knows... a ordinary cv model) My doubt is ... th...

read php output into a js string?

Basically, I have an html page and I want to create a separate javascript file that reads all of the markup between the tags into a javascript string. Is there a way to do that? EDIT Okay, so, to elaborate a little more... In my tpl.php file, I basically have these lines js snippet: <script type="text/javascript" src="/js/jquer...