You should probably use one of the existing auth libraries for CodeIgniter. Authentication and security will ruin a web shop if anything goes wrong.
Generally, tutorials that aren't written specifically for CodeIgniter (or at least some MVC framework) are only going to help with the concepts of how to handle an issue. The code you've posted mixes database queries with raw text and deprecated HTML. In MVC the database query should be in the model or controller and the HTML in a view, and, if you're creating a new site, you should take the time to learn/write modern HTML (in the end, it will require less code than your example, too).
The first line of code you posted contains a typo in the database query.
In the last block of code you've included, you're testing a value against the string "True" instead of using a boolean value, then comparing another value against another string using less/greater than operators, which can give you some unexpected results.
Code:
if($items['staffonly'] == "True" && $logged['userlevel'] >= '4'){
If you made 'staffonly' a boolean value in your database, it would require less memory/storage and the test would be less subject to string comparison issues (like capitalization and encoding). If 'userlevel' could be numeric, it would have similar benefits in most cases (since it rarely requires more memory to store the number 4 than the character 4).
Code:
if ($items['staffonly'] === TRUE && $logged['userlevel'] >= 4) {
Additionally, you probably need to put braces around your variables in your strings when the variables are array references, and you need to quote the names of the keys. So, for example, the following:
Code:
print "<img src=\"$items[image]\" alt=\"$items[name]\" />";
should probably be something like this:
Code:
print "<img src=\"{$items['image']}\" alt=\"{$items['name']}\" />";
(I inserted the closing quote and semi-colon to avoid trying to deal with the table which followed it.)
Or you could make it potentially clearer like this:
Code:
print "<img src='{$items['image']}' alt='{$items['name']}' />";
or use row() instead of row_array() and change it to:
Code:
print "<img src='{$items->image}' alt='{$items->name}' />";