A: 

http://www.php.net/manual/en/mysqli.real-escape-string.php

mysqli_real_escape_string

Parameters

link

Procedural style only: A link identifier returned by mysqli_connect() or mysqli_init()

escapestr

The string to be escaped.

Characters encoded are NUL (ASCII 0), \n, \r, \, ', ", and Control-Z.

The first parameter must be a link identifier and not a string containing the DB name as it seems to be.

Chouchenos
I saw your comment from Pekka's one. In your `connect.php`, you should have a `$link = mysqli_connect(...)` (or something like that) Use `$link` instead of `$db_name`
Chouchenos
oh...ill try that out..thanks
Johnson
i have edited my post which shows what my connect.php is...thanks again
Johnson
then use `$connect` instead of `$db_name`. It should work.
Chouchenos
I tried that....i am still getting the same error.
Johnson
actually now i am getting mysqli_real_escape_string() expects parameter 1 to be mysqli, resource given in C:\wamp\www\password.php on line 27
Johnson
You changed the 3 `mysqli_real_escape_string` with `mysqli_real_escape_string($connect, somestring);` ? Then do you have a silly `mysqli_close($connect)` somewhere ?
Chouchenos
Oh right, `$connect = @mysql_connect ($host, $username, $password, $db_name) or die ('error');` instead of `$connect = @mysql_connect ($host, $username, $password) or die ('error');` like in the last example of the MANUAL http://www.php.net/manual/en/mysqli.real-escape-string.php
Chouchenos
Yep, I have changed all three with mysqli_real_escape_string($connect,trim($_POST['password1'])); etc...and have removed the mysqli_close...still i have the same issue..thanks
Johnson
okay..i edited my $connect to $connect = @mysql_connect ($host, $username, $password, $db_name) or die ('error');...now what?thank you so much.
Johnson
It shouldn't have anymore errors now... `$connect` is a link identifier and can be the 1st parameter of `mysqli_real_escape_string`
Chouchenos
oh...unfortunately...i am getting the error...i have posted the complete edited password.php and connect.php code..please do have a look.u r great.
Johnson
???????please help me out.
Johnson
Warning: mysqli_real_escape_string() expects parameter 1 to be mysqli, resource given in C:\wamp\www\password.php on line 27Warning: mysqli_real_escape_string() expects parameter 1 to be mysqli, resource given in C:\wamp\www\password.php on line 39Warning: mysqli_real_escape_string() expects parameter 1 to be mysqli, resource given in C:\wamp\www\password.php on line 52The entered username and password do not match.Warning: mysqli_close() expects parameter 1 to be mysqli, resource given in C:\wamp\www\password.php on line 114
Johnson
Duh! How can't I see that !! You're using Mysql_connect and try to use a mysqli function !!! Use `mysqli_connect`. And please, read the manual!
Chouchenos
whoa..using mysqli results in the error "check"...
Johnson
Yeah because : (a) `$select = @mysql_select_db($db_name, $connect) or die('check');` is useless now that you put your db name into the mysqli_connect (b) `$select = @mysql_select_db($db_name, $connect) or die('check');` is a mysql function and `$connect` used inside it is now a mysqli...
Chouchenos
OH GEEZ, THANKS YOU SO VERY MUCH...THE ERRORS ARE GONE...U R A GENIUS...GREAT..VOTE UP FOR BEST ANSWER..THANKS.
Johnson
THERE IS THIS ONE LAST ERROR I AM FACING..EVEN IF THE ENTERED USERNAME AND PASSWORD MATHC...IT SAYS "The entered username and password do not match."
Johnson
No problem, seems like you're starting learning :) BTW, you should'nt use absolute path in includes of your app `include('C:\wamp\www\header.html');` 'cause the path might change when you'll upload it (well, if you want to use it not only in local ;))
Chouchenos
Well, that's another problem. It's not a PHP error. It means that the username and password you entered are not in your database. You should ask another question on SO...
Chouchenos
oh yeah..im a beginner....so what path should i use...i am trying to develop a web application.
Johnson
nope..the username and password are in my database...if i log in using that username and password, i am being redirect to my dashboard.
Johnson
Since all your files are in the root of your site, it may be `include('header.html');`. For your other problem, you should start another question in SO.
Chouchenos
A: 

first parameter must be a link identifier, a value returned by http://www.php.net/manual/en/function.mysqli-connect.php or http://www.php.net/manual/en/mysqli.init.php

Blockquote

aeon