Hartley Posted June 27, 2007 Share Posted June 27, 2007 I have a form that is included within a template. This form calls to a mysql database that has 9 different rows filled with different application requirements. However, when the page runs, it just stops altogether. I can't find where I may have messed up. This is a private form that administrators update on the website for various positions. <form name="recruitedit" action="index.php?p=recruitcommit" method="post"> <?php $dbhost = 'xxxxx'; $dbuser = 'xxxxx'; $dbpass = 'xxxxx'; $dbname = 'xxxxx'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); mysql_select_db($dbname); $query = "SELECT * FROM wow"; $result = mysql_query($query); while($row = mysql_fetch_assoc($result)) { // Define Variables $class = "{$row['class']"; $vacancy = "{$row['need']}"; $posted = "{$row['posted']}"; $position = "{$row['position']}"; $functions = "{$row['functions']}"; $qualifications = "{$row['qualifications']}"; echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"750\"> <tr><td class=\"app-$class\"><img src=\"images/site/clear.gif\" width=\"1\" height=\"1\" border=\"0\" alt=\"Spacer\" /></td></tr> <tr><td class=\"app-body\"> <b><i>Last Updated: $posted.</i></b><br /><br /> <b>Total Vacancies</b><br /> <input name=\"$class-vacancies\" size=\"1\" type=\"text\" value=\"$vacancy\"><br /><br /> <b>General Position Description</b><br /> <textarea cols=\"78\" name=\"$class-position\" value=\"$position\" rows=\"4\"><br /><br /> <b>Essential Functions of Position</b><br /> <textarea cols=\"78\" name=\"$class-functions\" value=\"$functions\" rows=\"4\"><br /><br /> <b>Preferred Qualifications</b><br /> <textarea cols=\"78\" name=\"$class-qualifications\" value=\"$qualifications\" rows=\"4\"> </td></tr> <tr><td class=\"app-body\" style=\"border-top: 0px\" colspan=\"3\"><input name=\"commit\" type=\"submit\" value=\"Commit Changes\"></td></tr> <tr><td class=\"app-foot\"><img src=\"images/site/clear.gif\" width=\"1\" height=\"1\" border=\"0\" alt=\"Spacer\" /></td></tr></table> <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"> <tr> <td height=\"5\"><img src=\"images/site/clear.gif\" width=\"1\" height=\"1\" border=\"0\" alt=\"Spacer\" /></td> </tr> </table>"; } mysql_close($conn); ?> </form> Thanks in advance! For some reason the code block is ignoring the very first backslash. It's there, just not showing up. Link to comment https://forums.phpfreaks.com/topic/57386-code-help-on-a-form/ Share on other sites More sharing options...
sushant_d84 Posted June 27, 2007 Share Posted June 27, 2007 Hi... I am in Hurrey ......... But I guess removing "{ and just writing $row['fieldname'] will work for that ......... try out this Regards Sushant Link to comment https://forums.phpfreaks.com/topic/57386-code-help-on-a-form/#findComment-283900 Share on other sites More sharing options...
papaface Posted June 27, 2007 Share Posted June 27, 2007 ^^ Dont follow that advice. The problem is with this cho "<table cellpadding="0\" The " hasnt been escaped. Link to comment https://forums.phpfreaks.com/topic/57386-code-help-on-a-form/#findComment-283902 Share on other sites More sharing options...
phporcaffeine Posted June 27, 2007 Share Posted June 27, 2007 For debugging purposes, flip 'DISPLAY_ERRORS' on change ' .... $result = mysql_query($query); ..... ' to ' .... $result = mysql_query($query) OR die(mysql_error()); ....' change '..... $class = "{$row['class']"; ....' to '.... $class = "$row['class']"; ....' (this declaration wouldn't be valid because it is missing the closing "}" brace) Also, remove all the curly braces " { } " from your variable declarations (starting right below //DEFINE VARIABLES) Link to comment https://forums.phpfreaks.com/topic/57386-code-help-on-a-form/#findComment-283905 Share on other sites More sharing options...
phporcaffeine Posted June 27, 2007 Share Posted June 27, 2007 ^^ Dont follow that advice. The problem is with this cho "<table cellpadding="0\" The " hasnt been escaped. The original poster said that the escape is there and that the forum wasn't letting it show up ... "Thanks in advance! For some reason the code block is ignoring the very first backslash. It's there, just not showing up." (its at the very bottom of the first post) Link to comment https://forums.phpfreaks.com/topic/57386-code-help-on-a-form/#findComment-283909 Share on other sites More sharing options...
Hartley Posted June 27, 2007 Author Share Posted June 27, 2007 Aha, it did end up being the curlies: $class = "{$row['class']"; Didn't close the first one. I also have one last question, unrelated to above (which is now working). If I have a unix timestamp, how do I convert it to the following format: June 27, 2007 at 10:00am. Link to comment https://forums.phpfreaks.com/topic/57386-code-help-on-a-form/#findComment-284017 Share on other sites More sharing options...
chrisuk Posted June 27, 2007 Share Posted June 27, 2007 see here for PHP date formatting: http://us3.php.net/date Link to comment https://forums.phpfreaks.com/topic/57386-code-help-on-a-form/#findComment-284030 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.