Jump to content

Problem with... fwrite I'm assuming at this point (may be wrong)


BrianM

Recommended Posts

I'm hoping that praying that somebody on here can if not give me the solution, at least point me in the right direction. I've been at this for nearly 3 days now, spending hours each day trying different methods and placing quotes and apostrophes in different locations with no luck. I suppose I'll start by sharing my code:

 

Entire page I'm having the problem occur on.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="http://www.game-zero.org/styles/mps.css" />"
<title>MPS - Send Client Data</title>
</head>

<?php

$mysql_hostname = "localhost";
$mysql_username = "brian";
$mysql_password = "*";
$mysql_database = "mps";

$mysql_connect = mysql_connect("$mysql_hostname", "$mysql_username", "$mysql_password") or die(mysql_error());

mysql_select_db("$mysql_database") or die(mysql_error());

$insert_one = "INSERT INTO mps_cdata (projectnumber, projectname, clientname, clientaddress, clientofficephone, clientfax, clientcell, clientemail)
VALUES
('$_POST[projectnumber]','$_POST[projectname]','$_POST[clientname]','$_POST[clientaddress]','$_POST[clientofficephone]','$_POST[clientfax]','$_POST[clientcell]','$_POST[clientemail]')";

if (!mysql_query($insert_one, $mysql_connect))

{

die(mysql_error());

}

mysql_select_db("$mysql_database") or die(mysql_error());

$insert_two = "CREATE TABLE `{$_POST['projectnumber']}`
(
PermitProcess varchar(40),
Req char(3),
SubmittalDate date,
CommentsReceivedDate1 date,
ResubmitDate1 date,
CommentsReceivedDate2 date,
ResubmitDate2 date,
CommentsReceivedDate3 date,
ResubmitDate3 date,
CommentsReceivedDate4 date,
ResubmitDate4 date,
ApprovalDate date,
PermitNumber varchar(10),
CoCReqDate date,
CoCSubmittalDate date
)";
mysql_query($insert_two, $mysql_connect);

mysql_select_db("$mysql_database") or die(mysql_error());

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('COUNTY PRE-APP MEETING')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('FDOT PRE-APP MEETING')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('ERP PRE-APP MEETING')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('COUNTY PRELIMINARY PLAT APPROVAL')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('REZONING APPROVAL (BY OTHERS)')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('COUNTY CONSTRUCTION PLAN APPROVAL')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('FDOT DRIVEWAY CONNECTION PERMIT')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('FDOT DRAINAGE CONNECTION PERMIT')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('FDOT UTILITY PERMIT')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('NOTICE TO R/W USERS')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('FDEP/ECUA SANITARY SEWER PERMIT')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('FDEP/ECUA POTABLE WATER PERMIT')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('SEPERATE UTILITY APPROVAL')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('FDEP/ERP STORMWATER PERMIT')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('FDEP DREDGE & FILL PERMIT')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('COE DREDGE & FILL PERMIT')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('NPDES PERMIT')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('ADEM PERMIT')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('FINAL PLAT')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('FDEP/ERP CERTIFICATION OF COMPLETION')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('ERP REQUEST FOR CONVERSION TO OP. PERMIT')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('NPDES NOTICE OF TERMINATION')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('ADEM NOTICE OF TERMINATION')");

?>

Your entry has been added to the database. Return <a href="http://www.game-zero.org/mps/home.php">home</a> or <a href="http://www.game-zero.org/mps/view_cdata.php">view client data</a>.

<?php

