| | |
Problem with ORDER BY LIMIT in MySQL 4.1.22
Please support our Perl advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jun 2009
Posts: 1
Reputation:
Solved Threads: 0
Hello. I am new and hope to find an answer to my query.
I run a classified database and have been doing so for quite a few years, I recently upgraded the Plesk CP on my server and suddenly a problem appeared with the way the DB is returning the queries.
I am currently running Perl 5 with MySQL 4.1.22
My old code was like this (trimmed code for simplification):
The above used to work flawlessly, but since I upgraded the CP, the database stoped listing the adverts according to "order_by" and apparently listing them in icremental order from the db.
I had to correct the code like this to sort it out:
I tried everything before arriving this this solution like puttingthe ? in quotes, removing the quotes around $order_by in the execute->() but nothing worked.
I am quite puzzled by this and having done some research on the web I initially though that it was caused by a MySQL bug affecting ODRER BY with LIMIT in certain JOIN operation, but this is nothing of the sort.
I am fairly shure that it is down to the CP upgrade as no activities took place other than the Control Panel upgrade (to Plesk 8.6 from 8.4)
Any feedback about this could be useful.
Many thanks.
I run a classified database and have been doing so for quite a few years, I recently upgraded the Plesk CP on my server and suddenly a problem appeared with the way the DB is returning the queries.
I am currently running Perl 5 with MySQL 4.1.22
My old code was like this (trimmed code for simplification):
perl Syntax (Toggle Plain Text)
use DBI; $dbh = DBI->connect ("DBI:mysql:host=localhost;database=$SQL_DATABASE_NAME", "$SQL_DATABASE_USERNAME", "$SQL_DATABASE_PASSWORD", {printError => 0}) or die "Cannot connect to server: $DBI::errstr (DBI::err)"; $order_by = "token_key" if (!$order_by); $sth = $dbh->prepare (qq~SELECT * FROM $adverts_database WHERE MATCH (advert_title,pedigree,text,area) ORDER BY ? $show LIMIT $length~); $sth->execute("$order_by");
The above used to work flawlessly, but since I upgraded the CP, the database stoped listing the adverts according to "order_by" and apparently listing them in icremental order from the db.
I had to correct the code like this to sort it out:
perl Syntax (Toggle Plain Text)
$sth = $dbh->prepare (qq~SELECT * FROM $adverts_database WHERE MATCH (advert_title,pedigree,text,area) ORDER BY token_key $show LIMIT $length~); $sth->execute();
I tried everything before arriving this this solution like puttingthe ? in quotes, removing the quotes around $order_by in the execute->() but nothing worked.
I am quite puzzled by this and having done some research on the web I initially though that it was caused by a MySQL bug affecting ODRER BY with LIMIT in certain JOIN operation, but this is nothing of the sort.
I am fairly shure that it is down to the CP upgrade as no activities took place other than the Control Panel upgrade (to Plesk 8.6 from 8.4)
Any feedback about this could be useful.
Many thanks.
![]() |
Similar Threads
- Order By Group By Distinct Problem (MySQL)
- Error using LIMIT in MySQL (PHP)
- problem passing a NULL value to MySQL using a php variable (PHP)
- number game (Python)
- 5 star rating system messes up my numbers (PHP)
- Problem with INSERT command into MySQL (PHP)
- pagination problem (PHP)
- Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource (PHP)
- mysq_query on 2 dbs .. ? (PHP)
Other Threads in the Perl Forum
- Previous Thread: Create tar or gz file
- Next Thread: Assist with code.
| Thread Tools | Search this Thread |





