Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Get data from MySQL to fill in data in a webpage

Posted on 2004-11-02
7
Medium Priority
?
296 Views
Last Modified: 2011-08-18
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?

0
Comment
Question by:DBDevOne
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 1

Expert Comment

by:Codeit1978
ID: 12474627
First What scripting language is your page in?
0
 

Author Comment

by:DBDevOne
ID: 12476837
The language doesn't matter. I'm open for suggestions.
0
 
LVL 16

Expert Comment

by:alain34
ID: 12480874
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 3

Accepted Solution

by:
Jankit141180 earned 2000 total points
ID: 12481321
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
 
LVL 3

Expert Comment

by:Jankit141180
ID: 12481362
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
 

Expert Comment

by:Ultimat
ID: 12490954
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
 

Author Comment

by:DBDevOne
ID: 12551650
Thank you very much Jankit and thank you all for the comments. I appreciate it!
0

Featured Post

Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
This video teaches users how to migrate an existing Wordpress website to a new domain.
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question