LooieENG Posted June 26, 2008 Share Posted June 26, 2008 For each blog post, I dunno whether to echo <a href="index.php?u=ID">user</a> or <a href="index.php?u=user">user</a> I'd prefer ?u=ID, but then for each blog post would I have to perform a MySQL query to get the name of the user who posted it, or is there another way? Thanks Quote Link to comment Share on other sites More sharing options...
Wolphie Posted June 26, 2008 Share Posted June 26, 2008 Surely anyway wouldn't you need to call the body of the blog post, title of the blog post, etc..? If I was doing the same thing, I would also have an author field in the same table. In which case, it wouldn't be that difficult to add an extra line or so to get the author from the database. But ID's are the best way to retrieve hierarchical data, or any kind of data to be honest. Quote Link to comment Share on other sites More sharing options...
LooieENG Posted June 26, 2008 Author Share Posted June 26, 2008 Yeah, but what I mean is, under "postedBy" in the database, if I would have the userID, I'd have to perform ANOTHER query to find out the username belonging to that ID Thanks for the fast reply Quote Link to comment Share on other sites More sharing options...
.josh Posted June 26, 2008 Share Posted June 26, 2008 no actually you'd do just one query. Look into relational databases and doing queries with JOIN. Quote Link to comment Share on other sites More sharing options...
LooieENG Posted June 26, 2008 Author Share Posted June 26, 2008 Ah, didn't know about that (obviously ) but I'll look into it. 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.