Reality Check Please

Discussion in 'MySQL' started by carl_in_florida, Oct 2, 2006.

  1. The Critic

    The Critic Peon

    Messages:
    392
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #21
    Glad I could help. :) As for the output:

    
    <?php 
    function DB_connect($database)
    {
    mysql_connect ("localhost", "me", "mypw") or die 
    ('I cannot connect to the database because: ' . mysql_error());
    mysql_select_db ($database)or die (mysql_error());
    }
    DB_connect ("My-database-name");
    $sql = "SELECT * FROM Illustrations WHERE topics LIKE 'talent'";
    $result = mysql_query($sql);
    [b]echo $sql."<br>";[/b]
    ?>
    
    Code (markup):
    The part in bold is your problem. You're telling the page to output the contents of the variable $sql rather than the results of your query, $result. You should use something like this instead:

    
    while($row = @mysql_fetch_array($result))
      {
      echo "Result: ".$row['field1']." ".$row['field2']." ".$row['field3'];
      }
    
    Code (markup):
    Obviously you'll want to pretty it up a bit, but that should be enough to start spitting out query results. Who is your host? GoDaddy?
     
    The Critic, Oct 7, 2006 IP
  2. fatape

    fatape Peon

    Messages:
    5
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #22
    On the MySQL site you can download the MySQL Migration Tool. We have used this to migrate several Access databases to MySQL and it has worked like a champ.
     
    fatape, Oct 11, 2006 IP