ballhogjoni Posted August 8, 2007 Share Posted August 8, 2007 What does this mean? Column 'fname' in field list is ambiguous this is my code: <?php if (isset($_POST['search_fname'])) { $search_fname = $_POST['search_fname']; $query = "SELECT fname FROM contact_n_questions, dispo_callBack, dispo_client, dispo_demoSetup, dispo_money, dispo_notContacted, dispo_notInterested, dispo_time, dispo_tooSmall WHERE fname = '{$search_fname}'"; $result = mysql_query($query) or die(mysql_error()); if (!mysql_num_rows == "") { while($row = mysql_fetch_array($result) or die(mysql_error())) { echo $row['fname'].'<br>'; } } else { echo 'No Records'; } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/63938-solved-column-fname-in-field-list-is-ambiguous/ Share on other sites More sharing options...
frost Posted August 8, 2007 Share Posted August 8, 2007 SELECT fname FROM contact_n_questions, dispo_callBack, dispo_client, dispo_demoSetup, dispo_money, dispo_notContacted, dispo_notInterested, dispo_time, dispo_tooSmall WHERE fname = '{$search_fname}' I don't think that is right, it looks like you are trying to select "fname" from a bunch of different tables, why would you want to do that? Can you tell me what you are trying to do? Quote Link to comment https://forums.phpfreaks.com/topic/63938-solved-column-fname-in-field-list-is-ambiguous/#findComment-318705 Share on other sites More sharing options...
ballhogjoni Posted August 8, 2007 Author Share Posted August 8, 2007 I want to find a specific record in the db. The thing is, i don't know which table the record is in. I don't knwo because the records change from one table to next based on certain criteria and that criteria changes on a daily bases. As the criteria changes the record is passed and then deleted from one table to the next. Quote Link to comment https://forums.phpfreaks.com/topic/63938-solved-column-fname-in-field-list-is-ambiguous/#findComment-318709 Share on other sites More sharing options...
effigy Posted August 8, 2007 Share Posted August 8, 2007 It means the fname column exists in more than one table. You need to specify which with the table_name. prefix. Quote Link to comment https://forums.phpfreaks.com/topic/63938-solved-column-fname-in-field-list-is-ambiguous/#findComment-318713 Share on other sites More sharing options...
frost Posted August 8, 2007 Share Posted August 8, 2007 Ah, ok, well what about the curly brackets - {$search_fname} - are those needed? (I am obviously not an expert, just pointing out things that look out of place). This might be your solution - http://sqlzoo.net/howto/source/z.dir/err918/mysql - looks like you might need to join the tables? Let me know if that works. Quote Link to comment https://forums.phpfreaks.com/topic/63938-solved-column-fname-in-field-list-is-ambiguous/#findComment-318716 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.