php-general Digest 28 May 2006 22:49:41 -0000 Issue 4153
Topics (messages 237015 through 237018):
Column 'movie_type_id' in order clause is ambiguous
237015 by: Mark Sargent
237016 by: cajbecu
237017 by: M. Sokolewicz
Best way to save reports, comments and suggestions welcome
237018 by: Ryan A
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
php-general@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
Hi All,
I get this,
Column 'movie_type_id' in order clause is ambiguous
for this code,
$query = "SELECT movie.movie_name, movietypes.movie_type_label FROM
movie, movietypes WHERE movie.movie_type_id = movietypes.movie_type_id
AND movie_year>1990 ORDER BY movie_type_id";
$results=mysql_query($query) or die(mysql_error());
and here is the table structure,
mysql> SELECT * FROM movie;
+----------+----------------+---------------+------------+---------------------+-------------------+
| movie_id | movie_name | movie_type_id | movie_year |
movie_lead_actor_id | movie_director_id |
+----------+----------------+---------------+------------+---------------------+-------------------+
| 1 | Bruce Almighty | 5 | 2003
| 1 | 2 |
| 2 | Office Space | 5 | 1999
| 5 | 6 |
| 3 | Grand Canyon | 2 | 1991
| 4 | 3 |
+----------+----------------+---------------+------------+---------------------+-------------------+
3 rows in set (0.00 sec)
mysql> SELECT * FROM movietypes;
+---------------+------------------+
| movie_type_id | movie_type_label |
+---------------+------------------+
| 1 | Sci Fi |
| 2 | Drama |
| 3 | Adventure |
| 4 | War |
| 5 | Comedy |
| 6 | Horror |
| 7 | Action |
| 8 | Kids |
+---------------+------------------+
8 rows in set (0.00 sec)
A Google search for the error gave nothing.
Cheers.
Mark Sargent.
--- End Message ---
--- Begin Message ---
Hello,
Try ... ORDER BY `movie`.`movie_type_id`;
Mark Sargent wrote:
> Hi All,
>
> I get this,
>
> Column 'movie_type_id' in order clause is ambiguous
>
> for this code,
>
> $query = "SELECT movie.movie_name, movietypes.movie_type_label FROM
> movie, movietypes WHERE movie.movie_type_id = movietypes.movie_type_id
> AND movie_year>1990 ORDER BY movie_type_id";
> $results=mysql_query($query) or die(mysql_error());
>
> and here is the table structure,
>
> mysql> SELECT * FROM movie;
> +----------+----------------+---------------+------------+---------------------+-------------------+
>
> | movie_id | movie_name | movie_type_id | movie_year |
> movie_lead_actor_id | movie_director_id |
> +----------+----------------+---------------+------------+---------------------+-------------------+
>
> | 1 | Bruce Almighty | 5 | 2003
> | 1 | 2 |
> | 2 | Office Space | 5 | 1999
> | 5 | 6 |
> | 3 | Grand Canyon | 2 | 1991
> | 4 | 3 |
> +----------+----------------+---------------+------------+---------------------+-------------------+
>
> 3 rows in set (0.00 sec)
>
> mysql> SELECT * FROM movietypes;
> +---------------+------------------+
> | movie_type_id | movie_type_label |
> +---------------+------------------+
> | 1 | Sci Fi |
> | 2 | Drama |
> | 3 | Adventure |
> | 4 | War |
> | 5 | Comedy |
> | 6 | Horror |
> | 7 | Action |
> | 8 | Kids |
> +---------------+------------------+
> 8 rows in set (0.00 sec)
>
> A Google search for the error gave nothing.
>
> Cheers.
>
> Mark Sargent.
>
--- End Message ---
--- Begin Message ---
What part of "This is a PHP list" and "This is not a mysql list" do you
not understand?
*TRY A MYSQL MAILINGLIST, or RTFM (mysql manual in this case)*
Mark Sargent wrote:
Hi All,
I get this,
Column 'movie_type_id' in order clause is ambiguous
for this code,
$query = "SELECT movie.movie_name, movietypes.movie_type_label FROM
movie, movietypes WHERE movie.movie_type_id = movietypes.movie_type_id
AND movie_year>1990 ORDER BY movie_type_id";
$results=mysql_query($query) or die(mysql_error());
and here is the table structure,
mysql> SELECT * FROM movie;
+----------+----------------+---------------+------------+---------------------+-------------------+
| movie_id | movie_name | movie_type_id | movie_year |
movie_lead_actor_id | movie_director_id |
+----------+----------------+---------------+------------+---------------------+-------------------+
| 1 | Bruce Almighty | 5 | 2003
| 1 | 2 |
| 2 | Office Space | 5 | 1999
| 5 | 6 |
| 3 | Grand Canyon | 2 | 1991
| 4 | 3 |
+----------+----------------+---------------+------------+---------------------+-------------------+
3 rows in set (0.00 sec)
mysql> SELECT * FROM movietypes;
+---------------+------------------+
| movie_type_id | movie_type_label |
+---------------+------------------+
| 1 | Sci Fi |
| 2 | Drama |
| 3 | Adventure |
| 4 | War |
| 5 | Comedy |
| 6 | Horror |
| 7 | Action |
| 8 | Kids |
+---------------+------------------+
8 rows in set (0.00 sec)
A Google search for the error gave nothing.
Cheers.
Mark Sargent.
--- End Message ---
--- Begin Message ---
Hi,
I have to write a kind of logging script which will
keep records of how long a person used the site and
its functions, so far this is what I have come up
with:
login_username varchar(50)
as_guide <- You can ignore this,its for a special func
login_time timestamp
logout_time timestamp
this_session_inlogged_time float
this_month timestamp
this_year timestamp
sum_total_time_inlogged varchar or float
Any suggestions on changing any of the above, adding
fields or changing types?
I am not 100% sure of the timestamp type for most of
the fields.
Any URLs,code examples or pointers to specific parts
of the manual would be appreciated too.
Thanks!
Ryan
------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--- End Message ---