php

Regex s modifier, not working?

Okay, I am a noob to regex, and I am using this site for my regex primer: Question: using the s modifier, the code below is suppose to echo 4 as it has found 4 newline characters. However, when I run this I get one(1), why? link text <?php /*** create a string with new line characters ***/ $string = 'sex'."\n".'at'."\n".'noon'...

PHP Soap is hell...

If I run this $HostTransactionInfo = new HostTransactionInfo(); // std Object $HostTransactionInfo->SecurenetID = $cc->merchant->data[$this->name]['secure_net_id']; $HostTransactionInfo->SecureKey = $cc->merchant->data[$this->name]['secure_key']; $HostTransactionInfo->Test = self::TEST; $securenet = new SoapClient(self::WSDL, array('f...

What is the best type to use for a column in MySQL containing the body of text output by a CMS?

I'm doing a quick and dirty CMS module for a site - just a jWYSIWYG editor. I've never really thought about the best type to use for the column that will contain the outputted XHTML from the editor. I have always used blob in the past, but am unsure why I picked that. Any recommendations? ...

How to get Dreamweaver to display php gettext text?

Is there an extension or setting that would allow Dreamweaver to actually display "Hello World" when I type <?php echo _("Hello World"); ?> ? Instead it just shows a "php" icon. I mean, I usually blend HTML and PHP together, for example: <strong>We found <?php echo $results;?> results!</strong> That way in Dreamweaver I can easily s...

better implementations of email activation links

i've been seeing a lot of activation links sent via email and I implemented one but just isn't satisfied with it (the long activation links from other sites kinda looks cool but I can't see the point of it being so long). Here's how my activation link looks like site/controller/method/4/MJKL the 3rd segment is the user id and the the 4...

How to conduct File path operation in PHP?

Something like: /directory/a/b - /directory/ = a/b Is it possible to do this easily? ...

Class methods and instance methods in codeigniter, how can I use them?

I am very new to codeigniter but understand OOP and MVC as I do a lot of Rails development. One thing I haven't figured out yet is how to write a class level method in codeigniter and access it in a controller. For example, I have <?php class User_model extends Model { function user_model() { parent::Model(); } ...

Adding items to a JSON encoded array

Hello I am using this solution found on stackoverflow to encode my MYSQL output to a JSON encoded array. $sth = mysql_query("SELECT ..."); $rows = array(); while($r = mysql_fetch_assoc($sth)) { $rows[] = $r; } print json_encode($rows); This works great and produces an output of [{"id":"81","title":"Something Here","start":...

GD PHP dynamic pie chart generation issue

I've created a dynamic pie chart with the GD extension using the image filled arc function. I pass to this script, via HTTP GET variables, up to 11 values. the first value, n, is the number of values that follow. n1,n2,n3, etc. are the data itself. These are integer precentages. The goal is to make a chart that will show the percent...

Weird utf8 conversion problem in php

So I'm working on a project that is taking data from a file, in the file some lines require utf8 symbols but are encoded oddly, they are \xC6 for example rather than being \Æ If I do as follows: $name = "\xC6ther"; $name = preg_replace('/x([a-fA-F0-9]{2})/', '&#$1;', $name); echo utf8_encode($name); It works fine. I get this: Æther ...

Should this function be instance level or class level? ...and how to make it work in codeigniter

In my codeigniter project I have <?php class User_model extends Model { function user_model() { parent::Model(); } // should we use instance method? function get_total_users_count(){ $results = $this->db->query("SELECT * FROM bhr_users GROUP BY userid"); if($results){ return $results->num_row...

php singleton per object with distinct identifier

This is something I was thinking about the other day. I want to have a singleton-like object. Instead of a single instance of a class, I want to have a single object with a matching variable. For instance. an existing employee object has a employee_id = 100 the getEmployee static method is called with employee_id = 100, i want to ret...

Regular Expression: Split English and Non-English words with Comma?

Is there any regular expression pattern to change this string This is a mix string of üößñ and English. üößñ üößñ are Unicode words. to this? This is a mix string of, üößñ, and English., üößñ üößñ, are Unicode words. Actually, I want to split English words and non-English words with comma. Thanks. ...

globals php help

I am trying to use a global in a file that is just used to post data to. The global is not being registered on that page. How can I get the globals accessible in that page. EDIT maybe I wasnt too clear so let me clear it up. I have these files index.php global $user; echo $user->uid; post.php global $user; echo $user->uid; now fr...

php data checking and clarification

if( isset( $_POST['aquafina'] ) && $_POST['aquafina'] != '' ) { $message .= "AquafinA: ".( $_POST['aquafina'] ). "\n"; } Noob, questions and clarifications: This means != (not equal to empty), right? And if( isset( $_POST['numSelections'] ) && $_POST['numSelections'] > 0 && $_POST['numSelections'] < 40 ) This means less tha...

PHP form question.

How do you capture submitted values from a form and displayed them back on the page in the form fields using PHP? I have already created the form which is as follows: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Order Form</title> <meta http-equiv="content-type" content="text/html;charset=UTF-...

CakePHP same 'view' for multiple functions

I have a Cakephp project the controller has several different methods. function Index() function IndexAuthor() And I want to use the same 'view' (or template, Index.ctp) for both of the methods of the control. ...

Styling rows in table that uses CSV data through PHP

Hi, I've been working on this simple code that puts a CSV file into a nice table. But because the data is imported, styling ODD rows is a pretty hard thing to do. All I need would be a method to address certain rows, so I can make a "zebra" like background, and put specific data in another text style. Does aynone have an idea? thanks ...

Query in code igniter keeps returning a "1"

I am a code igniter noob. I have a controller like the following: <?php class Welcome extends Controller { function Welcome() { parent::Controller(); $this->load->model('usermodel'); } function index() { $res = $this->db->get('users'); die( print_r($res) ); } } I have a table 'users' in m...

Is there a feature like this in PHP?

<namespace:BLOCKQUOTE id="" runat="server"> This is what I see in asp code,is there such a feature in PHP? ...