answersLogoWhite

0

Hi,

For example if you want to get data from a table called employee

<?php

$con = mysql_connect("localhost","root","");

if(!$con) die('Could not connect: ' . mysql_error());

else

{

$select_db=mysql_select_db("for_testing",$con);

if(!$select_db){

echo 'No such database';

die;

}

$result=mysql_query('Select * from employee',$con);

$row = mysql_fetch_array($result,$con)

echo $row['name'];

}

?>

User Avatar

Wiki User

16y ago

What else can I help you with?

Related Questions

How do you retrieve data from one MySQL table and create another MySQL table with the same data in it using PHP?

Execute a SELECT INTO statement on the mysql database: INSERT INTO destination_table (id, first_name, last_name) SELECT id, first_name, last_name from source_table;


How do you retrieve the data from database?

To retrieve data rfrom a mysql database you first need to connect to the database using the mysql connection string(mysql_connect) after that, it's just a matter of executing a query of "SELECT `field1`, `field2` FROM `tablename`" Obviously replacing field 1 and 2 with the fields you want to replace and tablename with the table the data is stored


How do you create a table in dreamweaver?

using the mysql command "create table table_name" we can create a table in dreamweaver.


How do you set up a hit counter?

Using either CGI or PHP and a MYSQL table.


How do you insert an image into MySQL using a BLOB?

There is a pretty solid tutorial here http://www.mysqltutorial.org/php-mysql-blob/ if you are using PDO. Without seeing your database table structure, it is hard to know what the propoer approach would be for your situation


How do you connect an iPhone to a MySQL database?

To connect an iPhone to a MySQL database, you typically set up a server-side API using a language like PHP or Node.js that interfaces with the MySQL database. The iPhone app can then make HTTP requests (using libraries like URLSession in Swift) to this API to send or retrieve data. Ensure that you implement proper security measures, such as using HTTPS and authentication, to protect your database and data. Direct connections to a MySQL database from an iPhone app are not recommended for security reasons.


What is VIEW in MySQL?

In databases, a view is a stored query accessible much the same way as a table. The view does not hold any data, but can be used to retrieve data from one or more tables. Views can represent a subset of the data contained in a table, can join and simplify multiple tables into a single virtual table, can aggregate table data (using sum, avg, count, etc) and can hide the complexity of data


How do you retrieve an image from a database using PHP?

It depends what Database you are using. I personally use MySQL so will explain how you would do it using MySQL. You would have to create the MySQL database. I would store the image URL rather than the actual image. Then call it using PHP and a MySQL query. For Example: $sql = "SELECT * FROM Images WHERE Img_Name = 'img1'"; $query = mysql_query($sql); $array = mysql_fetch_array(query); then you would call it into HTML like so:


How do you show table or column contents using the MySQL commands?

To show the contents of a table in MySQL, you can use the SELECT statement. For example, to display all columns from a table named employees, you would run the command SELECT * FROM employees;. If you want to show specific columns, you can specify them, like SELECT first_name, last_name FROM employees;. To view the structure of a table, you can use DESCRIBE table_name; or SHOW COLUMNS FROM table_name;.


Can you name a field KEY in a MySQL table?

In a MySQL table, a field key is typically referred to as a &quot;primary key.&quot; The primary key is a unique identifier for each record in the table, ensuring that no two rows have the same value in that field. It can be defined using the PRIMARY KEY constraint when creating or altering a table. Additionally, other types of keys, such as foreign keys, can establish relationships between tables.


In how many ways can you retrieve the date in the result set of MySQL using PHP?

If you store MKTIME or date("z") then there are unlimited ways.Simply usedate("d/m/Y",$mymktime);With anything at the beginning for the format.


How do you find the MySQL version?

There are several ways to check your current version: From the command line Using Workbench Via MySQL Client, exp. using dbForge Studio for MySQL