Page 1 of 1

[SOLVED]ambiguous??please help...

Posted: Wed Jul 06, 2005 5:48 am
by pleigh
another error...code below:

Code: Select all

<?            
$id = $_GET['pid'];
$fn = $_SESSION['firstname'];
$uid = $_SESSION['userID'];        
            
$query = "SELECT projecttitle, location firstname FROM projects AS p, profile AS pr
WHERE p.userID = pr.userID AND projectID='$id'";
$result = @mysql_query($query);
        
if ($result)
{
$row = mysql_fetch_array($result, MYSQL_NUM);

echo "
    <table width=100% border=1>
  
  <tr>
    <td width=20%><b/>Project Title</td>
    <td width=80%>$row[0]</td>
  </tr>
  <tr>
    <td width=20%><b/>Project Title</td>
    <td width=80%>$row[1]&'pid'];
$fn = $_SESSION['firstname'];
$uid = $_SESSION['userID'];        
            
$query = "SELECT projecttitle, location firstname FROM projects AS p, profile AS pr
WHERE p.userID = pr.userID AND projectID='$id'";
$result = @mysql_query($query);
        
if ($result)
{
$row = mysql_fetch_array($result, MYSQL_NUM);

echo "
    <table width=100% border=1>
  
  <tr>
    <td width=20%><b/>Project Title</td>
    <td width=80%>$row[0]</td>
  </tr>
  <tr>
    <td width=20%><b/>Project Title</td>
    <td width=80%>$row[1]</td>
  </tr>
";
}
else
{
    echo 'system error!<br>'.mysql_error();
}
error is
Column 'location' in field list is ambiguous
[/quote:ef746082dE p.userID = pr.userID AND projectID='$id'";
$result = @mysql_query($query);

if ($result)
{
$row = mysql_fetch_array($result, MYSQL_NUM);

echo &quote;
&lt;table width=100% border=1&gt;

&lt;tr&gt;
&lt;td width=20%&gt;&lt;b/&gt;Project Title&lt;/td&gt;
&lt;td width=80%&gt;$rowї0]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=20%&gt;&lt;b/&gt;Project Title&lt;/td&gt;
&lt;td width=80%&gt;$rowї1]&lt;/td&gt;
&lt;/tr&gt;
&quote;;
}
else
{
me'];
$uid = $_SESSION['userID'];

$query = "SELECT projecttitle, location firstname FROM projects AS p, profile AS pr
WHERE p.userID = pr.userID AND projectID='$id'&quote;;
$result = @mysql_query($query);

if ($result)
{
$row = mysql_fetch_array($result, MYSQL_NUM);

echo &quote;
&lt;table width=100% border=1&gt;

&lt;tr&gt;
&lt;td width=20%&gt;&lt;b/&gt;Project Title&lt;/td&gt;
&lt;td width=80%&gt;$rowї0]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=20%&gt;&lt;b/&gt;Project Title&lt;/td&gt;
&lt;td width=80%&am;amp;lt;?
$id = $_GET['pid'];
$fn = $_SESSION['firstname'];
$uid = $_SESSION['userID'];

$query = "SELECT projecttitle, location firstname FROM projects AS p, profile AS pr
WHERE p.userID = pr.userID AND projectID='$id'&quote;;
$result = @mysql_query($query);

if ($result)
{
$row = mysql_fetch_array($result, MYSQL_NUM);

echo &quote;
&lt;table width=100% border=1&gt;

&lt;tr&gt;
&lt;td width=20%&gt;&lt;b/&gt;Project Title&lt;/td&gt;
&lt;td width=80%&gt;$rowї0]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=20%&gt;&lt;b/&gt;Project Title&lt;/td&gt;
&lt;td width=80%&gt;$rowї1]&lt;/td&gt;
&lt;/tr&gt;
&quote;;
}
else
{
de below:

Code: Select all

<?            
$id = $_GET['pid'];
$fn = $_SESSION['firstname'];
$uid = $_SESSION['userID'];        
            
$query = "SELECT projecttitle, location firstname FROM projects AS p, profile AS pr
WHERE p.userID = pr.userID AND projectID='$id'&quote;;
$result = @mysql_query($query);
        
if ($result)
{
$row = mysql_fetch_array($result, MYSQL_NUM);

echo &quote;
    &lt;table width=100% border=1&gt;
  
  &lt;tr&gt;
    &lt;td width=20%&gt;&lt;b/&gt;Project Title&lt;/td&gt;
    &lt;td width=80%&gt;$row&#1111;0]&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td width=20%&gt;&lt;b/&gt;Project Title&lt;/td&gt;
    &lt;td width=80%&gt;$row&#1111;1]&lt;/td&gt;
  &lt;/tr&gt;
&quote;;
}
else
{
    echo 'system error!&lt;br&de below:

Code: Select all

<?            
$id = $_GET['pid'];
$fn = $_SESSION['firstname'];
$uid = $_SESSION['userID'];        
            
$query = "SELECT projecttitle, location firstname FROM projects AS p, profile AS pr
WHERE p.userID = pr.userID AND projectID='$id'&quote;;
$result = @mysql_query($query);
        
if ($result)
{
$row = mysql_fetch_array($result, MYSQL_NUM);

echo &quote;
    &lt;table width=100% border=1&gt;
  
  &lt;tr&gt;
    &lt;td width=20%&gt;&lt;b/&gt;Project Title&lt;/td&gt;
    &lt;td width=80%&gt;$row&#1111;0]&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td width=20%&gt;&lt;b/&gt;Project Title&lt;/td&gt;
    &lt;td width=80%&gt;$row&#1111;1]&lt;/td&gt;
  &lt;/tr&gt;
&quote;;
}
else
{
    echo 'system error!&lt;br&gt;'.mysql_error();
}
error is = $_SESSION['firstname'];
$uid = $_SESSION['userID'];

$query = "SELECT projecttitle, location firstname FROM projects AS p, profile AS pr
WHERE p.userID = pr.userID AND projectID='$id'";
$result = @mysql_query($query);

if ($result)
{
$row = mysql_fetch_array($result, MYSQL_NUM);

echo "
<table width=100% border=1>

<tr>
<td width=20%><b/>Project Title</td>
<td width=80%>$row[0]</td>
</tr>
<tr>
<td width=20%><b/>Project Title</td>
<td width=80%>$row[1]</td>
</tr>
";
}
else
{
echo 'system error!<br>'.mysql_error();
}


error is
Column 'location' in field list is ambiguous
what is this??when i try to get the value of the other fields, it is fine...but this location field...

thanx in advancee'];
$uid = $_SESSION['userID'];

$query = &quote;SELECT projecttitle, location firstname FROM projects AS p, profile AS pr
WHERE p.userID = pr.userID AND projectID='$id'";
$result = @mysql_query($query);

if ($result)
{
$row = mysql_fetch_array($result, MYSQL_NUM);

echo &quote;
&lt;table width=100% border=1&gt;

&lt;tr&gt;
&lt;td width=20%&gt;&lt;b/&gt;Project Title&lt;/td&gt;
&lt;td width=80%&gt;$rowї0]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=20%&gt;&lt;b/&gt;Project Title&lt;/td&gt;
&lt;td width=80%1]
<?
$id = $_GET['pid'];
$fn = $_SESSION['firstname'];
$uid = $_SESSIONї'userID'];

