简体   繁体   中英

PHP static function does not die

class mySql {
 static function query($q){
  return mysql_query($q)or die(mysql_error());
 }
}

class MySql

echo mySql::query('SELECT * FROM unknown_table');

it must die and display the mysql error but its not.

do static functions really go that way?

Works for me .

(basically for the die() to work, the mysql_query() needs to return falsy - putting false there lets me test your short circuit evaluation ).

Show me your code relevant to your problem, please.

Does it work with a valid query?

guess im just stupid

my load_class() function does not load the class properly i forgot to configure my Configuration file and set the base uri to the current folder lol maybe i should delete this one. oh stupidity /facepalm

替代文字

sorry for bothering everyone xD

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM