php

how to decode unicode characters in php

Hi, I am trying to pull data from another site and i am getting unicode characters in my result like this Amazon RDS – The Beginner’s Guide how can i decode it in php? Can someone help? Thanks in advance ...

Zend Framework - multiplate navigation blocks

Hi I want to use the navigation helper to build my navigation menus using Acl. The Acl part I have working fine. I now want to be able to display a few different types of navigation. E.g. admin-nav, side-nav, new-nav, etc. I cannot find anything about this in the docs. Only how to set the navigation and then use that one navigation obj...

count new lines in textarea to resize container in PHP?

I have a textarea submitted to a php file. Im using this to make it look exactly as the user entered the text: $ad_text=nl2br(wordwrap($_POST['annonsera_text'], 47, "\n", true)); If I want to resize a container I must be able to read how many lines are in the variable '$ad_text'. Is there a way to do this... I am still learning so...

Obtain SSL information in PHP running as CGI

On many servers, PHP runs as CGI. This is an essential part of using suexec to run the scripts for each site as the user associated with the site. So giving up CGI is not appealing. But as I understand it the various values such as $_SERVER['SSL_CLIENT_S_DN_CN'] are not set when PHP runs as CGI. This is a pity, as it would be good to...

Codeigniter Pagination over array instead of Database resultset

I have looked into trying to use the pagination class within codigniter but for my problem I need to paginate over an array of data and not a database table. In my code I create a custom array and then pass that array to the view using the standard $this->load->vars($myarray); $this->load->view('myview', $myarray); Everything works f...

ICS replace events

We have developed a calendar for our extranet. Each week we update it with next week's courses schedule for all teachers and students of the school. This also triggers the sending per email of ICS files to those users who chose that option. Now, it almost always happens that there are last minute changes, so a need to do a new schedule ...

Remove all sub arrays for multidimensional array in PHP.

What is a simple mode, in PHP, to remove all the sub arrays of a multidimensional array? What I want is to remove all the sub arrays but the top one... Thanks, titel ...

foreach loops & stdclass objects

I've seen similar questions on here but I can't seem to apply the solutions to my problem. I have a variable called $results which I got from an API. I'll change the proper nouns so as to protect my work's customers: stdClass Object ( [out] => stdClass Object ( [count] => 2 [transactions] => stdClas...

PHP - Get a single result using mysqli

I have descided to change from mysql to mysqli part way through a project - and run into this hicup. What is the best way to achieve this: //check if username is taken $result = mysql_result(mysql_query("SELECT COUNT(*) FROM user WHERE username='".$username."'")); I can not find an exact version of mysql_result I have tried this: $re...

How to write a good PHP database insert using an associative array

In PHP, I want to insert into a database using data contained in a associative array of field/value pairs. Example: $_fields = array('field1'=>'value1','field2'=>'value2','field3'=>'value3'); The resulting SQL insert should look as follows: INSERT INTO table (field1,field2,field3) VALUES ('value1','value2','value3'); I have come u...

Handling foreign key exceptions in PHP

What is the best way in PHP to handle foreign key exceptions on a mysql database? Is there a mysql class that can be used to simplify any code? Ideally, what I want to do, as an example, is to try to delete a record where it is the foreign key parent to any number of child tables. The foreign key throws the exception, so then I would li...

PHP / Doctrine ORM multiple 'one-to-one' relations to the same class

Just working on a project where I have a class called 'Product' and a class called 'Image'. Each product has two types of images, one 'front' image and one 'back' image, so I defined two fields, one called image_front_id and one called image_back_id. In the method BaseProduct::setUp(), I defined the relation for the front images as foll...

Limit JS and PHP abilities inside an IFRAME

We have a business partner that is IFRAMEing some data to one of our web pages. I would like to limit his JS abilities to interact only inside of the IFRAME as well as his PHP abilities. Is this something that is setup automatically or do I have to make sure that these capabilities are assigned somewhere. Thanks for the help. ...

Multiple conditionals within sql query

I want to pull out the records that have a date that is LIKE today's date. I have this query $query = "select * from calendar_items WHERE expiredate LIKE '$todays_date %' or upcoming_event_featured_date like '$todays_date %' ORDER BY expiredate ASC"; Now I have 3 more upcoming_event_featured_date's: upcoming_event_featured...

Architecture: using different classes on development / production

Hello, I'm interested about using 2 different classes in 2 different environment. Both classes should share the same structure (methods), but the one used in production would be "light", with less verifications or less funtionnality or different actions. Example: a SQL query class which doesn't check the type/existence of fields. Other...

Using UTF-8 charset with PHP - are mb functions required?

These past few days I've been working toward converting my PHP code base from latin1 to UTF-8. I've read the two main solutions are to either replace the single byte functions with the built in multibyte functions, or set the mbstring.func_overload value in the php.ini file. But then I came across this thread on stack overflow, where th...

PHP - List of Excel files to download from Intranet Site?

I have a intranet site running PHP 5 that needs to list a folder containing only Excel files. Ideally the user needs to be able to input some search criteria (ie date) and the files would be filtered into a list of hyperlinks. These hyperlinks could then be selected to download the excel file. What I have so far is: //get search para...

what approach/module in joomla should I use?

Hi, Here's my need. I'm building a site that let users add product to a list (something like a wishlist without a cart). Now my question is, Is there an existing extension in Joomla (1.5) that do similar thing? Another Is calculating the total cost of the product and calculating other factors, like discounts, freight, weight etc. I am...

Achievements / Badges system

I have been browsing this site for the answer but I'm still a little unsure how to plan a similar system in its datbase structure and implementation. In PHP and MySQL it would be clear that some achievements are earned immediatley (when a specialzed action is taken, in SO case: Filled out all profile fields), although I know SO updates ...

php transfer variable to other page

Hi All: PHP : I am trying to upload a file using php,and i need to pass a value like id or some thing with the from the upload form page to the file that have php code plz look at this code: <form name = "file" enctype="multipart/form-data" action="uploadpp.php" method="POST"> Please choose a file: <input name="uploaded" type="file" />...