Search found 19 matches

by alex-weej
Mon May 15, 2006 2:49 pm
Forum: PHP - Code
Topic: fopen
Replies: 4
Views: 309

Code: Select all

<?php

$file = file('yourfile');

// Echo out line 519
echo $file[519];

?>
by alex-weej
Mon May 15, 2006 2:47 pm
Forum: PHP - Code
Topic: SELECT FROM WHERE Clause
Replies: 12
Views: 631

Ian, please include the check for "courseowner IS NOT NULL" because NULL is not the same as ''. If you have an actual NULL value in your database it won't match ''.
by alex-weej
Mon May 15, 2006 2:46 pm
Forum: PHP - Code
Topic: SELECT FROM WHERE Clause
Replies: 12
Views: 631

He phrased it "where courseowner is not null or empty"

Boolean logic converts that to "where courseowner is not null and courseowner is not empty".
by alex-weej
Mon May 15, 2006 2:42 pm
Forum: PHP - Code
Topic: SELECT FROM WHERE Clause
Replies: 12
Views: 631

No
by alex-weej
Mon May 15, 2006 2:41 pm
Forum: PHP - Code
Topic: SELECT FROM WHERE Clause
Replies: 12
Views: 631

Code: Select all

WHERE courseowner IS NOT NULL
AND courseowner != ''
"IS NOT NULL" is what you need.
by alex-weej
Mon May 15, 2006 2:36 pm
Forum: PHP - Code
Topic: SELECT FROM WHERE Clause
Replies: 12
Views: 631

Which DBMS? MySQL? Postgres?
by alex-weej
Mon May 15, 2006 2:35 pm
Forum: PHP - Code
Topic: Basename returning filename x 100
Replies: 5
Views: 779

Assuming you realise that $term is a regular expression, I don't see anything wrong with that.

Do a var_dump($files); after the glob() and show the first ten lines of output, please!
by alex-weej
Mon May 15, 2006 2:29 pm
Forum: PHP - Code
Topic: Mail() to smtp
Replies: 3
Views: 263

by alex-weej
Mon May 15, 2006 2:28 pm
Forum: PHP - Code
Topic: Preventing multiple inserts
Replies: 10
Views: 715

header('Location: http://www.yoursite.com/some-new-page', true, 303); You can send a HTTP 303 code ("See Other") to the client with the above function. A "See Other" causes the browser to redirect to another page with a GET request. If you forget the 303, it's possible that the ...
by alex-weej
Mon May 15, 2006 2:24 pm
Forum: PHP - Code
Topic: How to echo php code
Replies: 8
Views: 630

While I can't figure out what you're trying to do, and whatever you're doing I am fairly certain you're trying to do it the Wrong Way™, the function you need to look at is

Code: Select all

eval();
.
by alex-weej
Mon May 15, 2006 2:21 pm
Forum: PHP - Code
Topic: Quirky PHP question (variables in MYSQL statements)
Replies: 7
Views: 718

In the second case, the single quotes (') become part of the SQL. So in the first you are doing:

Code: Select all

book_id = 9
and in the second you are doing:

Code: Select all

book_id = '9'
Try a simple

Code: Select all

echo $sql
when you are wondering why your SQL is being strange.
by alex-weej
Mon May 15, 2006 2:19 pm
Forum: PHP - Code
Topic: editing a XML file
Replies: 9
Views: 449

Many ways to do it, I'd suggest using the DOM as a storage structure and manipulating arrays of objects instead. Assuming PHP 5, 4 won't be much different. <?php class Item { public $category; public $serial; public function __construct($category, $serial) { $this->category = $category; $this->seria...
by alex-weej
Mon May 15, 2006 2:01 pm
Forum: PHP - Code
Topic: How to echo php code
Replies: 8
Views: 630

Code: Select all

echo some_expression;
by alex-weej
Sun May 14, 2006 1:06 pm
Forum: PHP - Code
Topic: editing a XML file
Replies: 9
Views: 449

It's OK, learn something new every day. :)
by alex-weej
Sun May 14, 2006 12:29 pm
Forum: PHP - Code
Topic: Code to get field value from DB not working
Replies: 4
Views: 461

In that case, I suggest you do the INSERT/UPDATE check not when the user logs in, but rather just before you go to set the record's value.