0
<?php
$sitename = "xxxxxx";

$link = mysql_connect("xxxxxxxx", "xxxxxxxx", "xxxxxxxx");

$db_selected = mysql_select_db('xxxxxx', $link);

mysql_query("SET NAMES utf8");

function fetchinfo($rowname,$tablename,$finder,$findervalue) {

    if($finder == "1") $result = mysql_query("SELECT $rowname FROM $tablename");

    else $result = mysql_query("SELECT $rowname FROM $tablename WHERE `$finder`='$findervalue'");

        $row = mysql_fetch_assoc($result);

    return $row[$rowname];
}
?>

Im getting error from the line else $result = mysql_query("SELECT $rowname FROM $tablename WHERE$finder='$findervalue'"); ive searched little around but i didnt seem to work (also its my first time posting so sorry if it looks bad

Script47
  • 14,230
  • 4
  • 45
  • 66
  • 1
    Before you break your head with that issue, you should migrate to **PDO** instead of using **deprecated** mysql_* functions. They will be removed as of PHP 7. – Charlotte Dunois Aug 24 '15 at 19:48
  • 4
    That means one of three things: (1) You didn't specify a password, but should have. (2) That account doesn't have SELECT privileges. (3) Something else is wrong - but not with the shown code, but your local setup, which we can't help with. – mario Aug 24 '15 at 19:49
  • 2
    If you can, you should [stop using `mysql_*` functions](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php). They are no longer maintained and are [officially deprecated](https://wiki.php.net/rfc/mysql_deprecation). Learn about [prepared](http://en.wikipedia.org/wiki/Prepared_statement) [statements](http://php.net/manual/en/pdo.prepared-statements.php) instead, and consider using PDO, [it's really not hard](http://jayblanchard.net/demystifying_php_pdo.html). – Jay Blanchard Aug 24 '15 at 19:55
  • Thank you for answer. Its weird when i log in with a proxy to my site everything works fine – WanderScar Aug 25 '15 at 05:21

0 Answers0