EduLadder(ELADR) - CRYPTO

This is designed to incentify community members as a proof of contribution token.


Using this You can,Buy courses,Reward others and exchange for real money.


WHITE PAPER COURSES

Real Problems! Real Experts!

Join Our Telegram Channel !


The Eduladder is a community of students, teachers, and programmers. We help you to solve your academic and programming questions fast.
In eduladder you can Ask,Answer,Listen,Earn and Download Questions and Question papers.
Watch related videos of your favorite subject.
Connect with students from different parts of the world.
Apply or Post Jobs, Courses ,Internships and Volunteering opportunity. For FREE
See Our team
Wondering how we keep quality?
Got unsolved questions? Ask Questions

EduLadder(ELADR) - CRYPTO
Buy Now
PHP-->View question

What is the wrong with the following php code?

<?php
            $servername="localhost";
            $username="root";
            $password="";
            $dbname="onlineform";
            
            
            //customer details  
            
            
            $name=$_POST["element_1_1"];
            $phone=$_POST["element_2_1"];
            $email=$_POST["element_3"];
            $street=$_POST["element_4_1"];
            $state=$_POST["element_4_6"];
            $city=$_POST["element_4_3"];
            $pincode=$_POST["element_4_5"];
            
         // Delivery address
            $dstreet=$_POST["del_7_1"];
            $dcity=$_POST["del_7_3"];
            $dpincode=$_POST["del_4_5"];
            $dstate=$_POST["del_4_6"];
            
                //Sotre details
            
            $refer_deatails=$_POST["element_9_1"];
            $salesman_name=$_POST["element_9_3"];
            $salesman_id =$_POST["element_9_4"];
            $store_name_and_address =$_POST["element_9_2"];
            $mangers_name =$_POST["element_9_3_mn"];
            $mangers_phno =$_POST["element_9_4_mc"];
            
            
            // Product details
            
        
            $full_name_of_phone=$_POST["element_9_2_fnp"];
            $ph_model=$_POST["element_9_5"];
            $ph_color=$_POST["element_9_6"];
            $ph_quantity=$_POST["element_9_7"];
            $cost=$_POST["element_9_8"];
            $rv_no=$_POST["element_9_9"];
            $payment_type=$_POST["cod"];
            
            
        //createing connection
            
            $conn=mysqli_connect($servername,$username,$password,$dbname);
            
            //check connection
            
            if(!$conn){
                    die("connection failed :".mysqli_connect_error());
                    }
    

    
                                
            //inserting customer details
            
            $sql="INSERT INTO customer (name,phone,email,address,state,city,pincode)
            VALUES('".$name."','".$phone."','".$email."','".$street."','".$state."','".$city."','".$pincode."')";
                if(mysqli_query($conn,$sql)){
                echo"<h2>Order placed succesfully</h2><br><br>";
                //echo "<a href='onlineform.html'><h1 style='color:red'>click here for new order <h1></a>";
                echo"<h1 style='color:red'>Customer details <h1>";
                }else{
                    echo"ERROR".$sql."<br>".mysqli_error($conn);
                }
                
            //Inserting delivery addreass
            
            $sql2="INSERT INTO delivery_add ( address,city,state,pincode)
            VALUES('".$dstreet."','".$dstate."','".$dcity."','".$dpincode."')";
                if(mysqli_query($conn,$sql2)){
                
                }else{
                    echo"ERROR".$sql2."<br>".mysqli_error($conn);
                }
                    
            // Inserting store details
            
            $sql3="INSERT INTO store_details (refer_deatails,salesman_name,salesman_id,store_name_and_address, mangers_name, mangers_phno)
            VALUES('".$refer_deatails."','".$salesman_name."','".$salesman_id."','".$store_name_and_address."','".$mangers_name."','".$mangers_phno."')";
                if(mysqli_query($conn,$sql3)){
                
                }else{
                    echo"ERROR".$sql3."<br>".mysqli_error($conn);
                }
            
        //insert into product_details
        
        $sql4="INSERT INTO product_details (full_name_of_phone, ph_model,ph_color,ph_quantity,cost,rv_no,payment_type)
            VALUES('".$full_name_of_phone."','".$ph_model."','".$ph_color."','".$ph_quantity."','".$cost."','".$rv_no."','".$payment_type."')";
                if(mysqli_query($conn,$sql4)){
                
                }else{
                    echo"ERROR".$sql4."<br>".mysqli_error($conn);
                }
        
                //select data from database
            
            //$sql5 = "SELECT *FROM  customer
                //";
                
                $sql5="SELECT *FROM  customer ORDER by id DESC;";
                
                
            $result = mysqli_query($conn, $sql5);    
            
            if (mysqli_num_rows($result) >0)
            
            {
                // output data of each row
                //while($row = mysqli_fetch_assoc($result))
                
                //while($row = $result)                                                
                echo "id: " . @$row['id']."<br>" ." Name: " . @$row["name"]. "<br>".
                "phone:" . @$row['phone']. " <br>".
                "email:" . @$row['email']. " <br>".
                "address:" . @$row['address']. "<br>".
                "state:" . @$row['state']. "
                <br>"."city:" . @$row['city']. "
                <br>"."pincode:" . @$row['pincode']. "
                <br>"."<br>";
                echo"<a href='onlineform_selecting_data.html'><h6 style='color:red'>click here for new order <h6></a>";
                
                } else {
                echo "0 results";}

                
                    
    <?php
        mysqli_close($conn);


        ?>


this is complete php program but after giving submit im getting error as

Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\onlineform\onphp_.php on line 152

so where i m going wrong



Asked On2017-05-16 17:31:38 by:PerumalS

Taged users:


Likes:
Be first to like this question

Dislikes:
Be first to dislike this question
Talk about this  Like  Dislike
View all questions
Answers

Unexpected end of file means that something else was expected before the PHP parser reached the end of the script.

<?php
        mysqli_close($conn);

?>

This snippet of code shows that you are unnecessary starting another php file remove the starting php from the end of the code and run the code again.

<?php

//All the other lines of codes

 mysqli_close($conn);

?>

Rewrite it like this.


Answerd on:2014-11-15 Answerd By:neenu2

Likes:
Be first to like this answer

Dislikes:
Be first to dislike this answer
Talk about this  Like  Dislike

You might like this video:Watch more here

Watch more videos from this user Here

Learn how to upload a video over here

You can save the connection variables in to another file and you can include the file in to the main file using include function.

Suppose you saved the connection variable in at another file named connection_vars.php in at same directory

then you can include the file like this

<?php include 'connect_vars.php';?>


Answerd on:2014-11-15 Answerd By:arunwebber

Likes:
Be first to like this answer

Dislikes:
Be first to dislike this answer
Talk about this  Like  Dislike

You might like this video:Watch more here

Watch more videos from this user Here

Learn how to upload a video over here



Lets together make the web is a better place

We made eduladder by keeping the ideology of building a supermarket of all the educational material available under one roof. We are doing it with the help of individual contributors like you, interns and employees. So the resources you are looking for can be easily available and accessible also with the freedom of remix reuse and reshare our content under the terms of creative commons license with attribution required close.

You can also contribute to our vision of "Helping student to pass any exams" with these.
Answer a question: You can answer the questions not yet answered in eduladder.How to answer a question
Career: Work or do your internship with us.Work with us
Create a video: You can teach anything and everything each video should be less than five minutes should cover the idea less than five min.How to upload a video on eduladder