/    Sign up×
Community /Pin to ProfileBookmark

Basic mysql questions

Hey all,

Hope you don’t mind me asking here. I’ve been working in PHP for about a year and a half now and have finally decided that I’m at the end of my development possibilities without the use of a true db. With that in mind, I’ve just recently started playing around with mysql. However, I had two main questions that I have been able to find concrete answers for as of yet in my reading.

First, databases. At work, I develop large and small programs. They are all used daily but some may only have 6 or 7 fields, and don’t coincide with any other programs that I make, they’re standalone for all intents and purposes. If I wanted to change something like this over to mysql instead of using text files as it does now, should I create a new database just for it or should I create one larger database and have the smaller programs feed off of different tables in it?

Second is administration. I’ve started out creating dbs, tables and columns through a console window, but I would assume there is a much friendlier way, especially considering the character limitations per line. I had installed apache, mysql and php as a firepages bundle. Should I use the existing phpmyadmin that’s included or should I use something else that is otherwise preferred?

Thanks for your help

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@solomonApr 01.2005 — This is only my opinion and I'm sure there's right and wrong ways of doing it but...

I use a database per site. Each database might have 20 tables in or it might just have 2! This way I just connect to the database in question and not have to worry about whether I'm working with the right table for this particular site etc. (the one time I have mixed and matched tables within a database I inadvertantly deleted months worth of very handy banner click-thru stats). It also helps me keep everything well organised. I'm sure, however, if you are working with truly [I]vast[/I] amounts of infomation then you need to consider out-and-out efficiency and speed (someone else can answer that one ? )

When it comes to adminning, I don't really have any experience with anything but phpmyadmin but I can happily sing it's praises. The purists out there will probably wag a finger at me for saying that but when there's a tool so powerful, why waste it? It also helps you correct your syntax when you're learning how to build complex queries (i.e. you perform an automated query and it shows you the syntax of the query you've just performed - very handy!)
Copy linkTweet thisAlerts:
@ShrineDesignsApr 01.2005 — if you are limited on how many databases you can have by your host, you can use one database and use a "prefix" (ex. myapp_table) for the table names so you can determine which table is for what

i use phpMyAdmin, it works pretty good, but i also do most of my SQL by hand, through php scripts
Copy linkTweet thisAlerts:
@solomonApr 01.2005 — ...but i also do most of my SQL by hand, through php scripts[/QUOTE]
absolutely... you need to know how to write the queries by hand if you want to make your scripts perform them dynamically... I just remember when I was learning and figuring out when to use single quotes and when not to (etc) I would just emulate the query straight in phpmyadmin and [I]presto[/I] it would show me an example query that I could copy and adapt to make dynamic.
×

Success!

Help @ephmynus spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...