php

calling c from php

I was wondering if there was a way to call existing C code from php? ...

After form validation, how do you redirect to a new url w/ PHP

I'm very new to back-end web work and I'm trying to create a form for my theatre wherein someone can submit a space inquiry form. I have the form made, it works, but what I want it to do is after they hit 'submit' and the form is validated and emailed to us, they'll be redirected to a "thank you" page. I've tried using the behaviors in...

php/derby "hello world"?

What's the code syntax, and what all do I need to install and configure, for invoking a Derby Stored Procedure (which is really Java code) from a PHP Script? ...

newbie: php how to read in file names in order of filename

I want to "include" the last 2 files in my php file based on their names. So the names are: 01-blahbla.php 02-sdfsdff.php 03-aaaaaaa.php 04-bbbbbbb.php 05-wwwwwwi.php and I only want to include 05 and 04 since their name starts with the biggest number. How do I go on about doing this? ...

How do I get a column type "date" inserted into FULLTEXT in a mysql table?

I am making a control panel for administrators on my site that is a search function. When you enter a name it pulls the users first name,last name, email and password. When I tried to insert Birthday into the FULLTEXT to include it in the search, it is not on the drop down. I think because its type is 'date'. Is there a way around that? ...

Add 1 Page to each PDF in folder

I have a folder with 100s of PDF versions of PPT presentations. I also have a one page PDF file that I want to add to the beginning of each PDF file. Is there a way I can do this with PHP? Could I maybe use the Zend Framework? ...

How to merge two csv files in php ?

I have two csv file. First File has date offerid clicks orders Second File has date offerid shown How can I merge this two csv file programmatically in php ? ...

regex for PHP preg_replace_callback

Regular expressions is just not my thing. :( I have a string that may contain multiple sub strings such as: [var1="111" var2="222" var3="222" var4="444"] I basically need to replace each occurrence with the the results of a function that gets each variable. $string = '[var1="111" var2="222" var3="333" var4="444"]'; $regex = 'var...

How to avoid this PDO exception: Cannot execute queries while other unbuffered queries are active

Hi, I'd like to print a simple table in my page with 3 columns, building name, tags and architecture style. If I try to retrieve the list of building names and arch. styles there is no problem: SELECT buildings.name, arch_styles.style_name FROM buildings INNER JOIN buildings_arch_styles ON buildings.id = buildings_arch_styles.building_i...

Combine two arrays on a key

I have two arrays: $course = Array ( [6] => 24 [0] => 20 [1] => 14 ) // etc With the key being the link to the next array: Array ( [0] => Array ( [course_id] => 1 [course_name] => Appetizer ) [1] => Array ( [course_id] => 2 [course_name] => Breakfast ) ) //etc I basically want to add the course_name to the first array ...

restful way for deleting a bunch of items

In wiki article for REST it is indicated that if you use http://example.com/resources DELETE, that means you are deleting the entire collection. If you use http://example.com/resources/7HOU57Y DELETE, that means you are deleting that element. I am doing a WEBSITE, note NOT WEB SERVICE. I have a list that has 1 checkbox for each item ...

Would you consider this a proper test case?

I would like to get some feedback on what is one of my first PHPUnit test cases. The subject of the tests is a simple configuration class in a PHP app. It is used to create, store and retrieve configuration settings. The settings are stored in an array within the class. Each setting has the following properties: key (for example fro...

PHP E-commerce Tutorials

I am very, very new to PHP and MySQL and would prefer not to get involved with a framework just yet, but I have begun creating a really basic e-commerce site. I found a great site for creating my shopping cart http://v3.thewatchmakerproject.com/journal/276/building-a-simple-php-shopping-cart however after I implemented this with my pr...

Why is PHPUnit ignoring assertions when expecting an exception?

I have a simple unit test case (extensive question here) on a configuration class that by design triggers PHP errors on type mismatches and undefined configuration settings. In addition to the error, the method is exited returning false. In my test case, I want to have a number of tests that fail. Trouble is, I can't do a simple 'assert...

how to loop a loop in php?

is there a way to loop a loop in php? if i got a function for example, could i loop this function endless times? in php6 there is goto. but how could u do this in php5? function getLinks($link) { // step 1: if $link got links, add them in a array // step 2: iterate array of links // step 3: save current link // step 4:...

PHP include file problem

Hi there again. I have a problem with including files on remote server (but on my local Windows PHP+Apache configuration it works fine...). Problem occurs when I try to include file from included file like this: Contents of index.php: <?php include("Dir1/File1.php"); ?> Contents of Dir1/File1.php: <?php include("File2.php"); inc...

PHP-based LaTeX parser -- where to begin?

The project: I want to build a LaTeX-to-MathML translator in PHP. Why? Because I'm a mathematician, and I want to publish math on my Drupal site. It doesn't have to translate all of LaTeX, since the basic document-level stuff is ably handled by the CMS and wouldn't be written in LaTeX to begin with; it just has to translate math writt...

PHP not displaying errors

I have a small script which im using to test PHP mail(), as below: <?php error_reporting(E_ALL); ini_set("display_errors",1); mail('[email protected]','test','test') or die('could not send') ; echo "Mail Sent"; ?> When I run this script I get no output at all. I don't get an error, I dont get anything echoed, I view the source, nothing. Ive...

having trouble validating email addresses in php

I can't figure out where I'm going wrong here. Trying to validate an email address: if (!preg_match("/^( [a-zA-Z0-9] )+( [a-zA-Z0-9\._-] )*@( [a-zA-Z0-9_-] )+( [a-zA-Z0-9\._-] +)+$/" , $emailREG)) { ...

Write to javascript array within php loop

I have a php loop that is echoing out geolocation values. How can I get it to write those values to a javascript array, so I can then use them to plot points on an HTML5 canvas? The php loop is as follows <ul id = "geo-list"> <?php foreach($data as $phrase) { ?> <li><?php if ($phrase->geo != false) { ...