Click here to Skip to main content
15,899,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am working on a bus reservation system where the admin is the only one allowed to creator bus operators and then the operators can create Buses, routes and tickets. The user can buy a ticket online or using a mobile app. I am trying to save all my user login details in one table and the profile information in a table that matches the user for example The bus operators in the operator table, The Customers in the Customer Table and the Admin in the Admin table. Now i have a form for adding operators which is supposed to save in the login table and operators table.

What I have tried:

PHP
<?php
    $uname=(isset($_POST['uname']))?$mk->real_escape_string(trim($_POST['uname'])):'';
    $name=(isset($_POST['name']))?$mk->real_escape_string(trim($_POST['name'])):'';
    $person=(isset($_POST['person']))?$mk->real_escape_string(trim($_POST['person'])):'';
    $mobile=(isset($_POST['mobile']))?$mk->real_escape_string(trim($_POST['mobile'])):'';
    $email=(isset($_POST['email']))?$mk->real_escape_string(trim($_POST['email'])):'';
    $site=(isset($_POST['site']))?$mk->real_escape_string(trim($_POST['site'])):'';
   
   $ocreate = "INSERT INTO tbloperator
   (op_id,op_name,op_contact,op_mobile,op_email,op_website,op_logo) 
               values('{$name}','{$person}','{$mobile}','{$email}','{$site}','')";

   //$insert="update tbladmins set a_name='$name',a_city='$city',a_mobile='$mobile',a_mail='$email'
     //       where l_user='$user'" ;

    $pwd = "MyKiti12034";
    $pass = $msec -> hashpass ($pwd);

  $trial = "INSERT INTO tbllogin(l_user,l_pass,l_access) VALUES ({$uname},{$pass},2)";
  

            
    if(isset($_POST['oadd'])){

      $mk->query($trial);
      $last_insert = mysqli_insert_id();

      if(!empty($op_id))
      {
    
            if($mk->query($ocreate)){
              echo '<div data-alert class="alert-box success radius">';
                echo  'Success ! Operator Profile created successfully';
                echo  '<a href="#" class="close">×</a>';
              echo '</div>';
              header('refresh:2;url=dashboard.php');
              
              }else{
              echo '<div data-alert class="alert-box warning radius">';
                echo  'Error ! '.$mk->error;
                echo  '<a href="#" class="close">×</a>';
              echo '</div>';
              }
            
            
          }         
     }
  ?>
Posted
Updated 13-Jul-17 4:01am
Comments
CHill60 13-Jul-17 8:29am    
So what actually happens?
jkassy 13-Jul-17 9:55am    
It does not show any error and does not submit to the DB
jkassy 13-Jul-17 11:08am    
No error and no entry

1 solution

Try this code. You can also change the sql, instead of select use insert into
PHP
$sql = "SELECT h.stand_id, h.type, h.no_of_stands,h.date,  v.vname , v.thumb, c.cname , c.ctype, h.price
        FROM stand h, tbl_categories c, tbl_vendors v
		WHERE h.cid = c.cid 
		ORDER BY type";
$result = dbQuery($sql);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900