PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
See what it returns and that will give you a better idea of what's going wrong.
For starters unless you have $table defined somewhere above the code you pasted in, it's going to fail there since $table would not otherwise contain anything.
But mostly, find out what error is being generated and go from there. Post back the results if you can't get it figured out.