0

So this is my code so far. I'm new in programming in php so I was trying my best to make a register form that checks if the inputs exists in dummyclients_table in my database and if it exists it will insert the inputs into clients_table. Anyone who knows php can help me with this?

The process in the registration should be input>check if existing in a table in database>insert data if existing.

We are required to have a dummy table for security purposes because it is our school's system someday. We can't allow other people to just register in this system. It is exclusive for the students in our school only.

<?php

session_start();
if(isset($_SESSION['clients_tbl'])!="")
{
header("Location: homethesis.php");
}
include_once 'dbconnect.php';
if(isset($_POST['btn-signup']))
{
$id_number = $_POST['id_number'];
$lname = $_POST['lname'];
$fname =$_POST['fname'];
$mname =$_POST['mname'];
$contact_number =$_POST['contact_number'];
$password =$_POST['password'];
$course =$_POST['course'];
$college =$_POST['college'];


$check = mysql_query("SELECT * FROM dummyclients_tbl WHERE student_number='$id_number' AND student_lname='$lname'");

I temporarily used this condition to see if my code is really working

if(mysql_num_rows($check)==0){
?>
    <script>alert('Match Found');</script>
    <?php
}
else{
?>
    <script>alert('Nothing Found');</script>
    <?php
}


}
?>
Rae Kun
  • 13
  • 5
  • And what? What is wrong? – u_mulder Jul 24 '16 at 16:07
  • it returns me this error Notice: Undefined variable: dbc in D:\xa\htdocs\PHPversion_thesis\Client\registerthesis.php on line 21 Warning: mysqli_query() expects parameter 1 to be mysqli, null given in D:\xa\htdocs\PHPversion_thesis\Client\registerthesis.php on line 21 Database Error Occured Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given in D:\xa\htdocs\PHPversion_thesis\Client\registerthesis.php on line 25 – Rae Kun Jul 24 '16 at 16:08
  • Please use PHP's password handling functions. Never ever store plain text passwords! – Jay Blanchard Jul 24 '16 at 16:08
  • __Edit__ your question with this info. – u_mulder Jul 24 '16 at 16:08
  • so my code can't it be edited anymore? or is there other solution in my problem? – Rae Kun Jul 24 '16 at 16:23

0 Answers0