Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
david112
Starting Member
1 Post |
Posted - 2010-04-28 : 11:41:00
|
| Hey there guys,I've got a bit of a problem with some SQL, and I'm hoping that you'll be able to help me out. I've got the following code: function getTerms($db) { $sql = "SELECT termname FROM tblterms"; $stmt = $db->prepare($sql); $stmt = $db->query($sql); $terms = $stmt->fetch(); return $terms; }In the past I've used this code, but I've always had a "LIMIT 1" tacked onto the end of the SQL statement. What I am hoping for here is a list of entries from the termname column of the table, all of which I already know are guaranteed to be unique, so I don't have to worry about duplicates there. I know that PHP returns this in an array, but I'm not entirely sure how to reference each row, or indeed count how many rows there are! Any / all help would be much appreciated.Thanks very much! :) |
|
|
|
|
|