Joined: 20 Jun 2009
Posts: 344
Location: Portland Oregon
Posted: 09/06/09 18:00
Awesome, thanks. One more question, Like the Table Definitions, would the sample data need to be placed on its own line? Or is that just for the dbVerifyTable Function?
Joined: 20 Jun 2009
Posts: 344
Location: Portland Oregon
Posted: 09/10/09 21:11
When dbVerifyTable returns true, does that mean that the table already exists or that it was just created? If I want to populate a table with some sample data, and did it the way mentioned above, wouldn't the sample data be INSERTed to the table, each time the Integrity Check is ran?
Would it be best to do it the following way(Provided that dbVerifyTable returned true if created?
Joined: 09 Jul 2003
Posts: 37583
Location: Seattle, WA
Posted: 09/11/09 13:27
dbVerifyTable() returns true when it successfully validates the table - it does not check in any way for actual data in the table. So what you need to do is:
Code
$req = "SELECT * from your_table LIMIT 1";
$_rt = dbQuery($req,'SINGLE');
if (!isset($_rt) || !is_array($_rt)) {
.. table has no data .. do your insert ..
}
Joined: 20 Jun 2009
Posts: 344
Location: Portland Oregon
Posted: 09/11/09 16:12
Thats how I ended up writing it. Just figured if I was able to get a result, on creation, I could save a call to the database. Not that the Query is very time intensive. Thanks again.