ID:               15790
 Updated by:       [EMAIL PROTECTED]
-Summary:          Getting Parse error when trying to access page. I
                   believe it's related to mysql
 Reported By:      [EMAIL PROTECTED]
 Status:           Bogus
 Bug Type:         MySQL related
 Operating System: Mac OS 10.1.3 (Darwin 5.3)
 PHP Version:      4.1.2
 New Comment:

I didn't write this code. I copied it from an example which 
is why I'm confused why it is not working.

I was curious if it would work for other people, because 
maybe it's a problem with Darwin. Being that my version of 
MySql is not the newest and I don't have a full version of 
Apache.


Previous Comments:
------------------------------------------------------------------------

[2002-03-01 03:43:17] [EMAIL PROTECTED]

The bug system is not the appropriate forum for asking support
questions. For a list of a range of more appropriate places to ask
for help using PHP, please visit http://www.php.net/support.php



------------------------------------------------------------------------

[2002-02-28 21:07:58] [EMAIL PROTECTED]

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;  
        }  
?> 

------------------------------------------------------------------------

[2002-02-28 17:28:56] [EMAIL PROTECTED]

Please give a SHORTER example of the code which doesn't work. 

Anyway, if that's the file billing.php, then the line 2 would be the
empty one ...

------------------------------------------------------------------------

[2002-02-28 14:20:40] [EMAIL PROTECTED]

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>

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=15790&edit=1

Reply via email to