$query = &quote;SELECT projecttitle, location firstname FROM projects AS p, profile AS pr
WHERE p.userID = pr.userID AND projectID='$id'";
$result = @mysql_query($query);

if ($result)
{
$row = mysql_fetch_array($result, MYSQL_NUM);

echo "
<table width=100% border=1&gt;

&lt;tr&gt;
<td width=20%><b/>Project Title</td>
<td width=80%>$row[0]</td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=20%&gt;&lt;b/&gt;Project Title&lt;/td&gt;
&lt;td width=80%&gt;$rowї1]&lt;$result = @mysql_query($query);

if ($result)
{
$row = mysql_fetch_array($result, MYSQL_NUM);

echo "
<table width=100% border=1>

<tr>
<td width=20%><b/>Project Title</td>
<td width=80%>$row[0]</td>
</tr>
<tr>
<td width=20%><b/>Project Title</td>
<td width=80%>$row[1]</td>
</tr>
";
}
else
{
echo 'system error!<br>'.mysql_error();
}


error is
Column 'location' in field list is ambiguous
what is this??when i try to get the value of the other fields, it is fine...but this location field...

thanx in advancet;?
$id = $_GET['pid'];
$fn = $_SESSIONї'firstname'];
$uid = $_SESSIONї'userID'];

