Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Thursday, March 28, 2024
About Us
Magazine
Open Source
CVS
Services
Index  »  Projects  »  phpMyEdit  »  Forum  »  Create table if Not exists?

phpMyEdit General     Create table if Not exists?
Post new topic   Reply to topic    
 
markeh     Joined: 16 Mar 2012   Posts: 2  
Post Posted: 2012-03-16 03:03
Back to top  Reply with quote     

Hi,

This may be a completely stupid question, but is there an easy way to create a table if not exists before phpmyedit is called. So that if I want to use the phpmyedit files with a different database, the tables will be created for me.

I was thinking of something like this below, to test if a table is there and create it if necessary then put everything else in a function phpmyeditStart();

$dbName = 'NAME_OF_DATABASE';

$sql ='SHOW TABLES WHERE Tables_in_' . dbName . ' = \'' . $tableName . '\'';
$rs = mysql_query($sql);

if(!mysql_fetch_array($rs))
create table...
phpmyeditStart();
else
phpmyeditStart();

Any advice would be great.

 
markeh     Joined: 16 Mar 2012   Posts: 2  
Post Posted: 2012-03-16 04:24
Back to top  Reply with quote     

Just tried the above and it works alright, I don't see any problems doing it that way. I'm just wondering if anyone else does.

It probably seems a little pointless but it's for a university thing so I can work on it at home and uni without having to recreate all the tables manually.

 
doug     Joined: 10 Feb 2003   Posts: 1013   Location: Denver, Colorado (USA)
Post Posted: 2012-03-16 18:18
Back to top  Reply with quote     

if installed in both locations, phpMyAdmin's Export and Import functions may offer less risk, while affording the opportunity to save exports using dated file names, such that if something unexpected happens and data is compromised or a table crashes then you have multiple backups to choose from.

If a table crashes and cannot be repaired and there are no backups then you have a real problem. Tables do crash from time to time, due to power outages and all sorts of unexpected events. On 100 websites that I work on, about 2-3 tables crash each year. I have a cron job running on each site which backs up all the tables each night, saving exports for 1 week before deleting them, and emailing an export to a Gmail account each week. Better safe than sorry.

 
mickel123     Joined: 23 Feb 2015   Posts: 1  
Post Posted: 2015-02-23 07:03
Back to top  Reply with quote     

I want to use the phpmyedit files with a different database, http://www.braindumps.com/training/a-plus-certification-online.htm
the tables will be created for me.

 
AidanJoyce     Joined: 08 Aug 2020   Posts: 3  
Post Posted: 2020-08-13 12:15
Back to top  Reply with quote     

I propose you, individuals, to stay away from the arms and steroids also. They must utilize rush my essay service to manage the task. Incidentally, they give moment results yet, later on, they cause the destructive impacts in our bodies prompting cause malignant growth.

 
ledam40306     Joined: 12 Aug 2020   Posts: 896  
Post Posted: 2020-09-03 13:24
Back to top  Reply with quote     

Impressive web site, Distinguished feedback that I can tackle. I am moving forward and may apply to my current job as a pet sitter, which is very enjoyable, but I need to additional expand. Regards https://royalcbd.com/ohio/

 
ledam40306     Joined: 12 Aug 2020   Posts: 896  
Post Posted: 2020-09-08 13:32
Back to top  Reply with quote     

Sewer, sink, drain, tank, toilet, leak hunting, water jetting, septic tank cleaning, Fair Price 20% cheaper than the unblocking market average We serve all of Greater São Paulo, Litoral and Interior Access Now. desentupimento em geral

 
Post new topic   Reply to topic    

Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top · Feedback form · Application form
Report bug on PLATON.SK website · Terms of use · Privacy policy