Wednesday, 15 June 2011

PHP and MySQL, Query works in one not the other -



PHP and MySQL, Query works in one not the other -

i have query works in phpmyadmin not when beingness run through php

this query:

delete 'table' 'id' not in ( select distinct id ( select * 'table' order scoredesc limit 10 ) foo)

basically, sorts table score descending , keeps top 10 , deletes rest. can run fine trough phpmyadmin php code says no

this php script:

function add_highscore() { mysql_query("delete highscores id not in ( select distinct id ( select * highscores order score desc limit 10 ) foo)") or die('0'); echo "1"; mysql_close($table_id); }

there no problems connection, have more functions in script works.

any ideas? help appreciated!

cheers, jon

add top of script:

error_reporting(e_all);

and replace:

die('0');

with:

die(mysql_error());

and should help indicate variety of 'not working' script is.

php mysql mysqli

No comments:

Post a Comment