This means your SQL query failed. Presumably because you've not run $username through mysql_real_escape_string(). If you type in something into the username box (such as an ' for example) then it will break your SQL string and when you put it through mysql_query the mysql server will not parse it correctly, return a false instead of a resource result and consequently your call to mysql_num_rows() will return an error.
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value.
Sir, I corrected the above error after removing error i again checked then it showed the following error "Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() on line 29 "
The code on line 29 is" mail($to,$subject,$message,$headers); "
The file code is as below :-
PHP Code:
<?php
$username=$_POST['uname'];
$con=mysql_connect("localhost","root","") or ("Cannot connect localhost");
mysql_select_db('project',$con) or die("connection field");
$q=mysql_query("select email from admin where uname='$username'");
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value.
Sorry sir but i m not getting where to use the following statement mysql_real_escape_string(). Previously i used username instead of using uname hence it was showing that error. Then i changed it to uname the error shown was "Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() on line 29 "
The code on line 29 is" mail($to,$subject,$message,$headers); " .
Sorry but please explain me where to use and how to use (mysql_real_escape_string() statement) i dont know much about php .
Please help me out.
Last edited by vinyl-junkie; 07-24-2012 at 01:22 PM..
Reason: advertising/spam links removed
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value.
sir can you tell, while installation weather we have to make any changes in php.ini file. I tried to attach the php.ini file but it is showing upload file error.
thanks for the help i checked it, now mail is sent. All the problem was i was running on the localhost. But when all the files are uploaded on the server it is directly sending the email. Thank you very much Arcticwarrio for helping.
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value.