Xtremer360 Posted January 13, 2011 Share Posted January 13, 2011 The rest of my coding works however this part does not and I'm trying to figure out why. I'm sure my syntax isn't right so I hope someone can correct my mistake. $contentpageID = $_GET['id']; $query = "SELECT contentpages.contentpage, contentpages.shortname, contentpages.contentcode, contentpages.linebreaks, contentpages.backlink, contentpages.showheading, contentpages.visible, contentpages.template_id FROM contentpages WHERE contentpages.id = '" . $contentpageID . "'"; <label for="template">Template</label> <select class="dropdown" name="template" id="template" title="Template"> <option value="0">- Select -</option> <?php $query = 'SELECT * FROM templates'; $result = mysql_query ( $query ); while ( $template_row = mysql_fetch_assoc ( $result ) ) { print "<option value=\"".$template_row['id']."\" "; if($template_row['id'] == $row['template_id']) { print " SELECTED"; } print ">".$template_row['templatename']."</option>\r"; } ?> </select> Quote Link to comment Share on other sites More sharing options...
Anti-Moronic Posted January 13, 2011 Share Posted January 13, 2011 Your sql is over complicated. It can simply be: "SELECT * from contentpages where id = '" . $contentpageID . "'"; We also need an error or something instead of "it doesn't work". How? What is not working, specifically? Quote Link to comment Share on other sites More sharing options...
Xtremer360 Posted January 13, 2011 Author Share Posted January 13, 2011 That's the thing its not spilling out an error. Quote Link to comment Share on other sites More sharing options...
Anti-Moronic Posted January 13, 2011 Share Posted January 13, 2011 So what is going wrong on the page? Is it blank? Do you have error reporting turned on? Make sure it is also set to strict. Have you tried to pritn_r your results. Are you meant to execute the first query? because you are overriding it here: $query = 'SELECT * FROM templates'; ..and I don't see any execution of the first one before that. Quote Link to comment Share on other sites More sharing options...
Xtremer360 Posted January 13, 2011 Author Share Posted January 13, 2011 Its not even filling the dropdown with any of the templates from the database. Quote Link to comment Share on other sites More sharing options...
snowman15 Posted January 13, 2011 Share Posted January 13, 2011 you should repost the most current code Quote Link to comment Share on other sites More sharing options...
Xtremer360 Posted January 13, 2011 Author Share Posted January 13, 2011 I got it to work. I'm betting the issue was that I didn't rename the query variable so it wouldn't have the first one get over-written. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.