|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
im goin to have an admin area where they can change background colorz etc... in doing this, everything will be in a database (MYSql)
Is it better to have the data in seperate fields or have 2 fields... 1 field for as the "name" and then the 2nd field for the "data"? If I have only 2 fields, then would I have to filter it out - what would be the best way to do this?? Should I use seperate tables? |
|
#2
|
|||
|
|||
|
if its in ASP, the most common way of doing these configuration is using server includes
so set a variable in a file called config.inc like BackColor="#CCCCCC" BorderColor="White" and in your page, put <body bgcolor="<%=BackColor%>"> make sure at the top of each page you add <!--#Include file = "config.inc"-->
__________________
Regards, James Yang .NET Developer / Network Engineer MCSE, MCDBA, MCSA, CCNA http://www.yellowpin.com/ http://www.opentechsupport.com/ |
|
#3
|
|||
|
|||
|
ahh i get what your saying, its like my site, ive got the prefrences not in a file, but in my database, so its easy to create a prefrence page thingy in da admin
the database structure is like this id | name | value then its easy! w00p. soz need 2 sleep |
|
#4
|
|||
|
|||
|
If your doing that, then what i would do is load them up as your application variables that way ur round trip to the database is minimized
|
|
#5
|
|||
|
|||
|
Ben, If I have the database structure as you say - this would mean that I'd have to filter the database?? So that when I want the bgcolor prefrence.. i would need to filter "bgcolor" in the "name" field?
Do you have an asp sample code so that I can see what you mean? |
|
#6
|
|||
|
|||
|
What you can do is loop through the query results and put the options in associative arrays
__________________
Best Regards, Håvard Lindset |
|
#7
|
|||
|
|||
|
What if I rang the whole table through a look and set them as session Variables? Would it use up too much memory? eg.
<% strConn = "Driver={Mysql}; Server=203.2.7.2; Database=dbtest; UID=ffff; PWD=ffff" Set objConn = Server.CreateObject("ADODB.Connection") objConn.Open strConn strSQL="select * from tblSettings" set rs=objConn.Execute(strSQL) rs.movefirst while not rs.eof Session(rs("Name")) = rs("setas") rs.movenext wend rs.close objconn.close set rs = nothing set objconn = nothing %> |
![]() |
| Viewing: Dev Articles Community Forums > Databases > General SQL Development > Tables, 2 fields, or Multiple Fields? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|