Search found 38 matches

by MathewByrne
Thu Sep 28, 2006 2:38 am
Forum: PHP - Code
Topic: PHP Shell Script Question
Replies: 1
Views: 724

PHP Shell Script Question

Is there a simple way of determining if a person is running PHP from a CLI interpreter or viewing a php file through a browser?
by MathewByrne
Mon Mar 06, 2006 8:14 am
Forum: PHP - Code
Topic: PHP shell scripting problem
Replies: 5
Views: 1181

Ah well, I'll make do with a buch of alias ___='cd ...___' for now :(
by MathewByrne
Mon Mar 06, 2006 7:26 am
Forum: PHP - Code
Topic: PHP shell scripting problem
Replies: 5
Views: 1181

Yeah I noticed calling getcwd(); had changed. Hmm... might have to actually write a shell script for once... Anyone have a better solution?
by MathewByrne
Mon Mar 06, 2006 7:09 am
Forum: PHP - Code
Topic: PHP shell scripting problem
Replies: 5
Views: 1181

PHP shell scripting problem

I'm trying to implement a quick php shell script which will take me to a specified directory. This doesn't work however:

Code: Select all

...
exec("cd " . $path);
...
In fact nothing happens inside bash. Is this a limitation of scripting in PHP?
by MathewByrne
Thu Jan 19, 2006 11:07 pm
Forum: Databases
Topic: Common Query performance
Replies: 5
Views: 1831

Thanks for the info, would you mind posting a quick benchmark test that I can use to compare the two methods? afaik there isn't any way to get the query time from the last my_sql query but I could be wrong.
by MathewByrne
Thu Jan 19, 2006 10:49 pm
Forum: Databases
Topic: Common Query performance
Replies: 5
Views: 1831

Common Query performance

The site I'm currently working on has an SQL query that will get run on almost every page request, along with any other queries that need to be run for that particular page. Because the results of this query will only change roughly once every two weeks, I decided to store the data in a php file whi...
by MathewByrne
Thu Jan 19, 2006 10:05 pm
Forum: General Discussion
Topic: PHP Writer
Replies: 14
Views: 2710

I'm just going to say this one general comment for the benefit of someone who sounds new to code editing. Find an editor that is simple and that you can get comfortable using. You don't usually need all the extra features that some of the freeware apps give you. Try to stick to the following list of...
by MathewByrne
Thu Oct 13, 2005 9:35 pm
Forum: PHP - Code
Topic: Getting string from image
Replies: 6
Views: 1279

Yeah not what I'm really looking for, file_get_contents takes a file and converts to a string, I already opened the file into an image resource and resized it.

I know I could save it to a temp file but I'd prefer a direct method if one exists.
by MathewByrne
Thu Oct 13, 2005 9:26 pm
Forum: PHP - Code
Topic: Getting string from image
Replies: 6
Views: 1279

Getting string from image

Hi,

Been trying to find a way of inserting an uploaded image into a database. The image is resized before being put into the sql database.

What I need is some way to convert the image to a string (bascially the reverse of imagecreatefromstring()). Any ideas?
by MathewByrne
Thu Oct 13, 2005 6:10 am
Forum: Graphics
Topic: Dynamic Image Resizing from database
Replies: 1
Views: 4884

Dynamic Image Resizing from database

Hi,

I'm trying to find a simple way of resizing an image taken from a database on the fly. My problem is not so much resizing the image but more how to get the data from the database into a form which I cen then resize it. Any ideas?
by MathewByrne
Wed Jul 13, 2005 12:03 am
Forum: PHP - Code
Topic: Checking a date is in the future
Replies: 2
Views: 1005

Thanks, done the trick nicely
by MathewByrne
Tue Jul 12, 2005 11:36 pm
Forum: PHP - Code
Topic: Checking a date is in the future
Replies: 2
Views: 1005

Checking a date is in the future

I have 3 text boxes, day, month and year so I end up with somthing like /** * Day = 1-31 * Month = 1-12 * Year = 2005-whenever */ $day = $_POST["day"]; $month = $_POST["month"]; $year = $_POST["year"]; I want to check that the date is not only valid (via checkdate()) bu...
by MathewByrne
Sun Jul 03, 2005 10:57 pm
Forum: Regex
Topic: Quick Regex problem
Replies: 1
Views: 4436

Quick Regex problem

Hi just needed a Regex expression for a comma seperated list of postcodes (Australian so 4 digits).

The following are valid:

Code: Select all

3554, 2000, 5098
3100
5444,8875,1233
The following are invalid:

Code: Select all

3554, 2000,

5444,50000
Thanks ahead.
by MathewByrne
Tue Jun 28, 2005 10:39 pm
Forum: PHP - Code
Topic: foreach by reference
Replies: 5
Views: 1161

Hmmm, I was hoping there would be something like this that I could do:

Code: Select all

foreach(&$objects as $item)
{
   $item->setValue($value);
}
by MathewByrne
Tue Jun 28, 2005 9:09 pm
Forum: PHP - Code
Topic: foreach by reference
Replies: 5
Views: 1161

foreach by reference

Hi, Just a quick PHP 4 question. I've tried the following which doesn't work (assume $objects is an array of some generic object): foreach($objects as $item) { $item->setValue($value); } This doesn't actually change the values in $objects at all because they're passed by value rather than by referen...