Hallo Everyone,
  I'm facing this basic problem for connecting the Mysql4.01 Database using 
Php5;

  The browser shows the following error;

  mysql_connect("localhost", "root") or 

  -->
  Fatal error: Call to undefined function mysql_connect() in D:\Program 
Files\Apache Group\Apache2\htdocs\mass\connect.php on line 25

  Can someone plz help me to sort out this problem.

  Thanx in advance

  Regards
  Shiva

  ps:-

  login.php

  <?

  if ($submit = "Login") 
  {
   
    mysql_connect("localhost", "root","123sw") or                
      die ("Could not connect to database");

    mysql_select_db("user") or
      dir ("Could not select database");   

  $result=mysql_query("select * from user where username='$username'") 
               or die ("cant do it"); 

  while ($row=mysql_fetch_array($result)) { 
   if ($row["password"]==$password ) 
    { 
      printf("Successfully Logged In!"); 
    }else{
      print("Nope");
      
     }
   } 
  }
  ?>

  create_entry.php

  <?php
       
  mysql_connect("localhost", "root","123sw") or 
      die ("Could not connect to database");
   mysql_select_db("user") or
      dir ("Could not select database");   
    
   if ($submit = = "Register")
  {
     $query = "insert into user
             (username, password) values ('$username', '$password')";
     mysql_query($query) or 
               die (mysql_error());
  ?>
  <h3>You are now registered</h3>
  <a href="index.html">Go back to main page</a>
  <?php
  }
  else
  {
    include("not.html");
  }
  ?>


  index.html

  <html>
    <head>
      <h2>
       User Login
      </h2>
      <form method=post action="/login.php">
     </head>
    <body> 
     <b>
      <br>
       Username
       <br>
      </b>
      <input type=text size=15 name="username">
       <br>
        <b>
         UserPassword
       </b>
      <br>
      <input type=text size=15 name="password">
      <br>
      <input type=submit name=submit value="Login">
      <input type=reset  name=reset  value="Clear">
      <br>
      
      <a href="/Register.html">Register</a>
     </form>  
   </body>
  </html>

  register.html

  <html>
    <head>
      <h2>
       User Registration
      </h2>
      <form method=post action="create_entry.php">
     </head>
    <body> 
     <b>
      <br>
       Username
       <br>
      </b>
      <input type=text size=15 name=username>
       <br>
        <b>
         UserPassword
       </b>
      <br>
      <input type=password size=15 name=password>
      <br>
      <input type=submit name=submit value="Register">
      <input type=reset  name=reset  value="Clear">
     </form>  
   </body>
  </html>

Reply via email to