1

I came across a weird error in PHP:

mysql()

I tried with three different setups, and each time declaring a function with this name and any or no arguments generates an error:

Fatal error: Cannot redeclare mysql()

Yet, I cannot find a function with such name in the function index, if it really existed I guess it would have been here. I tried searching the web but the ambiguity of my search queries makes any info on this difficult to find.

Usefullness of having a function called simply mysql() aside, what is this function and why is it not documented?


Possibilities I ruled out:

  • That it could be a class constructor (there is no such class)
  • That the name of the module is the cause of conflict (doesn't work with other modules, like mssql)
Dreen
  • 6,128
  • 10
  • 44
  • 67
  • What version of PHP are you using? In my simple test with PHP 5.2.x (I know it's old) I could define a mysql function perfectly fine. – temporalslide Oct 16 '12 at 22:31
  • Tested on 5.2 on a hosted server and a uni server, plus whatever version a friend of mine had on his WAMP setup (assuming latest stable). All produce the same error. – Dreen Oct 16 '12 at 22:36
  • Yeah, ignore my comment. Turns out what I tested it on doesn't have mysql installed, so no mysql something would be defined. – temporalslide Oct 16 '12 at 22:37

1 Answers1

3

just a non documented reserved word http://php.net/manual/en/reserved.keywords.php

checking the source code, i've seen that function is empty

  • I'm accepting your answer because its somewhat correct and made me look into the source code; turns out `mysql()` is an alias to `mysql_db_query()` which in itself is deprecated (http://php.net/manual/en/function.mysql-db-query.php). – Dreen Oct 16 '12 at 22:54