i have just had to go into the backend of an old site to fix the mysql db as some had deleted the wrong db. i have got most of it working again now but did not know what this line of code is doing.

$sql = "SELECT id,thumb,image,designer,title,(total/freq) AS score FROM shirts ORDER BY score DESC";

i know it is telling it to select the information out of the table and from which table but i have not used the AS condition before and i cannot find an explanation of this anywhere.

if someone could point me in the direction of a good explanation of how this condition effects the sql statement that would be great

found out what it means now it is pseudo names for the columns. What it does is gives the names of the columns being used more suitable names to make it easier for people to know what data the column is holding when displaying the information

db table is : shirts

from what i was reading what it does is, say if you had a column called cust_num and wanted to display this to someone who has not set the table up and did not know what the column names where for or what they meant you would use the AS function to give the column names a more understandable name like customer numbers instead of cust_num.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.