Jump to content


MySQL onto a web page

  • Please log in to reply
2 replies to this topic

#1 emsie

  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 15 December 2004 - 01:21 PM

Hi, I'm very new to dreamweaver and MySQL, and although I have set up my database, and have it all connected down the side of Dreamweaver, I do not know how to put it in to a webpage (and can't find anywhere which tells me how to, only how to set up connections, which I've done).

Please can you give me a little step-by-step guide, or point me in the right direction of one.

I really need to know how to search fields and display them on the page.

Cheers in advance,


#2 obsidian

  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 15 December 2004 - 04:37 PM

think of it this way (i hope i'm not simplifying too much, but based on your question, i'm assuming no prior knowledge):

1. what do i want to pull from my database? (SQL query)
2. where do i want to store the results until i display them? ($result variable)
3. how do i look through my results and display them? (while loop)

let's pretend that you simply have a small table called 'Names' with the following info:

ID | Name
1  | George
2  | Ralph
3  | Sandra 

First, what do i want to pull -- in this case, i just want to list all the names:
$sql = "SELECT Name FROM Names";
Next, i store the results so i can loop through them:
$results = mysql_query($sql, $conn);
Once i have the data, let's loop through and print each individual record:
while ($result = mysql_fetch_array($results)) {
    $name = $result['Name'];
    echo $name . "<br />";

this will list through all the names you have pulled from the database.

hope this helps get you started!
You can't win, you can't lose, you can't break even... you can't even get out of the game.

while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#3 emsie

  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 16 December 2004 - 09:57 PM

Thank you! No prior knowledge. That has helped a lot. Going to go and fiddle with some things.

Thanks again.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users