Php code create and connect a table

The Eduladder is a community of students, teachers, and programmers just interested to make you pass any exams. So we solve previous year question papers for you.
See Our team
Wondering how we keep quality?
Got unsolved questions?

Ask Questions

PHP-->View question


Php code create and connect a table.

i have to display two tables 1.customer 2.product details

so how can i write query to select all fields in the two tables and display it in table

my database is like this

CREATE TABLE customer
(
    id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(32) NOT NULL,
    phone VARCHAR(10) NOT NULL,
    email VARCHAR(32) NOT NULL,
    address varchar(100) NOT NULL,
    state varchar(20) NOT NULL,
    city VARCHAR(30) NOT NULL,
    pincode int NOT NULL
    );


CREATE TABLE product_details
(
    p_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    full_name_of_phone VARCHAR(32) NOT NULL,
    ph_model VARCHAR(32) NOT NULL,
    ph_color VARCHAR(32) NOT NULL,
    ph_quantity VARCHAR(32) NOT NULL,
    cost VARCHAR(32) NOT NULL,
    rv_no int NOT NULL,
    payment_type  VARCHAR(32) NOT NULL
    
    );

my last question was answerd by Rajiv now im getting output correctly so how can i put that out put in a table



By:PerumalS

Taged users:


Likes:
Be first to like this question

Dislikes:
Be first to dislike this question

Talk about thisDelete|Like|Dislike|

You may also like our videos



Answers

If the databases are not having any relation means you can simply use UNION to join both the data bases. Suppose you want to retrieve name from the table customer and same time you want to retrieve  full_name_of_phone From product_details.


Then you can executive the query like this

SELECT name
FROM  customer
UNION SELECT bfull_name_of_phone
FROM produc_detail

Like this or you can retrieve the data in to two separate queries like this.

$sql1="1query"

$sql2="2query"

And you can display the result using any of the php variables


arunwebber

Likes:
Be first to like this answer

Dislikes:
Be first to dislike this answer
Talk about this|Once you have earned teacher badge you can edit this questionDelete|Like|Dislike|
------------------------------------


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.
Career: Work or do your internship 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.
Donate: Ad revenue alone is not able to take care of our server cost consider donating at least a dollar Click here to donate.

If you want the help of doing any of these never hesitate to drop an email to me arunwebber[at]gmail[dot]com, Or you can ping us on WhatsApp ph: 8147433408

Can you help us to add better answer here? Please see this



Not the answer you're looking for? Browse other questions from this Question paper or ask your own question.

Join eduladder!