Hi

I have a php script that 'should' get data from a MySQL database and display
it in a web page.  When I test the script using 'zend development
environment' the output appears fine, all the data records, html tags and
all.

When I try and run it from a browser I keep getting a parse error as
follows: -
'Parse error: parse error in C:\apache\htdocs\searchform.php on line 22'

php code follows-

<HTML>
<BODY>
<?php
// send username and password to mysql on server
mysql_connect (localhost, username, password);
// open register database
mysql_select_db (register);

if ($surname == "")
{$surname = '%';}

if ($forename == "")
{$forename = '%';}

// get data that matches search criteria from database
$result = mysql_query ("SELECT * FROM detail
                         WHERE surname LIKE '$surname%'
                         AND forename LIKE '$forename%'
                       ");

// Create html table
print("<TABLE BORDER=1 CELLSPACING=2 CELLPADDING=2 ALIGN=CENTER>\n");
print("<TR ALIGN=CENTER VALIGN=TOP>\n");
print("<TD ALIGN=CENTER VALIGN=TOP>Surname</TD>\n");
print("<TD ALIGN=CENTER VALIGN=TOP>Forename</TD>\n");
print("<TD ALIGN=CENTER VALIGN=TOP>County</TD>\n");
print("<TD ALIGN=CENTER VALIGN=TOP>Register Number</TD>\n");
print("</TR>\n");

//Display Results from Database
if ($row = mysql_fetch_array($result)) {

do {
  print("<TR>\n");
  print("<TD>$row[surname]</td>\n");
  print("<TD>$row[forename]</td>\n");
  print("<TD>$row[county]</td>\n");
  print("<TD>$row[code]</td>\n");
  print("</TR>\n");
} while($row = mysql_fetch_array($result));

} else {print "Sorry, no records were found!";}
print ("</TABLE>\n");
?>
</BODY>
</HTML>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to