Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Determine table existence
- SELECT * FROM table WHERE FALSE;
- SELECT * FROM table WHERE 0;
- SELECT * FROM table WHERE column = false;
- if there's table `table`
- return 0 rows (minimal database overhead) and valid resource
- else
- return false
- SELECT count(*)
- FROM information_schema.tables
- WHERE table_schema = <schema-or-db-name>
- AND table_name = <table-or-view-name>
- $sql="SELECT * FROM $table";
- $result=mysql_query($sql);
- if (!$result)
- {
- // table does not exist
- }
- $sql="SELECT * FROM $table where user_id = 1";
Advertisement
Add Comment
Please, Sign In to add comment