View Full Version : Help needed with my SQL/php

05-24-2006, 07:55 AM
Hi everyone, Im so glad i have found this site, as i have been searching for a great site like this for ages. Anyway, i need a little help. I have recently purchased my domain name in 5 different extentions (.com, net, info, .biz, .org), so now i truly feel like im the mistress of my domain!! Anyway, im having a bit of difficulty understanding things like databases, my SQL & php. How can i incorporate these things into my site? I want to be able to have dynamic web content on my sites including autoresponders, search page, fully functioning shopping cart, & other popular common scripts. Is there anyone out there that can help with this kind of thing? I already have designed & published a simple site with Gobal Domains Int (GDI) .ws site builder, but feel im ready for a new challenge. In the end, i would like to have all my sites displaying the same content & plan to upload all the content to one site & have the rest point to that site, so no matter what extention a user enters, they will be directed to my site regardless.Can anyone recommend a good tutorial help guide for novice dummies like me? I have absolutely no knowledge of databases at all. I know what their function is, but cannot understand what i need to do to have it all up & running on my site. Before I joined GDI last October, I didnt know a thing about websites, all i could do, basically, was to send & receive emails. Since joining, I have come a long way in understanding basic concepts in website knowledge, like HTML. It has taken me alot of sleepless nights, but i have taught myself everything i know up to this point. So, i would like to continue with that knowledge & learn about my SQL/php. (Everything I have read on the subject so far has been written for advanced knowledge, even the beginner info!) I already have downloaded several fully functioning scripts (shopping cart, banner rotation, autoresponder, chatroom, invoicing, document management, directory indexer, plus many many more...) ready to upload to my site, but have no idea how to go about it. I feel so frustrated, cause i know what i want, but i havent a clue what to do. What i need is slow, patient instruction from someone that has already done it or a recommended, step-by-step, easy to follow tutorial - PLEASE HELP SOMEONE!!!!!!

05-24-2006, 09:24 AM

that's a pretty wide open question, and it's late... I'm tired... so I'm sure I won't cover everything.


You are basically aiming for the top, from what sounds like the bottom. It's great that you want to learn, but be ready to learn a lot if you want to get ALL of that above working.

Your problem really isn't complex. Just use your .com domain and be done with it.
For the others, the main point is stopping competitors from stealing the addresses... job is done.
From there, all you need is a redirect.
Your host should have "domain forwarding" available... which would enable all pages (even yourpage.biz/doesntexist.html) to forward to your "real" site.
failing that, you can just use this code as "index.htm" for the secondary domains:
<meta http-equiv="refresh" content="0;url=http://othersite.com">
(You can include a body section if you want, but that's an immediate refresh, almost compatible with everyone... might want a "click here if it didn't work link" for the REALLY old browsers, and maybe cell phone browsers if they don't do that, etc.)

Sounds like you may want to have yoursite.biz/page.htm to directly to yoursite.com/page.htm, but that's totally overkill.

As a practical matter, all you can do is automate some of it with php and recreate every file on the server for each site. THEN just think about updating. Even something as simple as fixing a spelling error.. ouch! 5 sites. Wow.

Again, overkill. If you just use your host's default "domain forwarding" for the alternate domains and just use the .com, then you're fine. They'll work if people decide to use them, and you really have no need to use them all.

There might be some scripting setup for the server that would take the current url and then display the page from the other server at that url, but there would be weird problems.
Like... cookies... they can't transfer between domains.

Anyway... keep it simple. REALLY not worth it. Unless.... is there some bigger reason than you've said?

As for "what's php/mysql?", php is a serverside coding language.
It's pretty simple...
Basically... on the server, your code is run and interpreted. The output is then sent to the user a pure html.
Compare this to javascript where the user must interpret the code... compatibility issues.
Also, with direct (and generally secure) server access, it's a lot more powerful to use php.

that's a GREAT resource, if only to find examples.

Look up any type of programming and get an idea. Figure out what an if statement is. Not how to use them, but why. And while loops. And functions. And yada yada yada.
The main thing about programming is strategy. Syntax can be cut and pasted... that's the easy part.

For tutorials... not sure. I just usually play around til it works. I'm learning this stuff myself.. quite interesting.
php.net is useful to look up specific functions. If you're coding and forget what "that function for find where a certain letter is in a sentence", you can find that there and how to use it.
Again, syntax/code is easy... it's the method that will be hard to get used to... but then it all starts to make sense.

Generally, you should know that php files just must be run as .php and will be PARSED (interpreted) into pure html like I said above. You don't need ANY php on the page... just html. And php blocks (<?php ... ?>) will be translated... the html on the page already will be sent as is.
Also, you will need to setup php on your server if your host hasn't done it for you. They probably have, though. More info at php.net if that matters.

mysql is a very logical way of organizing things.
it stores data in hmm... "filing cabinets" called "databases", then in "drawers" called tables, "folders" called rows, and bits of data in each cell on each line.
Every item in the database gets a row... (*or column depending on the graphical view you're using... probably row), then each slot in the table is filled with info.

for example:
name job phone number
Bob Cook 2389045285
Joe Teacher 3495083908

It's a lot like excel, if you've used that, or an application like it.

What databases are nice for is 1. storing info and accessing/changing it quickly with php. and 2. searching/organizing (more organizing than searching)
For example, in the above "table", you could:
"SELECT `job` FROM `tablename` WHERE `name`='Joe'"
And the result would be "teacher", etc.

There's info around about this... just start digging.
One tutorial that caught my eye and helped out a bit is:

...In the end, you can use php commands to run mysql queries.
It's basically using php to sorta program the database, if you want to think of it like that. It's not "programming" it, but "querying" it... but kinda the same idea.
Basically... the php sends the query like this:

Also, you'll have to look up some more info on it, but the result returned isn't just displayable... you need a couple commands to extract the result.

Also note that php and mysql are total opposites in syntax.... nothing to do with each other.
php runs through a script and does stuff... mysql just finds data that matches the query, or updates it, or adds it, etc.
It's hard to explain... but they just feel totally different.

That's a basic overview.

You want SO MUCH... but you'll need to be patient. To code something that kinda works is one thing, but something that is both secure and compatible with many users will take a lot of work.
It's within reach if you work at it, but it just isn't gonna happen.

I think that's all I can think of right now... if you've got more specific questions, go for it.

Good luck!

05-24-2006, 10:11 AM
[...] might want a "click here if it didn't work link" for the REALLY old browsers [...]Browser age is totally irrelevant. A 'meta refresh' is the wrong way to accomplish just about anything, it doesn't need to be supported by any browser for any technical reason, and can be disabled in every browser that does implement it.

Redirects are the job of the server, and only the server.


05-24-2006, 05:25 PM
Eh, it's an easy way.
But... yes, if you can use the server, do so.