{"issue":{"title":"Undefined Variable error for first list item.","user":{"login":"carwin","id":715967,"url":"https://api.github.com/users/carwin","avatar_url":"https://secure.gravatar.com/avatar/97c966c7c078ed7a0f1e494a786f1aa0?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"97c966c7c078ed7a0f1e494a786f1aa0"},"created_at":"2011-12-29T01:09:12Z","milestone":null,"labels":[],"state":"open","updated_at":"2011-12-29T01:09:12Z","id":2676406,"closed_at":null,"html_url":"https://github.com/carwin/smplst/issues/1","pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"body":"For some reason the variable $new_id isn't being set. I'm sure this is an oversight on my part. Adding this here as an issue just so I remember it.\r\n\r\nsave_new_record() looks like this:\r\n\r\n<code>\r\nfunction save_new_record($text, $lid){\r\n    //Calculate how many items there are now\r\n\t$query1 = \"SELECT recordID FROM records WHERE   recordID = (SELECT MAX(recordID)  FROM records);\";\r\n\t$result1 = mysql_query($query1);\r\n\twhile($row = mysql_fetch_array($result1)){\r\n\t    if(isset($new_id)){\r\n    \t    $new_id = 0;\r\n    \t}\r\n    \t    $new_id = end($row) + 1;\r\n\t}\r\n\t$query2 = \"INSERT INTO records (recordID, recordText, recordListingID, lid) VALUES\";\r\n    $query2 .= '(\"'.$new_id.'\", \"'.$text.'\", \"'.$new_id.'\", \"'.$lid.'\");';\r\n\treturn mysql_query($query2);\r\n\texit;\r\n}\r\n</code>","number":1,"url":"https://api.github.com/repos/carwin/smplst/issues/1","comments":0,"assignee":{"login":"carwin","id":715967,"url":"https://api.github.com/users/carwin","avatar_url":"https://secure.gravatar.com/avatar/97c966c7c078ed7a0f1e494a786f1aa0?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"97c966c7c078ed7a0f1e494a786f1aa0"}},"action":"opened"}