Jump to content

Why does SQL work on my desktop and not on my server?


benphp

Recommended Posts

I'm pulling my hair out.

 

Server: 4.0.26-nt

Desktop: 5.0.51b-community-nt

 

Tables are identical on both servers:

+---------+-------------+------+-----+---------+----------------+
| Field   | Type        | Null | Key | Default | Extra          |
+---------+-------------+------+-----+---------+----------------+
| rid     | int(11)     | NO   | PRI | NULL    | auto_increment |
| pid     | int(11)     | YES  |     | NULL    |                |
| qid     | int(11)     | YES  |     | NULL    |                |
| uid     | int(11)     | YES  |     | NULL    |                |
| score   | varchar(2)  | YES  |     | NULL    |                |
| ractive | varchar(1)  | YES  |     | NULL    |                |
| shift   | varchar(2)  | YES  |     | NULL    |                |
| rcount  | varchar(4)  | YES  |     | NULL    |                |
| moddate | varchar(20) | YES  |     | NULL    |                |
+---------+-------------+------+-----+---------+----------------+

 

Code is identical:

<?php
$selectR = "
select r1.score, r1.moddate, r1.rcount, r1.uid
from resp r1
where r1.rcount = (
    select r2.rcount
    from resp r2
    where r2.uid=r1.uid
ORDER BY r2.rcount DESC LIMIT 1
    )
";
?>

 

One works, and the other gives me "Fatal error: SQL in ..."

 

?????

 

line 285:

$resultR = mysql_query($selectR) or trigger_error("SQL", E_USER_ERROR);

 

It's the PHP error. The MySQL error is a MySQL error, which I didn't post.

 

The problem lay in the MySQL versions. I upgraded the server to 5x and it fixed the problem, although I don't see what the problem was in the SQL.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.