top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

how to stop to create the same name of database in mysql using php

+8 votes
351 views

If i want to create another MySQL database using PHP, then how can i create it with a different Name ?

posted Feb 6, 2014 by Hiteshwar Thakur

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+3 votes

" Execute SHOW DATABASES using php and get the db name list and write your business code validating the name from the list "

answer Feb 6, 2014 by Bhani Bhosle
+2 votes

SHOW DATABASES LIKE "db_name_you_are_going_to_create"; execute the query and check the row count.

answer Feb 6, 2014 by Sneha Randhawa
Similar Questions
0 votes

I have a client where their next auto-increment number just jumped from 2300 to ********** for reasons not understood. They want it set back.

Options such as dropping the primary key and rebuilding the index is NOT possible -- this is a relational table thing. So, is there a way (programmatically) to set the next number in an auto-increment?

Something like:

alter table abc auto_increment = 2301;

Any ideas of why this happened?

...