$query = &quote;SELECT projecttitle, location firstname FROM projects AS p, profile AS pr
WHERE p.userID = pr.userID AND projectID='$id'&quote;;
$result = @mysql_query($query);

if ($result)
{
$row = mysql_fetch_array($result, MYSQL_NUM);

echo &quote;
&lt;table width=100% border=1&gt;

&lt;tr&gt;
&lt;td width=20%&gt;&lt;b/&gt;Project Title&lt;/td&gt;
&lt;td width=80%&gt;$rowї0]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=20%&gt;&lt;b/&gt;Project Title&lt;/td&gt;
&lt;td width=80%&gt;$rowї1]&lt;/td&gt;
&lt;/tr&gt;
&quote;;
}
else
{
echo 'system error!&lt;br&gt;'.mysql_error();
}


error is
Column 'location' in field list is ambiguous
what is this??when i try to get the value of the other fields, it is fine...but this location field...

thanx in advance'$id'";
$result = @mysql_query($query);

if ($result)
{
$row = mysql_fetch_array($result, MYSQL_NUM);

echo "
<table width=100% border=1>

<tr>
<td width=20%><b/>Project Title</td>
<td width=80%>$row[0]</td>
</tr>
<tr>
<td width=20%><b/>Project Title</td>
<td width=80%>$row[1]</td>
</tr>
";
}
else
{
echo 'system error!<br>'.mysql_error();
}


error is
Column 'location' in field list is ambiguous
what is this??when i try to get the value of the other fields, it is fine...but this location field...

thanx in advanceION['userID'];

$query = "SELECT projecttitle, location firstname FROM projects AS p, profile AS pr
WHERE p.userID = pr.userID AND projectID='$id'&quote;;
$result = @mysql_query($query);

if ($result)
{
$row = mysql_fetch_array($result, MYSQL_NUM);

echo &quote;
&lt;table width=100% border=1&gt;

&lt;tr&gt;
&lt;td width=20%&gt;&lt;b/&gt;Project Title&lt;/td&gt;
&lt;td width=80%&gt;$rowї0]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=20%&gt;&lt;b/&gt;Project Title&lt;/td&gt;
&lt;td width=80%&gt;$rowї1]&lt;/td&gt;
&lt;/tr&gt;
&quote;;
}
else
{
echo 'system error!&lt;br&gt;'.mysql_error();
}


error is
C $_GET['pid'];
$fn = $_SESSION['firstname'];
$uid = $_SESSIONї'userID'];

$query = &quote;SELECT projecttitle, location firstname FROM projects AS p, profile AS pr
WHERE p.userID = pr.userID AND projectID='$id'&quote;;
$result = @mysql_query($query);

if ($result)
{
$row = mysql_fetch_array($result, MYSQL_NUM);

echo &quote;
&lt;table width=100% border=1&gt;

&lt;tr&gt;
&lt;td width=20%&gt;&lt;b/&gt;Project Title&lt;/td&gt;
&lt;td width=80%&gt;$rowї0]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=20%&gt;&lt;b/&gt;Project Title&lt;/td&gt;
&lt;td width=80%&gt;$rowї1]&lt;/td&gt;
&lt;/tr&gt;
&quote;;
}
else
{
echo 'system error!&lt;br&gt;'.mysql_error();
}


