# Dynamic list update with sql

**URL:** <https://forum.kirupa.com/t/dynamic-list-update-with-sql/239693>\
**Category:** programming\
**Created:** [September 24, 2007, 10:04pm UTC](https://forum.kirupa.com/t/dynamic-list-update-with-sql/239693 "2007-09-24T22:04:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![thatguythatsme](https://avatars.discourse-cdn.com/v4/letter/t/c0e974/32.png) [@thatguythatsme](https://forum.kirupa.com/u/thatguythatsme)\
**Post date:** [September 24, 2007, 10:04pm UTC](https://forum.kirupa.com/t/dynamic-list-update-with-sql/239693/1 "2007-09-24T22:04:25Z")

</div>

Hi, I’m trying to create a simple blog where I can post entries to a database. I’m having trouble with attaching multiple categories to a single post. There’s an image of my database here… [http://david.flexlab.co.uk/wp-content/images/tables.jpg](http://david.flexlab.co.uk/wp-content/images/tables.jpg)

I so far have a stored procedure to handle the post update

```auto

CREATE Procedure apPostAdd
    @AuthorID int,
    @PostTitle varchar(255),
    @PostBody text,
    @PublicationDate datetime
As
BEGIN TRANSACTION
    INSERT tblPosts (AuthorID, PostTitle, PostBody, PublicationDate)
    VALUES (@AuthorID, @PostTitle, @PostBody, @PublicationDate)
GO

```

I’ve got a loop working to select all the rows in tblCategory into my post form.

```auto

    <%
    Set rstCat = GetAllCategory
    DO WHILE NOT rstCat.EOF 
    %>
    <tr>
        <td><label for="<%=rstCat("CategoryTitle")%>"><%=rstCat("CategoryTitle")%></label></td>
        <td><input name="<%=rstCat("CategoryTitle")%>" id="<%=rstCat("CategoryTitle")%>" type="checkbox" value="<%=rstCat("CategoryID")%>" /></td>
    </tr>
    <%
    rstCat.MoveNext
    LOOP
    rstCat.Close
    %>

```

I’m just not sure how to go about updating the tblPostCategory in the same form. If anyone has any suggestions or tutorials on how this is done it would be a great help.

David
