🔒 Closed Mysql err

Status
Not open for further replies.

Netflix

Forum Veteran
mga boss ano po kaya ang problema dito? tulong po..
upload_2017-3-6_4-11-50.webp

Code:
include('dbcon.php');
if (isset ($_POST['submit'])){

    $fname=$_POST['fname'];
    $lname=$_POST['lname'];
    $mname=$_POST['mname'];
    $bd_m=$_POST['bd_m'];
    $bd_d=$_POST['bd_d'];
    $bd_yr=$_POST['bd_yr'];
    $gender=$_POST['gen'];
    $address=$_POST['address'];
    $mnumber=$_POST['mnumber'];
    $email=$_POST['email'];
    $guardian=$_POST['guardian'];
    $guardiancontact=$_POST['guardiancontact'];
    $guardianadd=$_POST['guardianadd'];
    $course=$_POST['course'];
    $YEAR=$_POST['YEAR'];
}
 else{

$query=mysql_query("SELECT * FROM studentdata WHERE fname='$fname' and lname='$lname' ")or die(mysql_error());
$cnt=mysql_num_rows($query);

if ($cnt > 0){ ?>

<script>
    alert('Student Already Exist');
    window.location="Students.php";

</script>
 <?php  }else{
     mysql_query("INSERT INTO studentdata (fname,lname,mname,bd_m,bd_d,bd_yr,gen,address,mnumber,email,guardian,guardiancontact,guardianadd,course,YEAR)
         values ('$fname','$lname','$mname','$bd_m','$bd_d','$bd_yr','gen','address','mnumber','email','guardian','guardiancontact','guardianadd','course','YEAR') ") or die (mysql_error());
?>


  <script> alert ('Student has been added!');
 window.location="Student.php";
 </script>

<?php
}
}


?>
 
include('dbcon.php');
if (isset ($_POST['submit'])){

$fname=$_POST['fname'];
$lname=$_POST['lname'];
$mname=$_POST['mname'];
$bd_m=$_POST['bd_m'];
$bd_d=$_POST['bd_d'];
$bd_yr=$_POST['bd_yr'];
$gender=$_POST['gen'];
$address=$_POST['address'];
$mnumber=$_POST['mnumber'];
$email=$_POST['email'];
$guardian=$_POST['guardian'];
$guardiancontact=$_POST['guardiancontact'];
$guardianadd=$_POST['guardianadd'];
$course=$_POST['course'];
$YEAR=$_POST['YEAR'];
}
else{

$query=mysql_query("SELECT * FROM studentdata WHERE fname='$fname' and lname='$lname' ")or die(mysql_error());
$cnt=mysql_num_rows($query);

if ($cnt > 0){ ?>

<script>
alert('Student Already Exist');
window.location="Students.php";

</script>
else{
mysql_query("INSERT INTO studentdata (fname,lname,mname,bd_m,bd_d,bd_yr,gen,address,mnumber,email,guardian,guardiancontact,guardianadd,course,YEAR)
values ('$fname','$lname','$mname','$bd_m','$bd_d','$bd_yr','gen','address','mnumber','email','guardian','guardiancontact','guardianadd','course','YEAR') ") or die (mysql_error());


<script> alert ('Student has been added!');
window.location="Student.php";
</script>

<?php
}
}


?>
 
Status
Not open for further replies.

About this Thread

  • 8
    Replies
  • 823
    Views
  • 5
    Participants
Last reply from:
That Poppy

Trending Topics

Online now

Members online
990
Guests online
1,166
Total visitors
2,156

Forum statistics

Threads
2,273,843
Posts
28,952,037
Members
1,234,978
Latest member
panda1829
Back
Top