Jump to content

Bandyleg

Members
  • Posts

    2
  • Joined

  • Last visited

About Bandyleg

  • Birthday 05/01/1983

Profile Information

  • Location
    Cumbria
  • Interests
    Cars, Films, and breaking things to find out whats actually inside them :)

Bandyleg's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Hi and thankyou for the reply, I had previously looked at the link you have provided, but had misunderstood it, as i said i am very new to this. I have managed to remove all the syntax errors that i was whining about. It has now fired this at me Operand should contain 1 column(s)I will go and try to find out this problem but if u know of a specific location that is useful it would be appreciated. Thankyou.
  2. Hi everyone, Please could you help me in understanding why this code wont work, If i am right in what i have been trying the problem is with my sql statement, But i have only been doing this for a few weeks and some of the information i have been reading isnt always helpful as i do not fully understand how everything works yet, This is for a college assignment i have been given.I have not just got stuck and gone someone do this for me, I have looked into my problems but lack the knowledge to fully understand and fix it. All help is greatly received anything you see with // in front of it is for info purpose for myself and will hopefully help make things a little cleared for you guys when offering your help <?php$host="localhost"; // Host name$username="root"; // Mysql username$password=""; // Mysql password$db_name="assignment"; // Database name$tbl_name="customers"; // Table name$session="CustomerId";// session// Connect to server and select databse.mysql_connect("$host", "$username", "$password")or die("cannot connect");mysql_select_db("$db_name")or die("cannot select DB");// username and password sent from form.$myusername=$_POST['myusername'];$mypassword=$_POST['mypassword'];// To protect MySQL injection.$myusername = stripslashes($myusername);$mypassword = stripslashes($mypassword);$myusername = mysql_real_escape_string($myusername);$mypassword = mysql_real_escape_string($mypassword);$sql= "SELECT FirstName and Password FROM '£tbl_name' WHERE FirstName= ('$myusername'), Password=('$mypassword')";$result=mysql_query($sql);// Mysql_num_row is counting table row$count=mysql_num_rows($result) or die;// If result matched $myusername and $mypassword, table row must be 1 rowif($count=1){// Register $myusername, $mypassword and redirect to file "login_success.php"session_start();$_SESSION=$_POST['CustomerId'];echo "Login Successful<p> Click here <a href= 'customerhomepage.php'> to continue to your account</a></p>";}else {echo "Wrong Username or Password";}?> This is the complete error Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\martins_assignment\Images\login2.php on line 23
×
×
  • Create New...