Skip to main content
July 19, 2007
Question

upgraded to php 5 and mysql 5

  • July 19, 2007
  • 2 replies
  • 381 views
Hi just wanting the expert knowlege of others before I re-do anything from my scripts using php4 and mysql 4 now that I have php5 and mysql 5.
Question: I have been starting my error checking like this, is it still compatable for my upgrade
$MM_flag="MM_insert";
if (isset($_POST[$MM_flag])) {

Question: I check for empty fields but I see in tutorials a lot of != or >0
this is what I have been using:
$idu = trim($_POST['idu']);
if (empty($idu)) {
$error['idu'] = 'Select Industry';
}
Should it be e.g.
$idu = trim($_POST['idu']);
if ($idu) < 0 {
$errors[] = 'Select Industry';

I have seen a lot of array() used as well.
Is this the future?

Thanks........
This topic has been closed for replies.

2 replies

Inspiring
July 19, 2007
.oO(jjjhbj111)

> Question: I check for empty fields but I see in tutorials a lot of != or >0
> this is what I have been using:
> $idu = trim($_POST['idu']);
> if (empty($idu)) {
> $error['idu'] = 'Select Industry';
> }

It always depends on what you want to check for and what the tested
value is supposed to be. empty() covers a lot of different things, but
you could also perform more specific tests. There's no general solution.

> Should it be e.g.
> $idu = trim($_POST['idu']);
> if ($idu) < 0 {
> $errors[] = 'Select Industry';

This is a different thing! Your first example checks for emptyness, this
one for a numeric value lower than zero ...

> Looks simiar to me but I have seen a lot of array() used as well.

... and array() is used for something completely different ...

> Is this the future?

It's not about the future, but some very basics!

Micha
Inspiring
July 19, 2007
jjjhbj111 wrote:
> Question: I have been starting my error checking like this, is it still
> compatable for my upgrade
> $MM_flag="MM_insert";
> if (isset($_POST[$MM_flag])) {

Yes.

> Should it be e.g.
> $idu = trim($_POST['idu']);
> if ($idu) < 0 {
> $errors[] = 'Select Industry';

No. The format you're already using is correct.

> Is this the future?

Unless you are using object-oriented code, the differences between PHP 5
and PHP 4 are virtually zero. Well-written PHP 4 code will usually run
without problem on PHP 5. All Dreamweaver generated code since
Dreamweaver MX 2004 is fully compatible with PHP 5.

Code created in Dreamweaver MX (DW 6 and 6.0.1) is not fully compatible.

--
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/