php

How can I redirect a 404 Error in a custom 404 page using Codeigniter?

Kind sirs, I'm using Codeigniter to build a blog. I might need a way to redirect a 404 error into a custom 404 page. Just like what Abduzeedo.com's 404 page. Is it possible to control this by using routes? Or should i use controllers to direct it to another view? Thanks very much! ...

Zend Framework HTTP router

I have a site with some static pages that lie in à folder called ../application/default/views/scripts/statiskt/student/(index.html) (seen from the webroot). I can access these "static" pages via mydomain.se/statiskt/student/(index.html). The problem is that i want to be able to access them via mydomain.se/student/(index.html). I am us...

How to read XML string with PHP

Eg: $xmlstr ='<Address><to>Sriniva</to><from>Chennai</from><country>India</county></Address>'; ReadXml($xmlstr) Output -> Address to: Srinivas from: Chennai country : India ...

Return an array from mysqli stmt query

Hi there i'm trying to convert a site to use prepared mysql statements, however i'm having some trouble replacing my use of fetch_array(). The comments on php.net offer a solution which I would have thought should work but for some reason i'm getting strange undefined constant errors when calling a function via call_user_func_array() ca...

What encryption algorithm would be best for data transfer between Python and Php?

Hi all, I am writing a client / server based program, Server side is with Php and Client is with Python, and I need to make sure the transfer data is safe both way. So, My question is What encryption algorithm would be best for data transfer between Python and Php? I couldn't use Https Need to decrypt/encrypt with key on both Pytho...

How can I randomize an entire string of 62 characters?

I have 62 base64 characters that I want to randomize. How can I do this using PHP? The string would be all letters, upper and lower case as well as numbers from 0-9. The thing that is most important to me is that the entire string be evaluated before a return value is given. In other words, if I request a string of 8 characters in lengt...

Using LGPL for a PHP application

I have a PHP application which I have developed and released under the LGPL, currently on the bottom of the web pages it has a copyright line. Is this allowed or can I only put the copyright line in the source file. Another part to this question is under LGPL is the user allowed to remove the Copyright line from the web pages, as long a...

How do I convert a mySQL DATETIME type to a string for use in Javascript?

I want to display a DATETIME I get from a mySQL database as a String in Javascript. I'm using PHP to put the DATETIME into a variable: $mydatetime. It displays fine on the PHP page, but not in my javascript function. <?php echo $mydatetime --> 2010-04-19 13:00:00 echo "<script language=javascript>myfunction($mydatetime);...

Problem with Mysqli SELECT statement not returning anything

I'm sure this will somebody no time at all. I know that MySqli works on this server as i have tried inserts and they work fine. I also know that the information I'm trying to obtain is in the database and i can connect to the database without any problems. But I can't for the life of me figure out why this isn't working. I've tried b...

How to Reformate phone number with PHP5

funtion declared as function ReformatePhoneNumber($number), whose argument will contain string data representing some phone number data(entered by the user). A valid phone number may consist of between 7 and 12 digits (0,9). Assume that in between some adjacent digits there may optionally appear either a single space. or a single hypen(-...

Caching the results of a "next" / "previous element" query

I am looking for the best way to retrieve the next and previous records of a record without running a full query. I have a fully implemented solution in place, and would like to know whether there are any better approaches to do this out there. Let's say we are building a web site for a fictitious greengrocer. In addition to his HTML p...

how to format mysql results to json php

hello mysql table ID >> Name >> Salary $row_set << database table information. my problem is when i use json_encode($row_set); the output will be something like this: [{"0":"1","ID":"1","1":"x","Name":"x","2":"12345","Salary":"12345"}] i want the results to be something like this [{"ID":"1","Name":"x","Salary":"12345"}] ho...

Reading a CSV with file_get_contents in PHP

I am reading a 'kind' of csv file and exploding it and storing it in array. The file I am reading has this structure Id,Log,Res,File mydb('Test1','log1','Pass','lo1.txt'). mydb('Test2','log2','Pass','lo2.txt'). mydb('Test3','log3','Pass','lo3.txt'). Now what I am trying to do is : reading the last record in my database, get the Name...

how to delete all cookies of my website in php

hey guys im wondering if i can delete all my website's cookies when user click on logout because i used this as function to delete cookie but its not functioning properly setcookie("user",false); is there a way to delete one domain's cookies in php ?! ...

PHP / AJAX toolkit to make a "live graph" (eg for tracing stock prices)

hi there! how do i (after getting the right stock prices from a source) show it on a "live graph". i'm looking for a php/ajax toolkit that allows me to create that graph live? is that the right thing to use or a flash based solution is better? are there 3rdparty sites that offer to create live graphs given input data? ...

Zend command line tool action error

I just managed to create a project using Zend_Tool, but I am stuck on "second step" - enabling layout. zf enable layout leads to: An Error Has Occurred Action 'enable' is not a valid action. This is my folder structure: |--library | |--Zend //framework classes in this folder | |--bin //command line tool f...

drupal: add search field to an article

hi, how can I add the search field (searching for all content and tags in my webiste) to my article ? I've already installed and activated the module, but I would like to add it to a single article instead of a block of my website thanks ...

Trick Question; Showing 'nr of results' of MySql search

I have a classifieds website, and users can search ads. The results are displayed in three tabs on top of the page. These three are "All", "Private", and "Company". Each tab has a nr attached to it, which represents the nr of ads found in that tab. So for example: All Private Company 5 3 2 All is just ...

Simple query throwing an SQL syntax error

I've got a simple SQL query that keeps throwing an SQL syntax error. It looks like this: $sql = "SELECT COUNT(*) AS TOTAL FROM PRODUCT WHERE ID_PRODUCT = ".$id; $result = mysql_query($sql) or die(mysql_error()); Which throws : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version...

JQGrid and Microsoft SQL Server

Hello all, I am trying to get this awesome JQuery plugin working with SQL Server. I have setup PDO as I use it elsewhere (with MS Access) - I think I have it setup with sql server (2008) now. Here is how I connect: define('DB_DSN',"odbc:Driver={SQL Server};Server=MyInstance;Database=table1;"); define('DB_USER', ''); define('DB_PASSWOR...