php

Loading large mysql output into a variable to write to file

This is the code i have to write my file <? $date = date(F jS, Y g:i:s a); $filename = "$date.csv"; $fh = fopen($filename, 'w') or die("can't open file"); $data = ""; fwrite($fh, $data); fclose($fh); ?> The data that i need to write, consists of the output from a mysql query, shown here echo "<tr>"; echo "<td valign='top'>" . nl2br...

How do I connect to the Campaign Monitor API?

Hi, I have somewhat of a knowledge of the PHP coding language and I would like to connect the Campaign Monitor API(Link) with my website, so that when the user enters something into the form on my site it will add it to the database on the Campaign Monitor servers. I found the PHP code example zip file, but it contains like 30 files, an...

PHP "Warning: usort() [function.usort]: Invalid comparison function" on sorting

i have following data as an associative array array 'abc' => array 'label' => string 'abc' (length=3) 'weight' => float 3 'wsx' => array 'label' => string 'wsx' (length=3) 'weight' => float 1 'qay' => array 'label' => string 'qay' (length=3) 'weight' => float 1 'http://test.com'...

How to get serverside information into javascript?

Hi, I don't know how to ask this question that's why I'm going to simulate what I need, some developers make what I need by rendering javascript with php. A simple sample file would look like: my_javascript_file.php <?php include "my_class.php"; ?> $(document).ready(function(){ $.ajax({ url: "<?php $my_obj->post_url(); ?>...

I can't remember what was the function that does this...

I remember there was a function in PHP where you can choose how many bits each character of a string represents (I dont remember if it was for converting string or for generating them). For example if you chose 4 bits per caracter then the output string would be formed by hexadecimal characters only (0-9 A-F). If you chose 5 bits per car...

Sum the total value of a particular field in a mysql table using php and pulling the whole row in array form

Well the title sucks. But here is what I am trying to do. I have a foreach loop that is already pulling all the rows from a mysql db table using a db object style query in a function. That function is grabbing all fields and setting it up in an array ex foreach ($blahs as $blah => $blah_data) That now allows me to populate the page w...

Unpack large files with gzip in PHP

I'm using a simple unzip function (as seen below) for my files so I don't have to unzip files manually before they are processed further. function uncompress($srcName, $dstName) { $string = implode("", gzfile($srcName)); $fp = fopen($dstName, "w"); fwrite($fp, $string, strlen($string)); fclose($fp); } The problem is th...

XSL Template Node Navigation

Thank you one and all. I have an PHP MVC framework that uses XSLT for the templates. I have registered some php functions with the template to allow the use of modules in the template. This allows us to call modules at need be instead of running all the modules first regardless if you need them all. The problem is the fact some (most, ...

what is the best method to translate strings to mysql dates?

What is the best way in php to take the following string mm[some char]dd[some char]yyyy and translate it to yyyymmdd? I will probably want in the future, according to local do the same with dd[some char]mm[some char]yyyy. If there is a way that already uses the Zend Framework API, the better ...

Array property in Phing

I have a phing build file that checks the permission of certain files using the <touch> task. <target description="list of files to check permission" name="files-to-test"> <property name="filesToCheck" value=""/> <php expression="file_get_contents('filesToCheck.txt')" returnProperty="filesToCheck"/> <foreach list="${file...

php for creating library sort titles

I use the following in mysql to get titles in libray sort, e.g. The Godfather is sorted as Godfather. SELECT apnumber, aptitle, IF( aptitle LIKE 'The %', SUBSTRING( aptitle, 5 ) , IF( aptitle LIKE 'A %', SUBSTRING( aptitle, 3 ) , IF( aptitle LIKE 'An %', SUBSTRING( aptitle, 4 ) , aptitle ) ) ) AS sorttitle etc... What's the most effici...

How do I get previous and next rows even though some rows have been deleted?

Hello all, I have the following PHP functions that determine the next and previous rows in a database. However, there are lots of occasions when rows can be deleted and therefore my functions will not work as all they do is decrement the auto_increment field. For example, current row 5. My function gives: 4 (previous) and 6 (next). Wha...

How do I remove a specific row result obtained through mysql_query?

I have a mysql_query result that I am looping through multiple times in different parts of code, each time using a mysql_data_seek( $result, 0 ) to reset to the beginning of the result. I am using mysql_fetch_array on those results, and would like to remove a few specific rows from the $result. Basically the equivalent to unset( $resul...

Help with making WordPress post to IP.Board 3.0

Hey, I need help making WordPress post to IP.Board 3 after its done publishing and such. I inserted the following code before return $post_ID; into wp-includes/post.php. <?php /** * Library to facilitate posting to the IP.Board 3 forums * * @author bfarber * @version 1 * @since 3rd April, 20...

Saving dynamic content from web page?

Is it possible to save dynamic text from a website and dump it into a file on my server? The specific case that I'm interested in is saving the song title from this page http://www.z1035.com/player.php and saving all the song titles in a file on my server. Is this possible? What methods could I use to do this? ...

Open Source ChangeLog Options?

Are there any open source ChangeLog options? We would like to keep an in-house changelog so we can keep track of changes we do. Preferably, I'm looking for something PHP and MySQL as backend. Any suggestions? Thanks, Andrew ...

Decode complex JSON in Python

Hey, I have a JSON object created in PHP, that JSON object contains another escaped JSON string in one of it's cells: php > $insidejson = array('foo' => 'bar','foo1' => 'bar1'); php > $arr = array('a' => array('a1'=>json_encode($insidejson))); php > echo json_encode($arr); {"a":{"a1":"{\"foo\":\"bar\",\"foo1\":\"bar1\"}"}} Then, wit...

jquery+php send values

hi , i have forms createds that require a value , as this this forms edits different users. so how would i send that value from jquery? i know how to do it with combobox , but i want to do it from links : like - name [details] when someone clicks on details the forms will pop up, so i wana mimic index.php?id=2 but with jquery, anyideas?...

Printing out 25 most recently added tables

Hello, In the code below, I allow users to add tables to a MySQL database. Is there a way to print out the most recent 25 tables added? Thanks in advance, John $table = mysql_real_escape_string($_POST['name']); $query = "CREATE TABLE `$table` (id INT(11) NOT NULL auto_increment, site VARCHAR(350) NOT NULL, cat1 BIGINT(9) NOT NULL, ...

Where can I find a PHP function and syntax cheat sheet?

Where can I find a one-page (any size) cheat sheet of PHP functions, syntax, and block constructs? ...