mitchberry Posted August 20, 2009 Share Posted August 20, 2009 i'm seriously frustrated right now. I've been working on this project since last sunday, i've successfully related 4 different tables together to find all sorts of information, and ... i get stuck HERE? ok here's the problem... and its probably something so incredibly stupid... $user_password = $_POST['user_password']; $user_username = $_POST['user_username']; $emp_id = $_POST['emp_id']; $user_first = $_POST['user_first']; $user_last = $_POST['user_last']; $user_commission_rate = $_POST['user_commission_rate']; $user_leads = $_POST['user_leads']; $user_isadmin = $_POST['user_isadmin']; mysql_query(" UPDATE contractors SET emp_id ='".$emp_id."', user_first ='".$user_first."', user_last ='".$user_last."', user_password ='".$user_password."', user_leads ='".$user_leads."', user_commission_rate ='".$user_commission_rate."', user_isadmin ='".$user_isadmin."; WHERE user_username = '".$user_username."' "); ---- $user_commission_rate and $user_isadmin are both formed from drop menus on a separate page... the commission rate one works.... the user is admin one does not work. can anyone shed light into this ?????????????????? $user_isadmin = $row["user_isadmin"]; echo "<tr><td width=\"30px\"> </td>"; echo "<td width=\"100px\"><span class=\"smallfont\">Admin Status</span></td>"; echo "<td><span class=\"smallfont\">$user_isadmin</span></td>"; echo "<td><select name=\"user_isadmin\" id=\"user_isadmin\"> <option value=\"$user_isadmin\">Select One...</option> <option value=\"1\">Allow</option> <option value=\"2\">Disallow</option> </select></td></tr>"; ------------------ echo "<tr><td width=\"30px\"> </td>"; echo "<td width=\"100px\"><span class=\"smallfont\">Commission</span></td>"; echo "<td><span class=\"smallfont\">".$row["user_commission_rate"]."</span></td>"; echo "<td><select name=\"user_commission_rate\" id=\"user_commission_rate\"> <option value=\"".$row["user_commission_rate"]."\">Select One...</option> <option value=\".1\">10</option> <option value=\".12\">12</option> <option value=\".15\">15</option> </select></td></tr>"; thanks in advance!!!!!!!!!!!! Link to comment https://forums.phpfreaks.com/topic/171112-what-the-crap-is-wrong-here/ Share on other sites More sharing options...
Garethp Posted August 20, 2009 Share Posted August 20, 2009 Well if you echo $_POST['user_isadmin'], what do you get? Also, you should really mysql_escape_string(); Your inputs Link to comment https://forums.phpfreaks.com/topic/171112-what-the-crap-is-wrong-here/#findComment-902382 Share on other sites More sharing options...
Bricktop Posted August 20, 2009 Share Posted August 20, 2009 Hi mitchberry, You're missing the trailing apostrophe on user_isadmin in your mysql query, i.e. change: user_isadmin ='".$user_isadmin."; to: user_isadmin ='".$user_isadmin."'; Hope this helps. Link to comment https://forums.phpfreaks.com/topic/171112-what-the-crap-is-wrong-here/#findComment-902386 Share on other sites More sharing options...
markwillis82 Posted August 20, 2009 Share Posted August 20, 2009 mysql_query(" UPDATE contractors SET emp_id ='".$emp_id."', user_first ='".$user_first."', user_last ='".$user_last."', user_password ='".$user_password."', user_leads ='".$user_leads."', user_commission_rate ='".$user_commission_rate."', user_isadmin ='".$user_isadmin."; WHERE user_username = '".$user_username."' "); after '".$user_isadmin."; you also have a semi colon which may throw an error (it will ignore the WHERE clause from the SQL statement. Try this: mysql_query(" UPDATE contractors SET emp_id ='".$emp_id."', user_first ='".$user_first."', user_last ='".$user_last."', user_password ='".$user_password."', user_leads ='".$user_leads."', user_commission_rate ='".$user_commission_rate."', user_isadmin ='".$user_isadmin."' WHERE user_username = '".$user_username."' "); Link to comment https://forums.phpfreaks.com/topic/171112-what-the-crap-is-wrong-here/#findComment-902434 Share on other sites More sharing options...
mitchberry Posted August 20, 2009 Author Share Posted August 20, 2009 a combination of each of these things helped.. thanks for being a second pair of eyes. when the hours get rolling, it's easy to miss the little things and get stuck for hours on end.. i do appreciate it... Link to comment https://forums.phpfreaks.com/topic/171112-what-the-crap-is-wrong-here/#findComment-902654 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.