error is
Column 'location' in field list is ambiguous
[/quote:de below:

Code: Select all

<?            
$id = $_GET['pid'];
$fn = $_SESSION['firstname'];
$uid = $_SESSION['userID'];        
            
$query = "SELECT projecttitle, location firstname FROM projects AS p, profile AS pr
WHERE p.userID = pr.userID AND projectID='$id'";
$result = @mysql_query($query);
        
if ($result)
{
$row = mysql_fetch_array($result, MYSQL_NUM);

echo "
    <table width=100% border=1>
  
  <tr>
    <td width=20%><b/>Project Title</td>
    <td width=80%>$row[0]</td>
  </tr>
  <tr>
    <td width=20%><b/>Project Title</td>
    <td width=80%>$row[1]</td>
  </tr>
";
}
else
{
    echo 'system error!<br>'.mysql_error();
}
error is
what is this??when i try to get the value of the other fields, it is fine...but this location field...

thanx in advance
$id = $_GET['pid'];
$fn = $_SESSION['firstname'];
$uid = $_SESSION['userID'];

$query = "SELECT projecttitle, location firstname FROM projects AS p, profile AS pr
WHERE p.userID = pr.userID AND projectID='$id'&quote;;
$result = @mysql_query($query);

if ($result)
{
$row = mysql_fetch_array($result, MYSQL_NUM);

echo &quote;
&lt;table width=100% border=1&gt;

&lt;tr&gt;
&lt;td width=20%&gt;&lt;b/&gt;Project Title&lt;/td&gt;
&lt;td width=80%&gt;$rowї0]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=20%&gt;&lt;b/&gt;Project Title&lt;/td&gt;
&lt;td width=80%&gt;$rowї1]&lt;/td&gt;
&lt;/tr&gt;
&quote;;
}
else
{
echo 'system error!&lt;br&gt;'.mysql_error();
}


error is
what is this??when i try to get the value of the other fields, it is fine...but this location fLECT projecttitle, location firstname FROM projects AS p, profile AS pr
WHERE p.userID = pr.userID AND projectID='$id'";
$result = @mysql_query($query);

if ($result)
{
$row = mysql_fetch_array($result, MYSQL_NUM);

echo "
<table width=100% border=1>

<tr>
<td width=20%><b/>Project Title</td>
<td width=80%>$row[0]</td>
</tr>
<tr>
<td width=20%><b/>Project Title</td>
<td width=80%>$row[1]</td>
</tr>
";
}
else
{
echo 'system error!<br>'.mysql_error();
}


error is
what is this??when i try to get the value of the other fields, it is fine...but this location field...

thanx in advancede below:

Code: Select all

<?            
$id = $_GET['pid'];
$fn = $_SESSION['firstname'];
$uid = $_SESSION['userID'];        
            
$query = "SELECT projecttitle, location firstname FROM projects AS p, profile AS pr
WHERE p.userID = pr.userID AND projectID='$id'";
$result = @mysql_query($query);
        
if ($result)
{
$row = mysql_fetch_array($result, MYSQL_NUM);

echo "
    <table width=100% border=1>
  
  <tr>
    <td width=20%><b/>Project Title</td>
    <td width=80%>$c]
<?            
$id = $_GET['pid'];
$fn = $_SESSION['firstname'];
$uid = $_SESSION['userID'];        
            
$query = "SELECT projecttitle, location firstname FROM projects AS p, profile AS pr
WHERE p.userID = pr.userID AND projectID='$id'";
$result = @mysql_query($query);
        
