Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

upgraded to php 5 and mysql 5

Guest
Jul 19, 2007 Jul 19, 2007

Copy link to clipboard

Copied

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........
TOPICS
Server side applications

Views

360
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 19, 2007 Jul 19, 2007

Copy link to clipboard

Copied

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/

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 19, 2007 Jul 19, 2007

Copy link to clipboard

Copied

LATEST
.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

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines