Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $db = new mysqli('localhost','user','password','database');
- $resource = $db->query('SELECT field FROM table WHERE 1');
- $row = $resource->fetch_assoc();
- echo "{$row['field']}";
- $resource->free();
- $db->close();
- If you're grabbing more than one row, I do it like this:
- $db = new mysqli('localhost','user','password','database');
- $resource = $db->query('SELECT field FROM table WHERE 1');
- while ( $row = $resource->fetch_assoc() ) {
- echo "{$row['field']}";
- }
- $resource->free();
- $db->close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement