Oprano Adult Industry Forums

Oprano Adult Industry Forums (http://www.oprano.com/msgboard/index.php)
-   Legacy Archived Main Board (http://www.oprano.com/msgboard/forumdisplay.php?f=25)
-   -   Php & Sql (http://www.oprano.com/msgboard/showthread.php?t=86103)

Nymph 02-01-2008 08:12 PM

Php & Sql
 
Ok, who is the wiz kid here?

I want to do something with a script I'm running, and not real sure how.

I know I would need to make another table in the sql database I already have for this script...I'm pretty sure I can copy the format of one of the other tables for this.

Next is putting the data in it. I know from what page I need to add it...form style...not sure on the format to get it to insert in the table.

Next is the call to the page for it...big questions on that one.

If anyone would care to give me some pointers, I'd really appreciate it.

Hell Puppy 02-02-2008 07:21 AM

Re: Php & Sql
 
Quote:

Originally Posted by Nymph (Post 802548)
Ok, who is the wiz kid here?

I want to do something with a script I'm running, and not real sure how.

I know I would need to make another table in the sql database I already have for this script...I'm pretty sure I can copy the format of one of the other tables for this.

Next is putting the data in it. I know from what page I need to add it...form style...not sure on the format to get it to insert in the table.

Next is the call to the page for it...big questions on that one.

If anyone would care to give me some pointers, I'd really appreciate it.

Your questions are pretty vague. So my initial suggestion is hit Amazon and find yourself a good PHP and MySQL book that suits your skill level.

I can give you some feedback based on what you say above.

First off, you say you can copy the format of an existing table. No way I can say for sure without knowing EXACTLY what you're doing, but a well designed database is the key to having a maintainable, scalable site that performs well. It starts with your database schema, and thus your table designs.

Before deciding how you want to store data, you must think thru how you want to pull the data back out.

Let's say you're creating a database with recipes in it. Seems simple enough to have a single table in there with all of the fields you might want to capture for each recipe yes? And that indeed would work, but it's gonna be a slug on searchs if the database gets very large, and you may limit your search capabilities or make them require extremely complex sql to extract.

What if I want to search recipes by ingredients? Let's say I want to pull back all recipes that have chicken, tomatoes, and garlic. If I didn't design my schema correctly that's a bitch. If I did, it's easily done and very fast.

Consider another scenario. You store recipes by author. Do I put the author in the recipe table? Or do I cross link to an author table? The correct answer is normally cross link. Why? Many reasons, but what if one of the authors wants to change their "handle" or avatar or email address. If it's all in one table, again, that's one god awful nasty query to write. If it's in a separate table, I update one row and it'll display with the update on every recipe in the database when it's pulled back.

As for taking data from forms and inserting into the database, well, that's a big part of what PHP does and it does it well. It'll collect your form data from the POST or GET, then you can manipulate it as you see fit and use PHP to build SQL statements to pass to MySQL to manipulate the database accordingly.

Again your initial questions are too broad, if you get to a point where they're more narrow such as specific SQL queries you need built, post and I can help.

Nymph 02-02-2008 08:30 AM

Re: Php & Sql
 
Quote:

Originally Posted by Hell Puppy (Post 802558)
Your questions are pretty vague. So my initial suggestion is hit Amazon and find yourself a good PHP and MySQL book that suits your skill level.

I can give you some feedback based on what you say above.

First off, you say you can copy the format of an existing table. No way I can say for sure without knowing EXACTLY what you're doing, but a well designed database is the key to having a maintainable, scalable site that performs well. It starts with your database schema, and thus your table designs.

Before deciding how you want to store data, you must think thru how you want to pull the data back out.

Let's say you're creating a database with recipes in it. Seems simple enough to have a single table in there with all of the fields you might want to capture for each recipe yes? And that indeed would work, but it's gonna be a slug on searchs if the database gets very large, and you may limit your search capabilities or make them require extremely complex sql to extract.

What if I want to search recipes by ingredients? Let's say I want to pull back all recipes that have chicken, tomatoes, and garlic. If I didn't design my schema correctly that's a bitch. If I did, it's easily done and very fast.

Consider another scenario. You store recipes by author. Do I put the author in the recipe table? Or do I cross link to an author table? The correct answer is normally cross link. Why? Many reasons, but what if one of the authors wants to change their "handle" or avatar or email address. If it's all in one table, again, that's one god awful nasty query to write. If it's in a separate table, I update one row and it'll display with the update on every recipe in the database when it's pulled back.

As for taking data from forms and inserting into the database, well, that's a big part of what PHP does and it does it well. It'll collect your form data from the POST or GET, then you can manipulate it as you see fit and use PHP to build SQL statements to pass to MySQL to manipulate the database accordingly.

Again your initial questions are too broad, if you get to a point where they're more narrow such as specific SQL queries you need built, post and I can help.

You are right, I was to vague. I have been driving myself nuts trying to get everything back up online the past week, and brain thoughts seem to come out all jumbled at times :(

I am working with a recipe script, one that I have used for a few years. Everything is functional on it, but I wanted to add a new field. I'm not very familiar with PHP, if this was a cgi script, I'd have it in a heartbeat.

In the current category field, it just has a place to put in the category name. I want to add a a field for a decrtiption, or little intro of that category.

Here is one of the recipe sites I'm talking about, http://www.bbq-grilling-recipes.com and yes, it's still quite empty, but I'm working as fast as I can to get it filled back up again.

I'm probably wanting to do something with it, that isn't going to be able to happen...but that's just the way my life has been the past few months.

KevinG 02-03-2008 11:43 AM

Re: Php & Sql
 
That looks like a nice site Nymph. I have an exclusive recipe section on my Cigar Review site.

Are you sure the script doesn't handle the MySQL stuff for you? It is common that they do.

Nymph 02-03-2008 12:12 PM

Re: Php & Sql
 
Quote:

Originally Posted by KevinG (Post 802594)
That looks like a nice site Nymph. I have an exclusive recipe section on my Cigar Review site.

Are you sure the script doesn't handle the MySQL stuff for you? It is common that they do.

Thank you, maybe once I get it all back together, we can trade links.

Nope, the script does about everything else, except of course, what I want right now.

Jace 02-05-2008 11:37 PM

Re: Php & Sql
 
you know, I ALWAYS forget about Google Books

http://books.google.com/books?id=fGz...TJbfTkwhFRi3Dc


All times are GMT -4. The time now is 08:46 PM..

Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Copyright Evil Empire Inc. 2006-2022