Get data from MySQL to fill in data in a webpage

Hello. I am going to create a webpage that gets data from a MySQL table on a Linux server to populate a table in a webpage.

How would I go about doing that?

DBDevOneAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Codeit1978Commented:
First What scripting language is your page in?
0
DBDevOneAuthor Commented:
The language doesn't matter. I'm open for suggestions.
0
alain34Commented:
php is the most widely used scripting language on the linux platform for creating dynamic webpage. It is really straightforward as well. It is also platform independant, therefore you can even make it work on windows.
Check out http://www.php.net
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Jankit141180Commented:
HELLO.

I HAVE TRIED WITH PHP. AND THE SCRIPT FOR THE SAME IS GIVEN BELOW ...

<?
//making connection to the database
$host = "192.1.1.204";//give ip of your mysql server
$user = "root"; // give user name to login mysql database
$pwd = ""; // give password of your mysql database
$db = "mydb"; // give database name

$link = mysql_connect($host , $user , $pwd) or die ("Couldn't connect to server.");
$db = mysql_select_db($db) or die ("Couldn't select the database.");

//HERE WE HAVE MADE THE CONNECTION TO THE DATABASE

//NOW MAKING QUERY FOR GETTING RECORDS from table1

$strQuery = "select * from table1";

$resultSet = mysql_query($strQuery) or die("Error occured while getting detail from table1.");

//now checking if retrieved records are more than zero
if(mysql_num_rows($resultSet)>0)
{
  //fetching result in the variable
  while($rowResult = mysql_fetch_array($resultSet))
  {
    //printing detail on the browser
    echo $rowResult[0]."<br>";
  }
}

//free sql retrieved result
mysql_free_result($resultSet);
?>

This script works fine.

Rest if you didnt get it then feel free to ask me further. I would glad to cooperate you.

With regards,
Jankit
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jankit141180Commented:
Hello

One more thing in concern with my previous post  ....

I have not included any HTML formatiing in my script.
The script will print only first column on the browserand accordingly you are requested to do formatting.

Thank You
-Jankit
0
UltimatCommented:
This example is a php example ( with mysql ).
This is a bit shorter and perfect for writing your first databasedriven script ( in the future it is beter to exclude the first part and put in an other file , so it is better to make updates f.e. username , otherwis you have to change it on each page - for this use include)

$hostname_db = "server";
$database_db = "databasename";
$username_db = "username";
$password_db = "pwd1";
$db = mysql_pconnect($hostname_db, $username_db, $password_db) or trigger_error(mysql_error(),E_USER_ERROR);

mysql_select_db($database_db, $db);
$query_producten = "SELECT * FROM producten ";
$producten = mysql_query($query_producten, $db) or die(mysql_error());
$row_producten = mysql_fetch_assoc($producten);

do{
   echo($row_producten['field']);
} while ($row_producten = mysql_fetch_assoc($producten));

Greetz Ultimat
0
DBDevOneAuthor Commented:
Thank you very much Jankit and thank you all for the comments. I appreciate it!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.