Jump to content
  • 0

mysql_real_escape_string(): Access denied


spiros

Question

I tried to Enter something in a legacy Extension and I got:

Warning: mysql_real_escape_string(): Access denied for user ''@'localhost' (using password: NO) 

Then I changed all instances to

mysqli_real_escape_string

And retried. At that point I got:

mysqli_real_escape_string() expects exactly 2 parameters, 1 given on line 235

Here is the function:

function Lookup_addLookup ($url, $name, $group)
{
    $dbw = wfGetDB(DB_MASTER);

    $groupOrder = Lookup_getGroupOrder($group);
    $dbw->query ("INSERT INTO ".Lookup_prefix()."lookups (lu_name, lu_url, lu_group, lu_order, lu_group_order) VALUES ('".mysqli_real_escape_string($name)."', '".mysqli_real_escape_string($url)."', '".mysqli_real_escape_string($group)."', 1, $groupOrder)");

    Lookup_reOrderGroups();
    return true;
}

 

Edited by spiros (see edit history)
Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Thank you so much. That gave me:

Quote

Notice: Use of undefined constant  - assumed '' in... on line 234
Notice: Undefined variable: dbw in... on line 234
Fatal error: Call to undefined function insert() in... on line 234

Line 234 is where the snippet provided starts ($dbw - >insert...):

function Lookup_addLookup ($url, $name, $group)
{
	$dbw = wfGetDB(DB_MASTER);

	$dbw->insert( 'lookups', [
	'lu_name' => $name,
	'lu_url' => $url,
	'lu_group' => $group,
	'lu_order' => 1,
	'lu_group_order' => $groupOrder
	] );

	Lookup_reOrderGroups();
	return true;
}

 

Edited by spiros (see edit history)
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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