iPixel Posted October 27, 2009 Share Posted October 27, 2009 Ok i've got a table with a field called "terminated". 0 = employed, 1 = byebye Here's the query <?php $emp_list_query = "SELECT firstname, lastname FROM table_ad WHERE manager = '$wholename' AND terminated = '0' ORDER BY firstname ASC LIMIT 0, 11"; ?> This causes a syntax error near 'terminated. My assumption is because of the work which is probably a predefined MySQL function or something. I've tried placing the fieldname 'terminated' into single quotes but that just doesnt return anything at all. No error, but no data either. What's the deal here? Quote Link to comment https://forums.phpfreaks.com/topic/179243-solved-mysqlphp-query-issue/ Share on other sites More sharing options...
mikesta707 Posted October 27, 2009 Share Posted October 27, 2009 try it without the quotes around 0. its probably an integer column, and single quotes means a string Quote Link to comment https://forums.phpfreaks.com/topic/179243-solved-mysqlphp-query-issue/#findComment-945696 Share on other sites More sharing options...
ashton321 Posted October 27, 2009 Share Posted October 27, 2009 Not sure if this is the error, but I believ that you don't need ' ' numbers, in your case the 0. Quote Link to comment https://forums.phpfreaks.com/topic/179243-solved-mysqlphp-query-issue/#findComment-945697 Share on other sites More sharing options...
iPixel Posted October 27, 2009 Author Share Posted October 27, 2009 'terminated' = 0 ORDER BY... This causes no errors, but still retreives data where terminated = 1. what's really weird is that on other pages i use WHERE terminated = '0' and that work. It's just this page that's giving me syntax errors. Quote Link to comment https://forums.phpfreaks.com/topic/179243-solved-mysqlphp-query-issue/#findComment-945700 Share on other sites More sharing options...
ashton321 Posted October 27, 2009 Share Posted October 27, 2009 Try no quotes around terminated Quote Link to comment https://forums.phpfreaks.com/topic/179243-solved-mysqlphp-query-issue/#findComment-945702 Share on other sites More sharing options...
iPixel Posted October 27, 2009 Author Share Posted October 27, 2009 LOL forgive me i'm an idiot. I was looking at the wrong database. Grrr... too much crap going on haha! I'm losing it. Quote Link to comment https://forums.phpfreaks.com/topic/179243-solved-mysqlphp-query-issue/#findComment-945703 Share on other sites More sharing options...
mikesta707 Posted October 27, 2009 Share Posted October 27, 2009 let me get this straight. when you put WHERE teminated=0 it retrieves the rows that have terminated with a value of 1. that doesn't make any sense. are you sure the fields in your database are how you expect them to me EDIT: ok i was about to say Quote Link to comment https://forums.phpfreaks.com/topic/179243-solved-mysqlphp-query-issue/#findComment-945706 Share on other sites More sharing options...
ashton321 Posted October 27, 2009 Share Posted October 27, 2009 Ha done that and similiar things many times! Quote Link to comment https://forums.phpfreaks.com/topic/179243-solved-mysqlphp-query-issue/#findComment-945707 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.