$file = fopen("projects/project_" . $_POST['projectnumber'] .".php", "w");
echo fwrite($file, '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="http://www.game-zero.org/styles/mps.css" />
<title>MPS - Send Client Data</title>
</head>

<?php

$mysql_hostname = "localhost";
$mysql_username = "brian";
$mysql_password = "*";
$mysql_database = "mps";

$mysql_connect = mysql_connect("$mysql_hostname", "$mysql_username", "$mysql_password") or die(mysql_error());

mysql_select_db("$mysql_database") or die(mysql_error());

mysql_select_db("$mysql_database");

$result = mysql_query("SELECT * FROM 1");

echo "<style type='text/css'>
table {font-size: 65%;}
</style>
<center>
<font face='Verdana'>
<table border='1'>
<tr>
<th> Permit Process </th>
<th> Req </th>
<th> Submittal Date </th>
<th> Comments Received Date </th>
<th> Resubmit Date </th>
<th> Comments Received Date </th>
<th> Resubmit Date </th>
<th> Comments Received Date </th>
<th> Resubmit Date </th>
<th> Comments Received Date </th>
<th> Resubmit Date </th>
<th> Approval Date </th>
<th> Permit Number </th>
<th> CoC Req Date </th>
<th> CoC Submittal Date </th>
</tr>";

while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td><center><b>" . $row['PermitProcess'] . "</b></center></td>";
echo "<td><center><b>" . $row['Req'] . "</b></center></td>";
echo "<td><center><b>" . $row['SubmittalDate'] . "</b></center></td>";
echo "<td><center><b>" . $row['CommentsReceivedDate1'] . "</b></center></td>";
echo "<td><center><b>" . $row['ResubmitDate1'] . "</b></center></td>";
echo "<td><center><b>" . $row['CommentsReceivedDate2'] . "</b></center></td>";
echo "<td><center><b>" . $row['ResubmitDate2'] . "</b></center></td>";
echo "<td><center><b>" . $row['CommentsReceivedDate3'] . "</b></center></td>";
echo "<td><center><b>" . $row['ResubmitDate3'] . "</b></center></td>";
echo "<td><center><b>" . $row['CommentsReceivedDate4'] . "</b></center></td>";
echo "<td><center><b>" . $row['ResubmitDate4'] . "</b></center></td>";
echo "<td><center><b>" . $row['ApprovalDate'] . "</b></center></td>";
echo "<td><center><b>" . $row['PermitNumber'] . "</b></center></td>";
echo "<td><center><b>" . $row['CoCReqDate'] . "</b></center></td>";
echo "<td><center><b>" . $row['CoCSubmittalDate'] . "</b></center></td>";
echo "</tr>";
}
echo "</table>
</font>
</center>";

mysql_close($mysql_connect);

?>

<body>



</body>
</html>');

fclose($file);

mysql_close($mysql_connect)

?>

<body>



</body>
</html>

 

And here is the area (to narrow things down) that I'm having issues with.

 

$file = fopen("projects/project_" . $_POST['projectnumber'] .".php", "w");
echo fwrite($file, '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="http://www.game-zero.org/styles/mps.css" />
<title>MPS - Send Client Data</title>
</head>

<?php

$mysql_hostname = "localhost";
$mysql_username = "brian";
$mysql_password = "*";
$mysql_database = "mps";

$mysql_connect = mysql_connect("$mysql_hostname", "$mysql_username", "$mysql_password") or die(mysql_error());

mysql_select_db("$mysql_database") or die(mysql_error());

mysql_select_db("$mysql_database");

$result = mysql_query("SELECT * FROM 1");

echo "<style type='text/css'>
table {font-size: 65%;}
</style>
<center>
<font face='Verdana'>
<table border='1'>
<tr>
<th> Permit Process </th>
<th> Req </th>
<th> Submittal Date </th>
<th> Comments Received Date </th>
<th> Resubmit Date </th>
<th> Comments Received Date </th>
<th> Resubmit Date </th>
<th> Comments Received Date </th>
<th> Resubmit Date </th>
<th> Comments Received Date </th>
<th> Resubmit Date </th>
<th> Approval Date </th>
<th> Permit Number </th>
<th> CoC Req Date </th>
<th> CoC Submittal Date </th>
</tr>";

while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td><center><b>" . $row['PermitProcess'] . "</b></center></td>";
echo "<td><center><b>" . $row['Req'] . "</b></center></td>";
echo "<td><center><b>" . $row['SubmittalDate'] . "</b></center></td>";
echo "<td><center><b>" . $row['CommentsReceivedDate1'] . "</b></center></td>";
echo "<td><center><b>" . $row['ResubmitDate1'] . "</b></center></td>";
echo "<td><center><b>" . $row['CommentsReceivedDate2'] . "</b></center></td>";
echo "<td><center><b>" . $row['ResubmitDate2'] . "</b></center></td>";
echo "<td><center><b>" . $row['CommentsReceivedDate3'] . "</b></center></td>";
echo "<td><center><b>" . $row['ResubmitDate3'] . "</b></center></td>";
echo "<td><center><b>" . $row['CommentsReceivedDate4'] . "</b></center></td>";
echo "<td><center><b>" . $row['ResubmitDate4'] . "</b></center></td>";
echo "<td><center><b>" . $row['ApprovalDate'] . "</b></center></td>";
echo "<td><center><b>" . $row['PermitNumber'] . "</b></center></td>";
echo "<td><center><b>" . $row['CoCReqDate'] . "</b></center></td>";
echo "<td><center><b>" . $row['CoCSubmittalDate'] . "</b></center></td>";
echo "</tr>";
}
echo "</table>
</font>
</center>";

 

