RE: Problem with MySQL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 20 March 2007 13:26, Németh Zoltán wrote:

> 2007. 03. 20, kedd keltezéssel 15.09-kor Pavel Kaznarskiy ezt írta:
> > Hello !
> > I have problem with access in mysql
> > 
> > it is my code:
> > <html>
> > <head><title>SQL Query Sender</title></head>
> > <body>
> > <?php
> > $host="";
> > $user="";
> > $password="";
> > /* Section that executes query */
> > if(@$_GET['form'] == "yes")
> 
> what do you want with that '@' here?
> that operator can be used to suppress error messages when calling
> functions but not when using a variable

What complete tosh!  @ is a unary operator, so can be applied to any expression.

Proof:

  <?php
    echo "no @ --", $HTTP_GET_VARS['bogus'], "<br />\n";
    echo "with @ --", @$HTTP_GET_VARS['bogus'], "<br />\n";
  ?>

Result:

  no @ --
  Warning: Undefined index: bogus in c:\www-lco\scripts_etc\lco\php\test.php on line 18

  with @ --


Also:

  <?php
    $a = 123;
    echo "no @ --", $a/0, "<br />\n";
    echo "with @ --", @($a/0), "<br />\n";
  ?>

Result:

  no @ --
  Warning: Division by zero in c:\www-lco\scripts_etc\lco\php\test.php on line 19

  with @ --


Not that I'm necessarily advocating this as a technique, but let's not spread disinformation!

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: m.ford@xxxxxxxxxxxxxx
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux