1 Replies - 721 Views - Last Post: 09 May 2011 - 12:53 PM Rate Topic: -----

#1 benjaminjsy   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 02-May 11

SQL Queries

Posted 09 May 2011 - 12:19 PM

Hello All! Complete newbie here so please bear with me and my newbie-ish questions!

I am in the process of setting up a website that involves people being able to sign up for membership as well as being able to perform a variety of searches and it is these searches amongst other things that I need a bit of help understanding. Just so you all know, I have tried to find the information I need via Google searches but I am not having much luck because to be honest, i'm not even sure what it is I need to look for. I'm not asking for any of you to spoon-feed my the answers but if somebody could at least point me in the right direction and let me know if I have misunderstood anything, I would be massively grateful:

1.) I understand that when you manually create an SQL query, you define the database name, table name, parameters etc. yourself but what is the method used when the queries are going to be created by members of the website? For example, when a user is presented with a search form with a number of different options to choose from, such as the "Advanced Search" feature used on Ebay, what sort of code is in place to allow them to determine a specific set of parameters to be searched for in the query? Presumably, their is a less labor-intensive way of making this possible than creating a separate query for every single possible combination of options that might be chosen by the user..?

2.) I would like to allow the members to be able to edit / update / delete data within their profile pages, as well as various other pages that they have created, such as changing their profile picture, updating their "About Me" section, editing / deleting listings that they have created (ie. items for sale) - how exactly do other websites of this nature implement the options to perform such actions that affect pieces of data relevant to specific users? To put it another way, if Member A and Member B both wanted to change their profile picture, what sort of "update database" script would I need in order to automatically distinguish between the two members so that when either of them clicks on the same "update button" or "delete button", the resulting change to the database affects their relevant data and nobody else's'..?

3.) Similar to the last question, the "items for sale" page, members' profile page etc. will have a basic structure with the same layout and set of links and buttons for all members. What i'm wondering is how I would automatically set up the pages so that the information displayed / page the clicker is taken to when the various links / buttons are clicked relates to the specific user. Using Ebay as an example again, each item listing has a number of options such as "View This Seller's Other Items" and "View This Seller's Feedback" and I would like to find out how these links automatically direct anyone who clicks on them to a page which displays the requested data that relates to the respective creator of the original item listing - i'm wondering if this might have something to do with sessions..?

Thank you so much to those of you who took the time to read my post and a huge thank you in advance to anyone who is able to help me understand what the heck i'm supposed to be doing a little bit better!


Is This A Good Question/Topic? 0
  • +

Replies To: SQL Queries

#2 smohd   User is offline

  • Critical Section
  • member icon

Reputation: 1824
  • View blog
  • Posts: 4,627
  • Joined: 14-March 10

Re: SQL Queries

Posted 09 May 2011 - 12:53 PM

1. That is why we have variables. You feed the query with variables that takes data according to what user has selected, for example I may have selectedValue.ToString() from a combobox may be depends on what language.
2. Also a query with WHERE Clause will do. Example I may say
UPDATE tableName SET columnName = x WHERE userID = 'Me'

3.That is only one page, what changes is selected value from the database. For example I may say
SELECT * from TableName WHERE owner = 'smohd'

This query will give all data from a certain table owned by smohd. I Think this may help.

I think you need knowledge about database programming, look at:
SQL Tutorial
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1