CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> IDE/GUI

 Validation of HTML and PHP

Print topic Send  topic

Author Message
raknuth


Posts: 67
Posted: 05/23/2011, 6:03 PM

Hi. This may not be the right place for this, but I am posting this info in response to a question asked by another member as part of another discussion thread. I think it has a place here.

I ran into some problems with bad custom code that resulted in continued crashes of the CCS4 GUI. I ran the generated code through an online HTML Validator, with no success. I could not find an PHP Validator that was of much use. I needed smething on my local development machine that could help me troubleshoot problems with CCS code, yet reside outside the CCS environment.

I downloaded & installed a trial version of Microsoft Expression Web v4. Support for PHP is much improved over previous versions. It validates your HTML as you write it. And it provide methods for testing your PHP locally in multiple browsers and browser sizes. It works with support from its own Development Server or it works with LAMP components. Expression Web will never replace a dedicated PHP IDE like CCS, but it seems to have genuine value as an additional tool for development and troubleshooting.

(Local plaform is Windows 7 Ultimate x64)

-----
Testing PHP in Expression Web 4
-----

1 - activate the installation of Internet Information Server (IIS) via Control Panel. PHP will require the presence of CGI support and the default installation of IIS does not include CGI support. You'll have to dig through the component details and install CGI support.
2 - download & install the PHP binaries from www.php.net. During PHP install, select the Other.CGI option.
3 - make a copy of php.ini (in the PHP install folder) and edit the original as follows:
* doc_root = "locahost"
* display_errors = on
* cgi.force_redirect = 0
4 - open IIS Management. Go to Handler Mappings and look for a mapping for *.php. My IIS installation did not have this mapping, so I had to create it as follows:
* Request Path = *.php
* Module = FastCgiModule
* Executabale = [path to PHP-CGI.EXE]
* Name = PHP via FastCGI
5 - you should now be able to create a short PHP script in C:\INETPUB\WWWROOT and open it in your browser.
6 - * in Expressions Web, go to Tools->Application Options. On the General tab, at the bottom, browse to the PHP-CGI.EXE file located in C:\PROGRAM FILES (X86)\PHP.

Once this is done, you should be able to locally preview your PHP pages. Unfortunately, the Design mode of Expression Web does not show the results of your PHP code. You must save the file and Preview in Browser [F12].

-----
MySQL Remote Data in Expression Web 4
----

To connect your local PHP script to remote MySQL data, you apparently need to work with ODBC. Note: Although I develop in Windows, I publish to Linux. So I'll comment my production code while testing, and comment my testing code when I go into production.

Here are the broad strokes:

1 - download the ODBC Connector for MySQL (http://dev.mysql.com/downloads/connector/odbc/).
2 - create an ODBC Connector to your live remote MySQL data. For this example, the following parameters apply:
* ODBC Connector Name: MYSERVER
* remote database host: www.myserver.com
* remote MySQL database name: testdata
* remote MySQL user name: myserver_admin
* remote MySQL password: password1
3 - create your PHP code:
*****
<?
//
// here is the testing code to create a connection with PHP and the ODBC Connector defined above
//
$connection = @odbc_connect("myserver", "", "") or die("Could not connect...");
$query = "
SELECT *
FROM table1
";
$result = @odbc_exec($connection, $query) or die("Couldn't execute query...");
while (odbc_fetch_row($result)) {
$date_start = odbc_result($result,'date_start');
$date_end = odbc_result($result,'date_end');
$season = odbc_result($result,'season');
echo "$date_start - $date_end for the $season Season<br>";
}
odbc_close($connection);

//
// here is the production code to create a connection with PHP and MySQL
//
/*
$db_name = "testdata";
$table_name = "table1";
$connection = @mysql_connect("www.myserver.com", "myserver_admin", "password1") or die("Could not connect...");
$db = @mysql_select_db($db_name, $connection) or die("Couldn't select database...");
$query = "
SELECT *
FROM $table_name
";
$result = @mysql_query($sql, $connection) or die("Couldn't execute query...");
while ($row = mysql_fetch_array($result)) {
$date_start = $row['date_start'];
$date_end = $row['date_end'];
$season = $row['season'];
echo "$date_start - $date_end for the $season Season<br>";
}
mysql_close($connection);
*/
?>
*****
4 - save & preview in browser [F12].

I hope this provides some help for those in need.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.