putrisakura Posted February 21, 2009 Share Posted February 21, 2009 I have table investor with field ID, name, payment and so on. the problem now is, I want to display the record based on ID. I used the WHERE clause but it didn't work. Below are some of coding I already tried : "SELECT payment from investor WHERE ID='' "; OR "SELECT payment from investor WHERE ID='%s'" OR "SELECT payment from investor WHERE ID LIKE '' " OR "SELECT payment from investor WHERE ID LIKE '%s' " Any other ideas? all the above coding I used will not display any output at all. Sorry, I could not refer to books coz the library closed for maintainance. Please help me A.S.A.P. Thank u. Quote Link to comment https://forums.phpfreaks.com/topic/146273-problem-with-select-and-where/ Share on other sites More sharing options...
NargsBrood Posted February 21, 2009 Share Posted February 21, 2009 are you getting an error or just no results? is your ID field a numerical or a string? if it is string then: try '%S' vs '%s' Use: SELECT payment FROM invester WHERE ID LIKE '%' if nothing is returned then your table is empty. Quote Link to comment https://forums.phpfreaks.com/topic/146273-problem-with-select-and-where/#findComment-767940 Share on other sites More sharing options...
putrisakura Posted February 22, 2009 Author Share Posted February 22, 2009 there are records in my table but there is no result displayed. I've tried SELECT payment FROM invester WHERE ID LIKE '%' but it display all the data in table. when i tried %S, there is no data displayed. why this can be happened? actually the ID type id varchar. Quote Link to comment https://forums.phpfreaks.com/topic/146273-problem-with-select-and-where/#findComment-768363 Share on other sites More sharing options...
fenway Posted February 23, 2009 Share Posted February 23, 2009 Echo the raw query string... that looks like printf(). Quote Link to comment https://forums.phpfreaks.com/topic/146273-problem-with-select-and-where/#findComment-769058 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.