|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-02-28 14:20 UTC] jasonr at dream2create dot com
OS: Mac OS 10.1.3
Apache: 1.3.22 (DARWIN)
PHP: 4.1.2
mySQL: 3.23.48
This is the error I get when I try to accecss the page:
"Parse error: parse error in /Library/WebServer/Documents/
timemanagement/billing.php on line 2"
Code:
<?php
$db?=?mysql_connect?("localhost",?"user",?"password");?
mysql_select_db?("database",?$db);
????if?($submit)?{?
????????if?($clientsubmit)?{?
????????????$sql?=?"?
????????????????INSERT?INTO?client?(client)
????????????????VALUES?('$newclient')
????????????";?
????????????$result?=?mysql_query($sql);?
????????}?else?if?($submitbill)?{?
????????????$sql?=?"?
????????????????INSERT?INTO?billing?(employee,?client,?job_
type,?time_spent,?billable,?description,?wage)
????????????????VALUES?('$employee', '$client', '$jobtype',
'$timespent', '$billable', '$desc', '$wage')
????????????";?
????????????$result?=?mysql_query($sql);?
????????????echo?"Thank?you?for?your?entry, <a?href=
'billing.php?employee=$employee'>click?here</
a>?to?enter?another.</a>";?
????????????exit;?
????????}?
?>?
<html>
<head>
<title>Billing</title>
</head>
<body>
<form method="POST" action="billing.php">
????<table>
????????<tr>
????????????<td>Client</td>
????????????<td>Job Type</td>
????????????<td>Time Spent (hrs)</td>
????????????<td>Wage</td>
????????????<td>Billable</td>
????????????<td>Description</td>
????????</tr>
????????<tr>
????????????<td>
????????????????<select name="client">
<?php?
????????$sql?=?"
????????????SELECT id, client
????????????FROM client
????????";?
????????$result?=?mysql_query($sql);?
????????while?($row?=?mysql_fetch_array($result))??
????????{?
????????????$client?=?$row["client"];?
????????????$id?=?$row["id"];?
????????????echo?"<option?value='$id'>$client</option>";?
????????}?
?>?
????????????????</select>
????????????</td>
????????????<td>
????????????????<select name="jobtype">
????????????????????<option value="Support">Technical
Support</option>
????????????????????<option value="Programming">
Programming</option>
????????????????????<option value="Accounting">Accounting</
option>
????????????????????<option value="Consulting">
Consultation</option>
????????????????</select>
????????????</td>
????????????<td>
????????????????<input type="text" name="timespent" size=
"4">
????????????</td>
????????????<td>
????????????????<select name="wage">
????????????????????<option value="20">$20 x hr</option>
????????????????????<option value="40">$40 x hr</option>
????????????????????<option value="60">$60 x hr</option>
????????????????????<option value="80">$80 x hr</option>
????????????????????<option value="100">$100 x hr</option>
????????????????</select>
????????????</td>
????????????<td>
????????????????<select name="billable">
????????????????????<option value="1">Yes</option>
????????????????????<option value="2">No</option>
????????????????</select>
????????????</td>
????????????<td>
????????????????<textarea name="desc"></textarea>
????????????</td>
????????</tr>
????????<tr>
????????????<td colspan="5">
????????????????<input type="hidden" name="employee" value=
"<?php?echo?$employee;?>">
????????????????<input type="hidden" name="submit" value=
"1">??
????????????????<input type="submit" name="submitbill"
value="Submit Billing">
????????????</td>
????????</tr>
????</table>
</form>
<br><br>
<hr>
<form method="POST" action="billing.php">
????Add new client: <input type="text" name="newclient">
????<input type="hidden" name="employee" value="<
?php?echo?$employee;?>">
????<input type="hidden" name="submit" value="1">
????<input type="submit" name="clientsubmit" value="Submit
New Client">
</form>
<??
????}?/* End of if ($submit) */?
????else??
????{?
????????$employees?=?array?("Patrick",?"Avi",?"Sara",?"Jess
ica",?"Tasha",?"Vegi");?
????????$j?=?count?($employees);?
?>?
<form method='POST' action='billing.php'>
????<select name='employee'>
<?php?
????????for?($i?=?0;?$i?<?$j;?$i++)?{?
????????????echo?"<option?value='{$employees[$i]}'>
{$employees[$i]}</option>";?
????????}?
?>?
????</select>
????<input type='submit' name='submit'>
</form>
<?php?
????}?
?>
</body>
</html>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 22 11:00:01 2025 UTC |
OS: Mac OS 10.1.3 Apache: 1.3.22 (DARWIN) PHP: 4.1.2 mySQL: 3.23.48 This is the error I get when I try to accecss the page: "Parse error: parse error in /Library/WebServer/Documents/ timemanagement/billing.php on line 2" When I moved the "$db = mysql_connect..." line (whether up or down) the line error changes accordingly. I have another page with a similar beginning and it is getting the same error. Code from billing.php: <?php $db?=?mysql_connect?("localhost",?"user",?"password");? mysql_select_db?("database",?$db); ????if?($submit)?{? ????????if?($clientsubmit)?{? ????????????$sql?=?"? ????????????????INSERT?INTO?client?(client) ????????????????VALUES?('$newclient') ????????????";? ????????????$result?=?mysql_query($sql);? ????????}?else?if?($submitbill)?{? ????????????$sql?=?"? ????????????????INSERT?INTO?billing?(employee,?client,?job_ type,?time_spent,?billable,?description,?wage) ????????????????VALUES?('$employee', '$client', '$jobtype', '$timespent', '$billable', '$desc', '$wage') ????????????";? ????????????$result?=?mysql_query($sql);? ????????????echo?"Thank?you?for?your?entry, <a?href= 'billing.php?employee=$employee'>click?here</ a>?to?enter?another.</a>";? ????????????exit;? ????????}? ?>?