php

UTF-8 character encoding battles json_encode()

Quest I am looking to fetch rows that have accented characters. The encoding for the column (NAME) is latin1_swedish_ci. The Code The following query returns Abord â Plouffe using phpMyAdmin: SELECT C.NAME FROM CITY C WHERE C.REGION_ID=10 AND C.NAME_LOWERCASE LIKE '%abor%' ORDER BY C.NAME LIMIT 30 The following displays expected va...

How to scaffold table with tree behaviorin Cake?

Is it possible to scaffold a table in CakePHP 1.3 that has the awesome tree behavior? It seems not to be supported out of the box, I'm looking for a very simple CRUD admin interface. ...

Drupal and Back-End Complexity

Currently I am working on a school website, and we are still in the decision-making process of choosing a framework (we know that we're not using Joomla! or hand-coding). Drupal came up as a viable choice, and currently, that is my best bet for the site. However, I have an issue with CMS's in general. I would like to develop a quite comp...

curl post picture multipart/form-data, php cURL need help!

I'm trying to upload a picture to a specific website using php cURL but I don't really understand what parameters do I need to send because the data looks a bit weird . Here is what i got with the http analyzer Type : multipart/form-data; boundary=---------------------------182983931283 -----------------------------182983931283 Conten...

user generated / user specific functions

I'm looking for the most elegant and secure method to do the following. I have a calendar, and groups of users. Users can add events to specific days on the calendar, and specify how long each event lasts for. I've had a few requests from users to add the ability for them to define that events of a specific length include a break, of...

include files in a method?

i want to have a class that includes all files for me. eg. Loader::loadZend // loads all zend libraries Loader::loadSymfony // loads all symfony components if i include a file in a method, does this become globally available? it seems that it doesnt work. maybe i have done something wrong, or is there a workaround for this? thanks...

What does >> mean in PHP?

echo 50 >> 4; Output: 3 Does anyone know why it outputs 3? ...

mysql : possible to put IF statment in LEFT JOIN ?

Ok so i want to get an artists info from the db, but i want to know if they have any forthcoming events. To do this i need to traverse 2 tables, where events_artists is a 2 col link table... (this doesnt work but is what id like to do) SELECT art.*, events.event_id FROM art LEFT JOIN events_artists ON art.art_id = events_artists.art_i...

SQL returns non-array value in PHP

$request = 'SELECT * FROM flight WHERE Id = \''.$_SESSION['LFLightRadio'].'\''; $data = mysql_fetch_array(mysql_query($request, $SQL)); echo '<table class="table">'; foreach($data as $key => $value) { echo '<th class="head" align="center" height="19">'.$key.'</th>'; } echo '<tr>'; foreach($data as $key...

MOD_REWRITE HELP!

I want to use mode rewrite to display the following: mydomain.com/Florida/Tampa/ instead of mydomain.com/place.php?state=Florida&city=Tampa I've akready done this: (since I think it might make a difference!) mydomain.com/[name].html instead of mydomain.com/profile?user=[name] Here is the code! Options +FollowSymLinks Options +Indexe...

PHP and C# communication on IIS7 (to generate dynamic PDF)

Background: I couldn't find any decent free HTML to PDF conversion utilities in C#. There are 100s of them for PHP with extensive documentation, support, and CSS support. So I am using html2ps and html2pdf (php). I have PHP 5.2 installed on IIS7 and its working beautifully to create PDFs. I have the following in getPDF.aspx <!-- Outp...

Is it bad to throw exceptions to return server errors, eg. 404 Page Not Found?

I am working on a PHP framework and am currently designing error handling. Based on what I have read on SO, I should only use exceptions for, well, exceptional situations. Therefore throwing an exception when an incorrect password is entered is wrong. Should I avoid using exceptions when I want to return a server error code to the user ...

PHP syntax question: global $argv, $argc;

So I have a PHPUnit test, and found this code within a function. global $argv, $argc; echo $argc; print_r($argv); I understand what these variables represent (arguments passed from the command line), but I've never seen this syntax before:global $argv, $argc; What specifically is going on here? ...

help using google charts to overlay multiple graphs

Im having a little bit of difficulty trying to figure out the best way to accomplish this. I have 3 sets of data. Each set of data consists of 30 numbers. These numbers have nothing to do with each other, and may be way out of scope of one another. Here is an example set: Set 1: 15,15,15,16,17,21,26,35,43 Set 2: 4,12,40,109,120,179,20...

MYSQL multiple insert in codeigniter

Hi everyone, I know about the possibility of making a multiple insert in mySQL by doing something like this: foreach ($array as $manuf) { $sql[] = '("'.mysql_real_escape_string($manuf['name']).'", "'.$manuf['lang'].'", "'.$mId.'")'; } $this->db->query('INSERT INTO manufacturers (name, lang ,mid) VALUES ' . impl...

PHP - Check that value doesn't appear twice in array

Hi, I have a array inside my PHP app that looks like this: Array ( [0] => Array ( [name] => Name1 [language] => 1 ) [1] => Array ( [name] => Name2 [language] => 1 ) ) How can I check that "language" with value 1 doesnt appear twice, as effective...

CKEditor controls show in IE8 and FireFox but not in Safari or Opera

I have a PHP developer working on a site for me, using CKEditor 3.2, and the editing controls appear perfectly for him in IE8 (Windows) and for me in Firefox 3.5 (Mac). But my other browsers on Mac (Opera 10 and Safari 4) show no editing controls but only the word "FALSE" centered above the text area. The textarea contains the "raw HTML...

PHP curl post to login to wordpress

I followed http://stackoverflow.com/questions/724107 to login to wordpress, using php_curl, and it works fine as far I use WAMP, (apache/php). But when it comes to IIS on the dedicated server, it returns nothing. I have wrote the following function which is working fine on my local wamp, but when deployed to client's dedicated windows ...

How to exit after "MySQL server has gone away" error?

I have a cron job that runs every minute. Every once in a while the cron fails with the error: MySQL server has gone away The problem is that all the query below this error are executed and may sometimes give undesirable result. So how do I detect that the error has occurred and exit execution of rest of the code? Or any hint on...

PHP: How to check if a string starts with a specified string?

I'm trying to check if a string starts with http. How can I do this check? $string1 = 'google.com'; $string2 = 'http://www.google.com'; ...