Programming Tools
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingProgramming Tools

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 29th, 2004, 03:44 PM
jdkarns jdkarns is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Dayton, OH
Posts: 12 jdkarns User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question?

Nice artical but I have a question. There is a table in this tutorial called "links". Is there supposed to be a column in the table called "cssclass"?

Your coding seems to make reference to it several times. The links are suppose to be displayed in all caps if they are new (up to 14 days old) but they dont seem to. Why? Also, sorry for the question, I'm a newbie "php programmer".

PHP Code:
<?php.......various code here


$strsql
="SELECT description, url, target, ".
 
"IF(whenadded > (SUBDATE(CURDATE(), "
 
"INTERVAL '14' DAY)), 'new', 'info') as cssclass FROM links ".
 
"ORDER BY cssclass, UCASE(description)";



Also found reference in this part of the code:

PHP Code:
 $strlinks="";

//tbllinks url, description, type
while($row mysql_fetch_array($result)){
//should ouput in the following format
//<a class="new" href="westnile.html" target=_self >West Nile</a><br />
 
$strlinks.="<a class=\"";
 
$strlinks.=$row["cssclass"]; [b]// Called out here in an array[/b]
 
$strlinks.="\" href=\"";
 
$strlinks.=$row["url"]."\" ";
 if(
$row["target"]!= null)
   
$strlinks.="target=\""$row["target"]."\"";
 
$strlinks.=">"$row["description"] . "</a><br />\n";  
}
echo 
$strlinks;
?> 

cssclass

Thanks Sean Karns

Reply With Quote
  #2  
Old January 29th, 2004, 04:05 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
I'm not sure which article you're referring to... but I think I can answer your question...

The answer's in the SQL query (slightly re-written for clarity reasons):
$strsql="SELECT description, url, target,
IF(whenadded > (SUBDATE(CURDATE(), INTERVAL '14' DAY)), 'new', 'info') as cssclass
FROM links ORDER BY cssclass, UCASE(description)";


The SELECT statement is providing a nickname for the entire field, and calling it cssclass...

An easier example could be: SELECT my_dob AS date FROM person
The field would return named date, instaed of my_dob

Its a way to alias columns/information.

In the future, its best to post the question in the Article Discussion forum specifically, and/or at least point out which article you're talking about =)

Reply With Quote
  #3  
Old January 30th, 2004, 07:01 PM
jdkarns jdkarns is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Dayton, OH
Posts: 12 jdkarns User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thank you for you help!

Thanks for the help. Sorry about posting in wrong area I had to sign up for the forum before I could post and somehow thought it took me back to the proper (forum/tutorial) thread. Here is the artical called (as the link says) Building a sustainable web site. http://www.devarticles.com/c/a/MySQ...nable-Web-Site/

Again Thanks so much

Sean Karns

Quote:
Originally Posted by MadCowDzz
I'm not sure which article you're referring to... but I think I can answer your question...

The answer's in the SQL query (slightly re-written for clarity reasons):
$strsql="SELECT description, url, target,
IF(whenadded > (SUBDATE(CURDATE(), INTERVAL '14' DAY)), 'new', 'info') as cssclass
FROM links ORDER BY cssclass, UCASE(description)";


The SELECT statement is providing a nickname for the entire field, and calling it cssclass...

An easier example could be: SELECT my_dob AS date FROM person
The field would return named date, instaed of my_dob

Its a way to alias columns/information.

In the future, its best to post the question in the Article Discussion forum specifically, and/or at least point out which article you're talking about =)

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingProgramming Tools > Question?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT