php

Retrieve ASP.Net's User.Identity.Name in PHP

hi, i am using form authentication for my website which is written in ASP.Net, but i have a PHP script that i need to run. Is it possible to get the value of User.Identity.Name in PHP ? thanks. ...

SQL database with Phorum

Hey SO, I was just exploring Phorum for my website. I already have a separate log in system associated with the main website, which I was hoping to be able to carry over to Phorum, so people don't have to sign up twice. I saw the way to hook in a SQL database through include/db/config.php, but there seems to be no good documentation...

Query works in phpMyAdmin but not through mysql_query

I'm stumped. Why would a query work in phpMyAdmin but not in a MAMP environment? I've echoed out the query, which returned 0 results in MAMP, copied it and pasted it into phpMyAdmin and the same query returns the expected result. select c.id from (select id, business_id from coup where match(name) against ('$search')...

Reqular Expression: Replace user defined Format with Number?

I want to replace a user define format like... ABC-####-09 to ABC-0023-09 How many leading zero should be decide over how many '#' sign in format, and the length of default value to replace (23 in this case). Is there any regular expression pattern to do this? Thanks... ...

Passing an array to mysql

I currently have an array of values (business_id's) lets say its Array ( [0] => 12 [1] => 14 [2] => 15 ) What is the best way to use each of these value to get the associated row information for each business_id from the database. Can it be one in one query is my question. Obviously, you could do $q = "select * from business where...

How to get the year number with PHP?

2009 this year, 2010 next year. ...

Inflector::humanize($key) converts Date of joining TO Date Of Joining

Hi, I have a Form and i am submitting them like using function submit($formid = null,$fillerid=null) { $this->data['Result']['form_id']=$formid; $this->data['Result']['submitter_id']=$fillerid; $this->data['Result']['submitter']=$this->Session->read('filler'); echo "submitter: ".$this->Session->read('filler'); ...

How to use MySQL functions when building a query with Zend/PDO

I'm using Zend Framework with the PDO MySQL adapter and I want to use a function in my insert statement. Basically, the SQL I want to generate is this: INSERT INTO `myTable` (`leftId`, `rightId`, `date`) VALUES ($left, $right, NOW()) This is the code in my Model: $data = array( "leftId" => $left, "rightId" => $right, "dat...

Printing to terminal while using output buffering in CLI PHP scipts

I'm using command line PHP to build some files offline. To capture the script output I use the standard ob_start stuff: ob_start(); // Echo lots of stuff $content = ob_get_contents(); // Now the $content can be written to a file However, I also want to print some messages to the terminal (for instance, warnings) while collecting the "...

Best way to send PHP script usage statistics to an external script

I'm writing an application in PHP which I plan to sell copies of. If you need to know, it's used to allow users to download files using expiring download links. I would like to know whenever one of my sold applications generates a download. What would be the best way to send a notice to my php application on my server, which simply tel...

loading google map in ajax div problems :-/ - jquery

Hey I got some problems loading google map into a jquery $.post... the output is correct in firebug.. but it wont show the map :-/ Any idea how to fix? $.post('/ajax/index.php', {action:somedata}, function(data){ $(div).slideDown(500,function(){ $(div).html(data); }); },'html'); and then I load the data via...

Best PHP Workflow

I'm wondering what the best way to work with PHP web pages in Eclipse. For instance, what I normally do is create a project with remote links to the files on the server. This way I can make changes->save them->and instantly see the effects in a browser. However, this method does not allow me to commit the remote files to SVN. I could ...

Fetch HTTP response header/redirect status with PHP

Hej there, I am currently working on a PHP-based Tool to monitor a rather large number of URLs and their redirect status. I have spent quite some time on finding the best way to fetch the content of the HTTP response headers to extract the current redirect code and location. This is how it's done at the moment: $resource = fopen( $url,...

Showing generated PDF problem.

I have a problem with showing generated PDF. The pdf is saved in dataBase. I'm continuing work of a guy that started work that way, so I need to work that way. There's no problem with saving the file on computer,it's working fine, but I need to show it in new window when it's read from dataBase... And sorry about my English. :) ...

Import emails ID from Gmail, Yahoo, Hotmail, etc. for "Tell a Friend" like feature in PHP

In a project I have to implement a way by which a user can import all contact information from the following: Gmail Yahoo Mail Hotmail Tweeter Rediff Mail Sify Mail Are there any freeware scripts in PHP for this? Are there any servers that may be providing such services? ...

How to fix XML bug like this.

Hello everybody, I have XML file like this : <?xml version="1.0" encoding="ISO-8859-1"?> <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note> And i code in my php page: <? php $xmlDoc = new DOMDocument(); $xmlDoc->load("note.xml"); $x = $xmlDoc->documentElement; foreac...

PHP: What's the mathematically efficient way to find a 'subgrid' of a larger grid?

Hi, i'm trying to find an efficient way to find a subportion of a large grid. Currently I'm looping through rows to define a FROM-TO selection of ids in that row, but this doesn't feel right... Let's say I have a grid of 200x200 fields (x between 1 and 200, y between 1 and 200). Every field also has it's unique ID, starting at X1,Y1 (f...

Dreamweaver code view highlighting

I'm getting rather sick of Dreamweaver. It decides some PHP is invalid and then picks a random colour to display the code in, instead of the normal syntax highlighting. I've Googled the problem of course, but can't find a way of turning this behaviour off. The particular thing it's doing at the minute is this: Invalid markup Marked in...

how to convert a mysql table to text file in php ?

What is the php script for converting a mysql table to text file? I have converted it to CSV format which opens up as a excel file. I also want the table data in a text file. How do I do it? For converting it to csv format, I used the header data as: $filename = "export_".date("Y-m-d_H-i",time()); header("Content-type: application/vnd...

Shopping cart and stock management

I am currently building an ecommerce site with PHP/MySQL. Recently, I have been working on the Shopping Cart integration. The client wanted to ensure that stock was available to potential buyers, so I created a stock management system. The shopping cart works as follows: Client adds a quantity of an item to his cart. Item quantity ...