Jump to content

Recommended Posts

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';
		}
	}
	?>

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?

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.

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.

 

 

 

 

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.