Does anyone see anything at all that may/will lead me to a solution to this horrific problem?

 

Here is the problem, don't think I've clearly stated it yet. I know the problem is in the area of fwrite because the source code I pasted in this topic wont execute, though if I take all of what is in the fwrite function out and just place in a simple echo statement or something simple, period, it will work just fine. So I believe this may be an issue of figuring out where to place quotes and apostrophes correctly =/

Well for some reason when I use apostrophes around what's to be executed in the fwrite function it displays all the text in red, and if I use quotes, it seems like it's displaying all the functions and html entities - so forth - with colors like it should depending on the type. Note * the colors are because I'm using Dreamweaver. And also when I use quotes, it tries to set what's behind the // in the DTD header as a comment... please, somebody help me! :[ This is really frustrating.

Er, no go. But! I did notice this:

 

$file = fopen("projects/project_" . $_POST['projectnumber'] .".php", "w");
echo fwrite($file, "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="http://www.game-zero.org/styles/mps.css" />
<title>MPS - Send Client Data</title>
</head>

 

The " (quote) right before the -//W3C... etc is by itself because everything else after it is commented out and shouldn't be... could this be a problem, and maybe it's throwing off the other quotes in the script. I mean I've basically narrowed it down to a problem with quotes and what not, just not sure what to do with this.

Er, no go. But! I did notice this:

 

$file = fopen("projects/project_" . $_POST['projectnumber'] .".php", "w");
echo fwrite($file, "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="http://www.game-zero.org/styles/mps.css" />
<title>MPS - Send Client Data</title>
</head>

 

The " (quote) right before the -//W3C... etc is by itself because everything else after it is commented out and shouldn't be... could this be a problem, and maybe it's throwing off the other quotes in the script. I mean I've basically narrowed it down to a problem with quotes and what not, just not sure what to do with this.

 

Oh, whoops, forgot you said fwrite and not fopen. xD

Here:

echo fwrite($file, '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>

 

Use single quotes around the whole thing, so the double quotes don't destroy your query.  You could have escaped them, but this is easier.

You can not have single quotes inside a single quoted string without escaping them. The same with double quoted strings.

I would take an entirely different path. Having that long string in very confusing (at least to me).

 

Try this:

<?php
$tmp = array();
$tmp[] = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
$tmp[] = '<html xmlns="http://www.w3.org/1999/xhtml">';
$tmp[] = '<head>';
$tmp[] = '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />';
$tmp[] = '<link rel="stylesheet" type="text/css" href="http://www.game-zero.org/styles/mps.css" />';
$tmp[] = '<title>MPS - Send Client Data</title>';
$tmp[] = '</head>';
$tmp[] = '<?php';

$tmp[] = '$mysql_hostname = "localhost";';
$tmp[] = '$mysql_username = "brian";';
$tmp[] = '$mysql_password = "*";';
$tmp[] = '$mysql_database = "mps";';

$tmp[] = '$mysql_connect = mysql_connect("$mysql_hostname", "$mysql_username", "$mysql_password") or die(mysql_error());';

$tmp[] = 'mysql_select_db("$mysql_database") or die(mysql_error());';

$tmp[] = 'mysql_select_db("$mysql_database");';

$tmp[] = '$result = mysql_query("SELECT * FROM 1");';

$tmp[] = 'echo "<style type=\'text/css\'>';
$tmp[] = 'table {font-size: 65%;}';
$tmp[] = '</style>';
$tmp[] = '<center>';
$tmp[] = '<font face="Verdana">''
$tmp[] = '<table border="1">';
$tmp[] = '<tr>';
$tmp[] = '<th> Permit Process </th>';
$tmp[] = '<th> Req </th>';
$tmp[] = '<th> Submittal Date </th>';
$tmp[] = '<th> Comments Received Date </th>';
$tmp[] = '<th> Resubmit Date </th>';
$tmp[] = '<th> Comments Received Date </th>';
$tmp[] = '<th> Resubmit Date </th>';
$tmp[] = '<th> Comments Received Date </th>';
$tmp[] = '<th> Resubmit Date </th>';
$tmp[] = '<th> Comments Received Date </th>';
$tmp[] = '<th> Resubmit Date </th>';
$tmp[] = '<th> Approval Date </th>';
$tmp[] = '<th> Permit Number </th>';
$tmp[] = '<th> CoC Req Date </th>';
$tmp[] = '<th> CoC Submittal Date </th>';
$tmp[] = '</tr>";';
$tmp[] = 'while($row = mysql_fetch_array($result))';
$tmp[] = '{';
$tmp[] = 'echo "<tr>";';
$tmp[] = 'echo "<td><center><b>" . $row['PermitProcess'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row['Req'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row['SubmittalDate'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row['CommentsReceivedDate1'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row['ResubmitDate1'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row['CommentsReceivedDate2'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row['ResubmitDate2'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row['CommentsReceivedDate3'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row['ResubmitDate3'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row['CommentsReceivedDate4'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row['ResubmitDate4'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row['ApprovalDate'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row['PermitNumber'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row['CoCReqDate'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row['CoCSubmittalDate'] . "</b></center></td>";';
$tmp[] = 'echo "</tr>";';
$tmp[] = '}';
$tmp[] = 'echo "</table>';
$tmp[] = '</font>';
$tmp[] = '</center>";';
$tmp[] = 'mysql_close($mysql_connect);';
$tmp[] = '?>';
$tmp[] = '<body>';
$tmp[] = '</body>;'
$tmp[] = '</html>';
echo fwrite($file, implode("\n",$tmp)."\n");
?>

 

BTW, don't bump your question too quickly. Wait at least 3 to 4 hours.

 

Ken

:o Still no luck... I just know it's a problem with those quotes and apostrophes. Here is what I have right now:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="http://www.game-zero.org/styles/mps.css" />"
<title>MPS - Send Client Data</title>
</head>

<?php

$mysql_hostname = "localhost";
$mysql_username = "brian";
$mysql_password = "*";
$mysql_database = "mps";

$mysql_connect = mysql_connect("$mysql_hostname", "$mysql_username", "$mysql_password") or die(mysql_error());

mysql_select_db("$mysql_database") or die(mysql_error());

$insert_one = "INSERT INTO mps_cdata (projectnumber, projectname, clientname, clientaddress, clientofficephone, clientfax, clientcell, clientemail)
VALUES
('$_POST[projectnumber]','$_POST[projectname]','$_POST[clientname]','$_POST[clientaddress]','$_POST[clientofficephone]','$_POST[clientfax]','$_POST[clientcell]','$_POST[clientemail]')";

if (!mysql_query($insert_one, $mysql_connect))

{

die(mysql_error());

}

mysql_select_db("$mysql_database") or die(mysql_error());

$insert_two = "CREATE TABLE `{$_POST['projectnumber']}`
(
PermitProcess varchar(40),
Req char(3),
SubmittalDate date,
CommentsReceivedDate1 date,
ResubmitDate1 date,
CommentsReceivedDate2 date,
ResubmitDate2 date,
CommentsReceivedDate3 date,
ResubmitDate3 date,
CommentsReceivedDate4 date,
ResubmitDate4 date,
ApprovalDate date,
PermitNumber varchar(10),
CoCReqDate date,
CoCSubmittalDate date
)";
mysql_query($insert_two, $mysql_connect);

mysql_select_db("$mysql_database") or die(mysql_error());

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('COUNTY PRE-APP MEETING')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('FDOT PRE-APP MEETING')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('ERP PRE-APP MEETING')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('COUNTY PRELIMINARY PLAT APPROVAL')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('REZONING APPROVAL (BY OTHERS)')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('COUNTY CONSTRUCTION PLAN APPROVAL')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('FDOT DRIVEWAY CONNECTION PERMIT')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('FDOT DRAINAGE CONNECTION PERMIT')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('FDOT UTILITY PERMIT')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('NOTICE TO R/W USERS')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('FDEP/ECUA SANITARY SEWER PERMIT')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('FDEP/ECUA POTABLE WATER PERMIT')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('SEPERATE UTILITY APPROVAL')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('FDEP/ERP STORMWATER PERMIT')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('FDEP DREDGE & FILL PERMIT')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('COE DREDGE & FILL PERMIT')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('NPDES PERMIT')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('ADEM PERMIT')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('FINAL PLAT')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('FDEP/ERP CERTIFICATION OF COMPLETION')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('ERP REQUEST FOR CONVERSION TO OP. PERMIT')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('NPDES NOTICE OF TERMINATION')");

mysql_query("INSERT INTO `{$_POST['projectnumber']}` (PermitProcess)
VALUES ('ADEM NOTICE OF TERMINATION')");

?>

Your entry has been added to the database. Return <a href="http://www.game-zero.org/mps/home.php">home</a> or <a href="http://www.game-zero.org/mps/view_cdata.php">view client data</a>.

<?php

$file = fopen("projects/project_" . $_POST['projectnumber'] .".php", "w");
$tmp = array();
$tmp[] = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
$tmp[] = '<html xmlns="http://www.w3.org/1999/xhtml">';
$tmp[] = '<head>';
$tmp[] = '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />';
$tmp[] = '<link rel="stylesheet" type="text/css" href="http://www.game-zero.org/styles/mps.css" />';
$tmp[] = '<title>MPS - Send Client Data</title>';
$tmp[] = '</head>';
$tmp[] = '<?php';

$tmp[] = '$mysql_hostname = "localhost";';
$tmp[] = '$mysql_username = "brian";';
$tmp[] = '$mysql_password = "*";';
$tmp[] = '$mysql_database = "mps";';

$tmp[] = '$mysql_connect = mysql_connect("$mysql_hostname", "$mysql_username", "$mysql_password") or die(mysql_error());';

$tmp[] = 'mysql_select_db("$mysql_database") or die(mysql_error());';

$tmp[] = 'mysql_select_db("$mysql_database");';

$tmp[] = '$result = mysql_query("SELECT * FROM 1");';

$tmp[] = 'echo "<style type=\'text/css\'>';
$tmp[] = 'table {font-size: 65%;}';
$tmp[] = '</style>';
$tmp[] = '<center>';
$tmp[] = '<font face="Verdana">''
$tmp[] = '<table border="1">';
$tmp[] = '<tr>';
$tmp[] = '<th> Permit Process </th>';
$tmp[] = '<th> Req </th>';
$tmp[] = '<th> Submittal Date </th>';
$tmp[] = '<th> Comments Received Date </th>';
$tmp[] = '<th> Resubmit Date </th>';
$tmp[] = '<th> Comments Received Date </th>';
$tmp[] = '<th> Resubmit Date </th>';
$tmp[] = '<th> Comments Received Date </th>';
$tmp[] = '<th> Resubmit Date </th>';
$tmp[] = '<th> Comments Received Date </th>';
$tmp[] = '<th> Resubmit Date </th>';
$tmp[] = '<th> Approval Date </th>';
$tmp[] = '<th> Permit Number </th>';
$tmp[] = '<th> CoC Req Date </th>';
$tmp[] = '<th> CoC Submittal Date </th>';
$tmp[] = '</tr>";';
$tmp[] = 'while($row = mysql_fetch_array($result))';
$tmp[] = '{';
$tmp[] = 'echo "<tr>";';
$tmp[] = 'echo "<td><center><b>" . $row['PermitProcess'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row['Req'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row['SubmittalDate'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row['CommentsReceivedDate1'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row['ResubmitDate1'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row['CommentsReceivedDate2'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row['ResubmitDate2'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row['CommentsReceivedDate3'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row['ResubmitDate3'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row['CommentsReceivedDate4'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row['ResubmitDate4'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row['ApprovalDate'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row['PermitNumber'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row['CoCReqDate'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row['CoCSubmittalDate'] . "</b></center></td>";';
$tmp[] = 'echo "</tr>";';
$tmp[] = '}';
$tmp[] = 'echo "</table>';
$tmp[] = '</font>';
$tmp[] = '</center>";';
$tmp[] = 'mysql_close($mysql_connect);';
$tmp[] = '?>';
$tmp[] = '<body>';
$tmp[] = '</body>;'
$tmp[] = '</html>';
echo fwrite($file, implode("\n",$tmp)."\n");

fclose($file);

mysql_close($mysql_connect)

?>

<body>



</body>
</html>

 

Maybe I positioned the code incorrectly?

 

Well... another thing. Now I'm looking at

 

$tmp[] = '?>';

 

and everything that's PHP which comes after that doesn't show up colored as it should... :/

I also took out an apostrophe changing

 

$tmp[] = '<font face="Verdana">''

 

to

 

$tmp[] = '<font face="Verdana">'

 

and took out the quote in

 

$tmp[] = 'echo "<style type=\'text/css\'>';

 

changing it to

 

$tmp[] = 'echo <style type=\'text/css\'>';

 

which drastically changed the color of some entities and functions in Dreamweaver how they should normally be. But still no luck.

Sorry for the typos.

 

Editors that colorize get confused when you have a "?>" in quotes in the stream. If you don't like that, you can do:

<?php
$tmp[] = '?' . '>';
?>

 

It's not really technical. All this code is doing is putting each line into an array then writing the result of the explode(). The explode put a newline character between each line.

 

Ken

I took a closer look at the code and made a few modifications to it. Here's the result:

<?php
$tmp[] = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
$tmp[] = '<html xmlns="http://www.w3.org/1999/xhtml">';
$tmp[] = '<head>';
$tmp[] = '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />';
$tmp[] = '<link rel="stylesheet" type="text/css" href="http://www.game-zero.org/styles/mps.css" />';
$tmp[] = '<title>MPS - Send Client Data</title>';
$tmp[] = '</head>';
$tmp[] = '<?php';

$tmp[] = '$mysql_hostname = "localhost";';
$tmp[] = '$mysql_username = "brian";';
$tmp[] = '$mysql_password = "*";';
$tmp[] = '$mysql_database = "mps";';

$tmp[] = '$mysql_connect = mysql_connect("$mysql_hostname", "$mysql_username", "$mysql_password") or die(mysql_error());';

$tmp[] = 'mysql_select_db("$mysql_database") or die(mysql_error());';

$tmp[] = 'mysql_select_db("$mysql_database");';

$tmp[] = '$result = mysql_query("SELECT * FROM 1");';
$tmp[] = '?' . '>';
$tmp[] = '<style type="text/css">';
$tmp[] = 'table {font-size: 65%;}';
$tmp[] = '</style>';
$tmp[] = '<center>';
$tmp[] = '<font face="Verdana">';
$tmp[] = '<table border="1">';
$tmp[] = '<tr>';
$tmp[] = '<th> Permit Process </th>';
$tmp[] = '<th> Req </th>';
$tmp[] = '<th> Submittal Date </th>';
$tmp[] = '<th> Comments Received Date </th>';
$tmp[] = '<th> Resubmit Date </th>';
$tmp[] = '<th> Comments Received Date </th>';
$tmp[] = '<th> Resubmit Date </th>';
$tmp[] = '<th> Comments Received Date </th>';
$tmp[] = '<th> Resubmit Date </th>';
$tmp[] = '<th> Comments Received Date </th>';
$tmp[] = '<th> Resubmit Date </th>';
$tmp[] = '<th> Approval Date </th>';
$tmp[] = '<th> Permit Number </th>';
$tmp[] = '<th> CoC Req Date </th>';
$tmp[] = '<th> CoC Submittal Date </th>';
$tmp[] = '</tr>";';
$tmp[] = '<' . '?php';
$tmp[] = 'while($row = mysql_fetch_array($result))';
$tmp[] = '{';
$tmp[] = 'echo "<tr>";';
$tmp[] = 'echo "<td><center><b>" . $row[\'PermitProcess\'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row[\'Req\'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row[\'SubmittalDate\'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row[\'CommentsReceivedDate1\'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row[\'ResubmitDate1\'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row[\'CommentsReceivedDate2\'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row[\'ResubmitDate2\'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row[\'CommentsReceivedDate3\'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row[\'ResubmitDate3\'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row[\'CommentsReceivedDate4\'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row[\'ResubmitDate4\'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row[\'ApprovalDate\'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row[\'PermitNumber\'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row[\'CoCReqDate\'] . "</b></center></td>";';
$tmp[] = 'echo "<td><center><b>" . $row[\'CoCSubmittalDate\'] . "</b></center></td>";';
$tmp[] = 'echo "</tr>";';
$tmp[] = '}';
$tmp[] = 'echo "</table>';
$tmp[] = '</font>';
$tmp[] = '</center>";';
$tmp[] = 'mysql_close($mysql_connect);';
$tmp[] = '?>';
$tmp[] = '<body>';
$tmp[] = '</body>';
$tmp[] = '</html>';
?>

 

Here is the resultant file:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="http://www.game-zero.org/styles/mps.css" />
<title>MPS - Send Client Data</title>
</head>
<?php
$mysql_hostname = "localhost";
$mysql_username = "brian";
$mysql_password = "*";
$mysql_database = "mps";
$mysql_connect = mysql_connect("$mysql_hostname", "$mysql_username", "$mysql_password") or die(mysql_error());
mysql_select_db("$mysql_database") or die(mysql_error());
mysql_select_db("$mysql_database");
$result = mysql_query("SELECT * FROM 1");
?>
<style type="text/css">
table {font-size: 65%;}
</style>
<center>
<font face="Verdana">
<table border="1">
<tr>
<th> Permit Process </th>
<th> Req </th>
<th> Submittal Date </th>
<th> Comments Received Date </th>
<th> Resubmit Date </th>
<th> Comments Received Date </th>
<th> Resubmit Date </th>
<th> Comments Received Date </th>
<th> Resubmit Date </th>
<th> Comments Received Date </th>
<th> Resubmit Date </th>
<th> Approval Date </th>
<th> Permit Number </th>
<th> CoC Req Date </th>
<th> CoC Submittal Date </th>
</tr>
<?php
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td><center><b>" . $row['PermitProcess'] . "</b></center></td>";
echo "<td><center><b>" . $row['Req'] . "</b></center></td>";
echo "<td><center><b>" . $row['SubmittalDate'] . "</b></center></td>";
echo "<td><center><b>" . $row['CommentsReceivedDate1'] . "</b></center></td>";
echo "<td><center><b>" . $row['ResubmitDate1'] . "</b></center></td>";
echo "<td><center><b>" . $row['CommentsReceivedDate2'] . "</b></center></td>";
echo "<td><center><b>" . $row['ResubmitDate2'] . "</b></center></td>";
echo "<td><center><b>" . $row['CommentsReceivedDate3'] . "</b></center></td>";
echo "<td><center><b>" . $row['ResubmitDate3'] . "</b></center></td>";
echo "<td><center><b>" . $row['CommentsReceivedDate4'] . "</b></center></td>";
echo "<td><center><b>" . $row['ResubmitDate4'] . "</b></center></td>";
echo "<td><center><b>" . $row['ApprovalDate'] . "</b></center></td>";
echo "<td><center><b>" . $row['PermitNumber'] . "</b></center></td>";
echo "<td><center><b>" . $row['CoCReqDate'] . "</b></center></td>";
echo "<td><center><b>" . $row['CoCSubmittalDate'] . "</b></center></td>";
echo "</tr>";
}
echo "</table>
</font>
</center>";
mysql_close($mysql_connect);
?>
<body>
</body>
</html>

 

What I don't understand is why you're doing this?

 

Ken

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.