• Home
  • Amoeba
  • ASK
  • Community
  • Source Codes
  • Contact Us
Blue Orange Green Pink Purple

Archive for the ‘PHP/MySQL’ Category

You can use the search form below to go through the content and find a specific post or page:

Jul 07

PHP – Search in an Array for Values Matching a Pattern – Regex, Wildcard

I have an array with many values and I need to do a search to find all the values that match a pattern. We have functions like in_array & array_search in PHP, but these functions basically try to match the exact needle value in the array. I need to use my Regular Expression Pattern and [...]

Read More 0 Comments   |   Posted in PHP/MySQL, Programming Techniques, Regular Expression   |   Posted by Aneeska
Jul 01

PHP – How to Get Browser Properties and Capabilities – get_browser()

In this tutorial, learn about the get_browser() PHP function and its configuration. We’ll learn how to use Gary Keith’s browser information database (browscap.ini) with the PHP browscap directive.

I wanted one of my web applications to have a different appearance on mobile phones and devices. I didn’t really want to set up an entirely different domain or use a sub domain particularly for mobile devices (like http://mobile.facebook.com). Instead I want to tackle the device inside my application logic so that all users access the same URL.

Read More 1 Comment   |   Posted in Enterprise Web, PHP/MySQL, Programming Techniques   |   Posted by Aneeska
Jun 25

CakePHP – Search for records between two dates inclusively

Often we search for records in a database table for fetching records that were created or modified on a particular date or between two dates. We match against a date field and add multiple conditions to find records with a date field value ranging between two dates.
It would look something like this:
Select * from tables [...]

Read More 0 Comments   |   Posted in CakePHP, PHP/MySQL, Programming Techniques   |   Posted by Aneeska
Jun 02

Swap Values Without Temp or A Third Variable in PHP

When we need to swap the values of two variables, we use a third variable temporarily to hold the data between swapping.  Something like this:

<?php
$tmp = $a;
$a = $b;
$b = $tmp;
?>

Here is another way without using a temp or a third variable.

<?php
list($b, $a) = array($a, $b);
?>

And if you want to make it a function:

<?php
function swapValues(&$a, [...]

Read More 0 Comments   |   Posted in PHP/MySQL, Programming Techniques   |   Posted by Aneeska
Jun 02

CakePHP – Auth Login Redirect Problem with Plugins

The Auth Component in CakePHP redirects the user to the log-in page when a user tries to access any protected pages in the application. The default log-in page is set by defining the loginAction variable in the beforeFilter function in your UsersController or AppController.
But if you have used plug-ins in your application, and if a [...]

Read More 3 Comments   |   Posted in CakePHP, PHP/MySQL, Programming Techniques   |   Posted by Aneeska
Jun 01

Convert PHP array to Javascript array

A very basic tutorial. For the beginners who want to pass array values from PHP to Javascript for them to be accessible in the client side JS as an array. It’s really easy to pass PHP array to Javascript.
The below code passes a string array in PHP to Javascript.

<?php
$arr = array("a","b","c");
?>
<script>
var jsArray = ["<?php echo [...]

Read More 3 Comments   |   Posted in Javascript & Libraries, PHP/MySQL   |   Posted by Aneeska
May 30

CakePHP – Accessing a model in AppController or in any Controllers

Sometimes, or very rarely we might need to access a model in AppController (Application Controller). This could be for fetching values from a table and make it available for all the controllers in the application (AppController is inherited by all the other controllers). Also, often we need to access models that are not associated with [...]

Read More 0 Comments   |   Posted in CakePHP, PHP/MySQL   |   Posted by Aneeska
May 13

Joining multiple tables in CakePHP using bindModel method

One of the most powerful features of CakePHP is the ability to link relational mapping provided by the model. In CakePHP, the links between models are handled through associations. The associations are defined in the models as hasOne, hasMany, belongsTo etc. It is possible to define deep relationships involving many tables and retrieve data. But CakePHP doesn’t always form a single query to associate many tables and retrieve records. Often it joins a couple of tables first and look in the other tables matching the IDs of the first query result. So a multiple join association is achieved through more than one queries. This method often troubles you when you want to do a search in fields across multiple tables.

Read More 0 Comments   |   Posted in CakePHP, PHP/MySQL   |   Posted by Aneeska
May 10

Convert under_scored strings to CamelCased without RegEx in PHP

Developers normally use functions that use Regular Expression to convert under_scored strings in to CamelCased strings. Usage of Regular Expression is quite heavy. We can use a simple yet powerful method to convert these strings to CamelCase without using RegEx in PHP.

Read More 2 Comments   |   Posted in PHP/MySQL, Programming Techniques   |   Posted by Aneeska
Apr 22

Enhance your Website Performance – Best Practices

Do you think your website is sluggish? Does it take a lot of time to download on to a user computer? Here are some techniques to make your site load faster on user computers and enhance it’s performance. These are some of the best practices followed in the Web industry. Implementing these practices has proved that your site will become 20-30% faster. This tutorial is for advanced users and I haven’t explained it in detail.

Read More 1 Comment   |   Posted in CSS & XHTML, Enterprise Web, Javascript & Libraries, PHP/MySQL, Programming Techniques   |   Posted by Aneeska
Older Posts »
  • Search a Topic


  • Got a Question?
      ASK and get a Solution! ASK
  • Categories
    • CakePHP
    • Computers
    • CSS & XHTML
    • Enterprise Web
    • Flash & Action Script
    • Flex
    • Javascript & Libraries
    • Perl Programming
    • PHP/MySQL
    • Programming Techniques
    • Regular Expression
    • Social Media
  • Recent Visitors
  • Recent Articles
    • How to Protect your SWF (AS2 or AS3). Prevent SWF Decompile using SWF Protector
    • PHP – Search in an Array for Values Matching a Pattern – Regex, Wildcard
    • PHP – How to Get Browser Properties and Capabilities – get_browser()
    • CakePHP – Search for records between two dates inclusively
    • Notebook/Laptop hangs frequently/random (on Low Battery when AC power is connected)
    • Swap Values Without Temp or A Third Variable in PHP
    • CakePHP – Auth Login Redirect Problem with Plugins
    • Convert PHP array to Javascript array
    • CakePHP – Accessing a model in AppController or in any Controllers
    • Save Images from Flash – Actionscript 3, Filereference.save, JPGEncoder
  • Archives
    • September 2010
    • July 2010
    • June 2010
    • May 2010
    • April 2010
    • March 2010
    • February 2010
    • January 2010
    • December 2009
  • Tags
      vertically center horizontally align dead center div amoeba ask credit card workbench decryption solutions kiosk questions horizontal center align vertical center align css trick solution css encryption as2 flash regex as3 Regular Expression action script mysql array CakePHP php

  • Donate

      If you find this site helpful, please donate to Amoeba Solution Kiosk. We will be using the money received for conducting technology awareness camps and seminars for school and college students in rural areas of Kerala, India.

  • Links
    • Amoeba Solutions
    • Blog Catalog
  • Home
  • Amoeba
  • ASK
  • Community
  • Source Codes
  • Contact Us

© Copyright Amoeba Solution Kiosk. All rights reserved.
An Amoeba Concept!

Back to Top