I'm trying to grab SID from the insert into the first table (stories) so I can insert that SID into the writing table in my second insert.

I think the way to do this is with `mysql_insert_id();` after the first query, but the primary key that auto-increments is called SID. If `mysql_insert_id()` could grab that value I'd be all set. 

What I am finding from a var\_dump is that the `$SID = mysql_insert_id();` is just returning the `value "0"` and I'm not sure why. 

There is a column called ID in stores, but if it was grabbing that, the value would be `"1"`. Either way, I wish this method could be written as `mysql_insert_SID();` 

Any idea what I am doing wrong or how I can fix this? And yes, I know this is a deprecated approach, but first I want to figure out how before I worry about converting to PDO.

```
// Get values from form 
$category = $_POST['category'];
$genre = $_POST['genre'];
$story_name = $_POST['story_name'];
$text = $_POST['text'];

$query = "INSERT INTO stories (ID, category, genre, story_name, active)  VALUES
('$user_ID', '$category', '$genre','$story_name', '1')";

$result = mysql_query($query);
$SID = mysql_insert_id();     
$SID2 = "select stories.SID from stories where stories.SID=$SID";

$query2 = "INSERT INTO writing (ID, SID, text, position, approved) 
VALUES('$user_ID',  '$SID2', '$text', '1','N')";

$result = mysql_query($query2);

```