tinfanide Posted November 6, 2011 Share Posted November 6, 2011 <?php$database = "test";$connect = mysql_connect("localhost","assessment","hsilgne");if(is_resource($database)){mysql_query("CREATE DATABASE ".$database,$connect) or die(mysql_error());}mysql_select_db($database,$connect);$sqlTable = "CREATE TABLE scoresTable (id int NOT NULL AUTO_INCREMENT,PRIMARY KEY(id),name varchar(15),score int NOT NULL)";mysql_query($sqlTable,$connect);mysql_query("INSERT INTO scoresTable (name, score) VALUES ('Tin','100') ");mysql_close($connect);?> I've searched online for this and some answers are like usingOBJECT_ID() But it seems not working or I don't know the exact syntax.Could anyone point me to the right direction? If object_id('tbl_name') is not null<command> ORif exists (select * from sysobjects where id = object_id('tbl_name') and sysstat & 0xf = 4)<command> Link to comment Share on other sites More sharing options...
justsomeguy Posted November 7, 2011 Share Posted November 7, 2011 http://www.google.com/search?client=opera&rls=en&q=mysql+check+if+table+exists&sourceid=opera&ie=utf-8&oe=utf-8&channel=suggest Link to comment Share on other sites More sharing options...
tinfanide Posted November 8, 2011 Author Share Posted November 8, 2011 Yes, after some search, I've found the solution. Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.