Versions

MySQL_Connect_to_Database.zip (2009-02-24) (Downloaded 62 times)

Contains:

  • MySQL Connect (page-action) - v. 1.2q
  • MySQL Connect (page-action) - v. 1.2q

Compatible: Pro 3.5, Pro 4, and Pro 5

Author: Softpress Support

MySQL Connect generates PHP code so that the page can connect to a database. It has two settings, one for development and one for when the page is hosted on a server that is on line. Code created by this Action can be inserted onto another page using the Action ‘Include PHP Page’.

Application

This Action is a Page Action. Enter your database information in the text fields. The drop-down determines which set of data will be used. Switching this will cause all pages that use the PHP Include PHP Page to include this page to re-publish.

Code Produced

This is HTML generated by a blank Freeway page with this Action applied. The variable $fwServer will be 1 for development and 2 for live (just in case you need to make minor changes to code to allow for differing environments).

<?PHP
$fwDBName = “name”;
$fwHost = “host”;
$fwUser = “user”;
$fwPassword = “password”;
$fwLink = mysql_connect( $fwHost , $fwUser , $fwPassword );
$kfwDevelopment = 1;
$kfwLive = 2;
$fwServer = 1;
?>

2 Comments

Hi Sorry for coming up with stupid questions. I,m quite new to Freeway :-) I just need a small login script. An input field for username and password and a "login" button to connect to a MySQL server. Can this action be used for that purpose? Best regards, KSP

Do you want this script to connect the user to the database, as in a database administration tool? You might try phpMyAdmin instead, as that's usually installed on any hosting setup and it's designed for viewing, reporting, and editing the database.

If you want to use the records in your database to authenticate users to your site, then you could use this Action along with the others in the suite to create a lookup. You would apply this Action to the page to connect to your database, then you would create a form and a handler that would submit a query to the database through that connection.

Walter

Sign In or to comment.