Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
help a newbie with code
Old 09-18-2010, 12:31 PM help a newbie with code
Average Talker

Posts: 17
Name: charlie
Trades: 0
this is what I get when I execute the below code?

Quote:
Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in C:\xampp\htdocs\hofiles\receipts2.php on line 23
PHP Code:
<?php
$apt
=$_POST['apt'];
$name=$_POST['name'];
$amtpaid=$_POST['amtpaid'];
$datepaid=$_POST['datepaid'];
$stat mysql_connect(localhost,root,"") or die('Unable to connect to database: ' mysql_error()); 
$stat mysql_select_db(prerentdb) or die('Unable to select database: ' mysql_error()); 
if(!empty(
$_POST["submit"]))
{
 
$apt $_POST['apt'];
 
$query="SELECT * FROM payments Where apt='$apt'";
 
$result=mysql_query($query);
 if(
mysql_num_rows($result))
?>
<html><body>
<font size=2><b>Hammock Oaks Apartments</font>
&nbsp;&nbsp;&nbsp;Rent Receipt<p>
<?php
 
{
  echo 
"<form action='#' method='post'>
        while(
$row = mysql_fetch_assoc($result))
  {
      echo "
$name in apartment $apt has paid $amtpaid on this day $datepaid<br />";}
          else{echo "
No listing for appartment $apt.<br />Please select another.";
 }
?>
<form method="
post" action="#">
 
<br />
 <
input type="text" name="apt"/> <p>
<
input type="submit" name="submit" value="receipt apartment"/>
</
form>
</
b></body></html>
ckdoublenecks is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-18-2010, 01:08 PM Re: help a newbie with code
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
and line 23 would be??


because you have a missing , or ; before it.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 09-18-2010, 01:51 PM Re: help a newbie with code
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
As I suggested to you in this thread, if you use an editor with syntax highlighting these problems become much easier to spot.

If you take a look at line 23 and the line before it with syntax highlighting on you'll see the issue.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is offline
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 09-18-2010, 04:05 PM Re: help a newbie with code
Average Talker

Posts: 17
Name: charlie
Trades: 0
I've been staring at it and trying different things pertaining to those two lines but I'm just trying to learn PHP and so... what editor with syntax highlighting do you suggest?
ckdoublenecks is offline
Reply With Quote
View Public Profile
 
Old 09-18-2010, 04:32 PM Re: help a newbie with code
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
Notepad++. You forgot your ending quote and semicolon on this line:
PHP Code:
echo "<form action='#' method='post'> 
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is offline
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 09-18-2010, 04:48 PM Re: help a newbie with code
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
I'll second the vote for Notepad++.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 09-18-2010, 05:32 PM Re: help a newbie with code
lynxus's Avatar
Awesomeo-Maximo

Posts: 1,618
Location: UK
Trades: 1
+1 for Notepad++ ( or any syntax highlighter. )

People wont look down on you for using syntax highlighting. Its there for a reason.
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


lynxus is offline
Reply With Quote
View Public Profile Visit lynxus's homepage!
 
Reply     « Reply to help a newbie with code
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.28427 seconds with 12 queries