ibnclaudius Posted November 5, 2011 Share Posted November 5, 2011 What is this a. b. c. before the fields? I'm not understanding it. I know is about foreign key and reference, but why a. b. c. ?? <?php $user_id='1'; // User table user_id value $update_sql=mysql_query("SELECT a.username, a.email, b.update_id, b.update, b.time, b.vote_up, b.vote_down FROM users a, updates b, friends c WHERE b.user_id_fk = a.user_id AND c.friend_one = '$user_id' AND b.user_id_fk = c.friend_two ORDER BY b.update_id DESC LIMIT 15"); while($row=mysql_fetch_array($update_sql)) { $username=$row['username']; $email=$row['email']; $update_id=$row['update_id']; $update=$row['update']; $time=$row['time']; $up=$row['vote_up']; $down=$row['vote_down']; //Avatar $lowercase = strtolower($email); $image = md5($lowercase); $avatar ='http://www.gravatar.com/avatar.php?gravatar_id='.$image; //Update HTML tags filter $htmldata = array ("<", ">"); $htmlreplace = array ("<",">"); $final_update = str_replace($htmldata, $htmlreplace, $update); // Updates Results Display here } ?> Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted November 5, 2011 Share Posted November 5, 2011 Those are table aliases. `users` is aliased as a, `updates` is aliased as b and `friends` is aliased as c. You can see where that is done in the FROM clause. Quote Link to comment Share on other sites More sharing options...
ibnclaudius Posted November 5, 2011 Author Share Posted November 5, 2011 Thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.