[prog] php & mysql

Dan Richter daniel.richter at wimba.com
Fri Feb 27 13:01:40 EST 2004


> it seems that @can not be used for error checking ( if that's 
> what it was intended for)
> and even with commenting that out, I still receiving an error of parsing 
> error on line 14.

The "@" operator is used to suppress runtime error messages (because 
runtime errors, such as machines being down, cannot always be avoided). 
It doesn't suppress syntax/parsing errors (because those errors are 
always wrong, and so should be corrected).

The following example of "@" comes from the open-source online forum 
system miniBB:
    @mysql_connect($DBhost, $DBusr, $DBpwd) or die
           ('<b>Database/configuration error.</b>');

Without the "@", a failed mysql_connect would display an error message. 
The "@" causes the error message to be suppressed. Instead, 
mysql_connect returns false and the "or die" part comes in, allowing the 
programmer to substitute a more meaningful error message.

Your PHP code looks correct to me, except for this one line:

 > $grid[ $i ][ $day ][ $room ] ] = $res_array[ 'title' ] .
 >        "<br>" . $res_array[ 'l_name' ];

Notice the extra closing bracket: [ $room ] ]

Could that be your parsing error?

Hope this helps.   :-)

-- 
  This may sound a little foreign to all you folks coming from a
  non-Unix background, but PHP doesn't cost anything. You can use it
  for commercial and/or non-commercial use all you want. You can give
  it to your friends, print it out and hang it on your wall or eat it
  for lunch. Welcome to the world of Open Source software! Smile, be
  happy, the world is good.
      - Quoted from http://www.php.net



More information about the Programming mailing list