if ($result)
{
$row = mysql_fetch_array($result, MYSQL_NUM);

echo "
    <table width=100% border=1>
  
  <tr>
    <td width=20%><b/>Project Title</td>
    <td width=80%>$row[0]</td>
  </tr>
  <tr>
    <td width=20%><b/>Project Title</td>
    <td width=80%>$row[1]</td>
  </tr>
";
}
else
{
    echo 'system error!<br>'.mysql_error();
}
error is
what is this$_SESSION['firstname'];
$uid = $_SESSION['userID'];

$query = &quote;SELECT projecttitle, location firstname FROM projects AS p, profile AS pr
WHERE p.userID = pr.userID AND projectID='$id'&quote;;
$result = @mysql_query($query);

if ($result)
{
$row = mysql_fetch_array($result, MYSQL_NUM);

echo &quote;
&lt;table width=100% border=1&gt;

&lt;tr&gt;
&lt;td width=20%&gt;&lt;b/&gt;Project Title&lt;/td&gt;
&lt;td width=80%&gt;$rowї0]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=20%&gt;&lt;b/&gt;Project Title&lt;/td&gt;
&lt;td width=80%&gt;$rowї1]&lt;/td&gt;
&lt;/tr&gt;
&quote;;
}
else
{
echo 'system error!&lt;br&gt;'.mysql_error();
}


error is
what#1111;'firstname'];
$uid = $_SESSION['userID'];

$query = "SELECT projecttitle, location firstname FROM projects AS p, profile AS pr
WHERE p.userID = pr.userID AND projectID='$id'&quote;;
$result = @mysql_query($query);

if ($result)
{
$row = mysql_fetch_array($result, MYSQL_NUM);

echo &quote;
&lt;table width=100% border=1&gt;

&lt;tr&gt;
&lt;td width=20%&gt;&lt;b/&gt;Project Title&lt;/td&gt;
&lt;td width=80%&gt;$rowї0]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=20%&gt;&lt;b/&gt;Project Title&lt;/td&gt;
&lt;td width=80%&gt;$rowї1]&lt;/td&gt;
&lt;/tr&gt;
&quote;;
}
elde below:

Code: Select all

<?            
$id = $_GET['pid'];
$fn = $_SESSION['firstname'];
$uid = $_SESSION['userID'];        
            
$query = "SELECT projecttitle, location firstname FROM projects AS p, profile AS pr
WHERE p.userID = pr.userID AND projectID='$id'";
$result = @mysql_query($query);
        
if ($result)
{
$row = mysql_fetch_array($result, MYSQL_NUM);

echo "
    <table width=100% border=1>
  
  <tr>
    <td width=20%><b/>Project Title</td>
    <td width=80%>$row[0]</td>
  </tr>
  <tr>
    <td width=20%><b/>Project Title</td>
    <td width=80%>$row[1]</td>
  </tr>
";
}
else
{
    echo 'system error!<br>'.mysql_error();
}
error is
what is this??wh#1111;'userID'];

$query = "SELECT projecttitle, location firstname FROM projects AS p, profile AS pr
WHERE p.userID = pr.userID AND projectID='$id'";
$result = @mysql_query($query);

if ($result)
{
$row = mysql_fetch_array($result, MYSQL_NUM);

echo "
<table width=100% border=1>

<tr>
<td width=20%><b/>Project Title</td>
<td width=80%>$row[0]</td>
</tr>
<tr>
<td width=20%><b/>Project Title</td>
<td width=80%>$row[1]</td>
</tr>
";
}
else
{
echo 'system error!&lt;br&gt;'.mysql_error();
}


error is
what is this??when i try to get the value of the other fields, it is fine...but this location field...

projects AS p, profile AS pr
WHERE p.userID = pr.userID AND projectID='$id'";
$result = @mysql_query($query);

if ($result)
{
$row = mysql_fetch_array($result, MYSQL_NUM);

echo "
<table width=100% border=1&gt;

&lt;tr&gt;
&lt;td width=20%&gt;&lt;b/&gt;Project Title&lt;/td&gt;
&lt;td width=80%&gt;$rowї0]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=20%&gt;&lt;b/&gt;Project Title&lt;/td&gt;
&lt;td width=80%&gt;$rowї1]&lt;/td&gt;
&lt;/tr&gt;
&quote;;
}
else
{
echo 'system error!&lt;br&gt;'.mysql_error();
}


