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.


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

PHP-->View question

A customer form with customer entry?

i have a form on customer details which contains the field of (id,name,phone,email,address) so when i  fill the form and give submit ,I should insert the customer details into database and simultaneously i have to fetch the data and display in my page...

$sql5 = "SELECT *FROM  customer
            $result = mysqli_query($conn, $sql5);    
            if (mysqli_num_rows($result) >0)
                // output data of each row
                while($row = mysqli_fetch_assoc($result)) {
                echo "id: " . $row['id']. " - 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']. "
                } else {
                echo "0 results";

The above are the codes which i have used for selecting data , fro the above code i m getting all the rows are displayed in my page , but i need only one customer detail which i am latestly submiting in my form.

so how can i change my selecting codes

Asked On2017-05-16 17:29:26 by:PerumalS

Taged users:

Be first to like this question

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

You requerd to change the sql query which you are submitting to retrive the data from the database

$sql5 = "SELECT *FROM  customer ORDER by id DESC"

in at the example of your php code you can remove the while loop also becose this query will only display the last result from the database so that there is not further requerment of while loop any more.

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

Be first to like this answer

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