Use prism for code syntax highlighting

This commit is contained in:
Oliver Davies 2017-03-16 08:09:52 +00:00
parent 356c9dca43
commit adf3c67355
54 changed files with 471 additions and 324 deletions

View file

@ -13,18 +13,18 @@ At the end of my last post, I'd finished creating the first part of the new pho
Firstly, I'll refer to the previous list of published galleries that I created before, and create something different that also displays the created and modified dates. Picking the node ID of the required gallery, I used the following SQL query to display a list of photos.
~~~sql
```language-sql
SELECT n.title, n.nid, n.created, n.changed, p.field_gallery_nid
FROM node n, content_type_photo pWHERE n.type = 'photo'
AND p.field_gallery_nid = 103AND n.nid = p.nid
ORDER BY n.nid ASC;
~~~
```
When I look back at the old photo gallery, I can see that the previous 'last added' date was June 27, 2008. So, how do I update my new photos to reflect that date? Using <http://www.onlineconversion.com/unix_time.htm>, I can enter the required date in its readable format, and it will give me the equivilent UNIX timestamp. To keep things relatively simple, I'll set all photos within this gallery to the same time.
The result that I'm given is '1217149200'. I can now use an UPDATE statement within another SQL query to update the created and modified dates.
~~~sql
```language-sql
UPDATE node
INNER JOIN content_type_photo
ON node.nid = content_type_photo.nid
@ -32,7 +32,7 @@ SET
node.created = 1217149200,
node.changed = 1217149200
WHERE content_type_photo.field_gallery_nid = 103
~~~
```
Now when I query the database, both the created and modified databases have been updated, and when I return to the new photo gallery, the updated value is being displayed.