Issues with primary keys

Hey, I am using smarty, so i am using foreach tags. This is my code:

{foreach from=$news key=k item=i}





It will display everything else fine, but it just doesnt display the userid (uid) Any suggestions?

The uid is set as a primary key.

Simply you use Proper Select Query, for Retrieving data from database.
Select column_name from Table_name;

Try the following in your foreach loop, what does it display?


Also, you’re accessing a variable called ‘news’ and outputting information that looks like user info. Are you sure you’re accessing the correct variable in the foreach loop? :slight_smile:

It sounds like you are not retrieving the UID along with the other fields when you do the database call. While you already know its value before doing the read from the database it doesn’t get put into the returned array unless you also retrieve it.