error is
what is this??when i try to get= mysql_fetch_array($result, MYSQL_NUM);

echo "
<table width=100% border=1>

<tr>
<td width=20%><b/>Project Title&lt;/td&gt;
&lt;td width=80%&gt;$rowї0]&lt;/td&gt;
&lt;/tr&gt;
&ltlt;?
$id = $_GET['pid'];
$fn = $_SESSION['firstname'];
$uid = $_SESSION['userID'];

$query = "SELECT projecttitle, location firstname FROM projects AS p, profile AS pr
WHERE p.userID = pr.userID AND projectID='$id'";
$result = @mysql_query($query);

if ($result)
{
$row = mysql_fetch_array($result, MYSQL_NUM);

echo "
<table width=100% border=1>

<tr>
<td width=20%><b/>Project Title</td>
<td width=80%>$row[0]</td>
</tr>
<tr>
<td width=20%><b/>Project Title</td>
<td width=80%>$row[1]</td>
</tr>
";
}
else
{
echo 'system error!<br>'.mysql_error();
}


error is
what is this??when i try to get the value of the other fields, it is fine...but this location field...

thanx in advancetle, location firstname FROM projects AS p, profile AS pr
WHERE p.userID = pr.userID AND projectID='$id'&quote;;
$result = @mysql_query($query);

if ($result)
{
$row = mysql_fetch_array($result, MYSQL_NUM);

echo &quote;
&lt;table width=100% border=1&gt;

&lt;tr&gt;
&lt;td width=20%&gt;&lt;b/&gt;Project Title&lt;/td&gt;
&lt;td width=80%&gt;$rowї0]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=20%&gt;&lt;b/&gt;Project Title&lt;/td&gt;
&lt;td width=80%&gt;$rowї1]&lt;/td&gt;
&lt;/tr&gt;
&quote;;
}
else
{
echo 'system error!&lt;br&gt;'.mysql_error();
}
[/php:1:e
<?
$id = $_GET['pid'];
$fn = $_SESSION['firstname'];
$uid = $_SESSION['userID'];

$query = "SELECT projecttitle, location firstname FROM projects AS p, profile AS pr
WHERE p.userID = pr.userID AND projectID='$id'";
$result = @mysql_query($query);

if ($result)
{
$row = mysql_fetch_array($result, MYSQL_NUM);

echo "
<table width=100% border=1>

<tr>
<td width=20%><b/>Project Title</td>
<td width=80%>$row[0]</td>
</tr>
<tr>
<td width=20%><b/>Project Title</td>
<td width=80%>$row[1]</td>
</tr>
";
}
else
{
echo 'system error!<br>'.mysql_error();
}


error is
what is this??when i try to get the value of the other fields, it is fine...but this location field...

thanx in advance

Posted: Wed Jul 06, 2005 5:52 am
by Chris Corbyn

Code: Select all

SELECT projecttitle, location firstname FROM projects AS p, profile AS pr WHERE p.userID = pr.userID AND projectID='$id'
You're missing a comma after location but also, I'm guesing there's a column "location" in another table on this DB? Hence the word used - ambiguous ;) Use the dot syntax `table.column` to get around it (or rename your columns).

Posted: Wed Jul 06, 2005 5:53 am
by harrisonad
it means that both projects and profiles table have field with the same name, 'location'. in order to get rid of this error you have to prefix the name or the alias of the table where you want to get the location field, as in
p.location or pr.location.

Posted: Wed Jul 06, 2005 5:57 am
by pleigh
harrisonad wrote:it means that both projects and profiles table have field with the same name, 'location'. in order to get rid of this error you have to prefix the name or the alias of the table where you want to get the location field, as in
p.location or pr.location.
yeah...i did it and it works fine...thnx a lot guys...