Jump to content

Afterthought

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Afterthought's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. <<Enable MySQL>> Click Commmand Prompt Type in C:\Documents and Settings\User>cd\ C:\>cd mysql\bin\mysqld --console The system cannot find the path specified. C:\>cd mysql\bin\ C:\mysql\bin>mysqld --console ***if you see this -- its enabled C:\mysql\bin>mysqld --console 040815 21:41:10 InnoDB: Started; log sequence number 0 43634 mysqld: ready for connections. Version: '5.0.0-alpha-max-debug' socket: '' port: 3306 <<<Connecting to a database>>> To create a database connection to your MySQL database: Open a PHP page in Dreamweaver, then open the Databases panel (Window > Databases). Click the plus (+) button on the panel and choose MySQL Connection from the pop-up menu. The MySQL Connection dialog box appears. Complete the dialog box and click OK. For more information, see Setting the MySQL Connection dialog box options. The new connection appears in the Databases panel. ---------------- <<<Setting the **MySQL Connection dialog box** options>>> The purpose of this dialog box is to create a database connection for a PHP application. Make sure the MySQL server is started before completing this dialog box. Procedure Enter a name for the new connection. Note: Do not use any spaces or special characters in the name. In the MySQL Server box, specify the computer hosting MySQL. Enter an IP address or a server name. If MySQL is running on the same computer as PHP, you can enter localhost. Enter your MySQL user name and password. In the Database box, enter the name of the database, or click Select and choose the database from the list of MySQL databases. Click Test. Dreamweaver attempts to connect to the database. If the connection fails, double-check the server name, user name, and password. If the connection still fails, check the settings for the folder Dreamweaver uses to process dynamic pages (see Specifying where dynamic pages can be processed). Click OK. The new connection appears in the Databases panel. ------ Test it with this sample program in Dreamweaver: Using the following commands .. View>>Live Data or Ctrl+Shift+r <?php /* Connecting, selecting database */ $link = mysql_connect("MYSQL server box/IP address/server name", "username", "password") or die("Could not connect : " . mysql_error()); echo "Connected successfully"; mysql_select_db("Database _box/Database name") or die("Could not select database"); /* Performing SQL query */ $query = "SELECT * FROM Table"; $result = mysql_query($query) or die("Query failed : " . mysql_error()); /* 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); ?></body> </html> ********Note: These strings in the program depend on what you put in the **MySQL Connection dialog box** MYSQL server box/IP address/server name MySQL user name MySQL password MYSQL Database _box/Database name Author's note FYI: In future, problem please refer to Help>>Tutorials>>search(tab) and key in the_title_of_the_topic_you_don't_understand , for example, php and mysql ---------------------------------------------------------------------------- However if the Dreamweaver still can't work then install... "MyODBC-standard-3.51.9-win.exe" about 5.8mb from http://dev.mysql.com/downloads/connector/odbc/3.51.html then goto Control Panel>>Administrative Tools>>Data Sources (ODBC) See the User DSN (tab) and click the Add button You'll see the Create_a_new_data_source scroll box; so scroll down further and find the "MySQL ODBC 3.51 Driver" you installed earlier. click it. Later DNS configuration for the new driver pops up. See <<DSN information>> Enter the... data source name: Any_name_you want See <<MySQL connection parameters>> Enter the... Host/Server Name(or IP): the MYSQL server box/IP address/server name see the.. <<database name>> enter the database name in the MySQL folder..eg the default database name "TEST" for the rest, enter them with your own common sense...except the SQL command on connect, which you can leave blank. After that,click Test Data Source... if error please double check; else Congratulations and try to steps at the top again. Author's note: I'm not really sure this will work, because it's just one of the preparations I did -- before I managed to connect successfully. But to tell you the truth, I don't know what Data Sources (ODBC) is for? Wonder any one know?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.