0

All of my mysqli functions are not accepting empty parameters. When I do so I get the following error (example):

Warning: mysqli_close() expects exactly 1 parameter, 0 given...

When I use mysql_close() I still get the same error. I have read the php documentation for mysql_close() and it says that if no link identifier is given mysql_close() will close the last opened mysql connection but it is not doing so.

How will I make them accept empty parameters?

ymn
  • 2,175
  • 2
  • 21
  • 39

1 Answers1

2

They were optional in mysql ext, but in mysqli functions link identifier is obligatory.
There is no way to make them accept empty parameters (and no use too).
You have to establish a connection first and then pass it to the every mysqli function.
Sometimes you will need to use global operator to make connection variable available in other scopes.

Your Common Sense
  • 156,878
  • 40
  • 214
  • 345