Webdetector Webmaster Forums - Your favorite webmaster community
 
  #1 (permalink)  
Old 07-20-2008, 03:48 PM
Junior Member
 
Join Date: Jul 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Navicat 8 for MySQL and PHP?

I made a database in the localhost part of Navicat 8 for MySQL called testu.
i put an sql file in there but thats not the problem...
in a php file i put:
Code:
<?php
// Connecting, selecting database
$link = mysql_connect('localhost')
    or die('Could not connect: ' . mysql_error());
echo 'Connected successfully<br>';
mysql_select_db('testu') or die('Could not select database<br>');

// Performing SQL query
$query = 'SELECT * FROM username';
$result = mysql_query($query) or die('Query failed: ' . mysql_error() . "<br>");

// Printing results in HTML
echo "<table>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
    echo "\t<tr>\n";
    foreach ($line as $col_value) {
        echo "\t\t<td>$col_value</td>\n";
    }
    echo "\t</tr>\n";
}
echo "</table>\n";

// Free resultset
mysql_free_result($result);

// Closing connection
mysql_close($link);
?>

I downloaded wamp. I type in the address bar: localhost/phpfilename.php

and what appered was:
Connected successfully
Could not select database

what is the problem?
i put the correct name for the database..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored links
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT +1. The time now is 03:22 AM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Ad Management by RedTyger