Christian F. Posted January 18, 2013 Share Posted January 18, 2013 That looks right, yes. Tried running it? PS: Remember to take a backup of your data, if you don't already have one, just in case. Quote Link to comment Share on other sites More sharing options...
Taku Posted January 18, 2013 Author Share Posted January 18, 2013 I did and the record is not updated Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted January 18, 2013 Share Posted January 18, 2013 last line should read WHERE flav IN(cafelatte,chocolate,cremebrulee)" Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 18, 2013 Share Posted January 18, 2013 I think you guys need to quote some strings, unless you're actually trying to use column names. which I don't think you can do in an IN clause... Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted January 18, 2013 Share Posted January 18, 2013 yeah, you're probbly right on that one Quote Link to comment Share on other sites More sharing options...
Christian F. Posted January 18, 2013 Share Posted January 18, 2013 LOL! Talk about missing the obvious. Thanks for pointing that out, Jessica. Quote Link to comment Share on other sites More sharing options...
Taku Posted January 18, 2013 Author Share Posted January 18, 2013 otl T_T I feel so noob err Quote Link to comment Share on other sites More sharing options...
Taku Posted January 18, 2013 Author Share Posted January 18, 2013 if(isset($_POST['Edit'])) { echo "Success"; $u_cl = mysql_real_escape_string($_POST['clt']); $u_c = mysql_real_escape_string($_POST['ct']); $u_cb = mysql_real_escape_string($_POST['cbt']); $u_cc = mysql_real_escape_string($_POST['cct']); if(!$u_cl OR !$u_c OR !$u_cb OR !$u_cc) { echo '<script type="text/javascript">alert("Please fill up the form")</script>'; require "custodian_edit.php"; } else { $query1 = "UPDATE $tbl_name SET Cafe_Latte='$u_cl', Chocolate='$u_c', Creme_Brulee='$u_cb', Cookies_Cream='$u_cc' WHERE inven_id = 1"; mysql_query($query1) or die('error'.mysql_error().'in query'.$SQL); echo "Record Update"; } } anyone knows what I did wrong? I am trying to update the 1st row and it is not working... Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 18, 2013 Share Posted January 18, 2013 Define not working. Did you get the error? Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted January 18, 2013 Share Posted January 18, 2013 and while you define not working, you may also want to define $tbl_name.... Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 18, 2013 Share Posted January 18, 2013 and while you define not working, you may also want to define $tbl_name.... I was going to ask that, but if it were undefined it should trigger the error, printing out the SQL, making it obvious. Quote Link to comment Share on other sites More sharing options...
Taku Posted January 18, 2013 Author Share Posted January 18, 2013 hahahaha must be sleepy sorry guys \o\ Quote Link to comment Share on other sites More sharing options...
Taku Posted January 18, 2013 Author Share Posted January 18, 2013 tnx so much Christian, Muddy and Jessica all are working now haha tnx so much \o\ 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.