# Parse error

**URL:** <https://forum.kirupa.com/t/parse-error/14579>\
**Category:** programming\
**Created:** [February 28, 2003, 12:01am UTC](https://forum.kirupa.com/t/parse-error/14579 "2003-02-28T00:01:42Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![illusions](https://avatars.discourse-cdn.com/v4/letter/i/b3f665/32.png) [@illusions](https://forum.kirupa.com/u/illusions)\
**Post date:** [February 28, 2003, 12:01am UTC](https://forum.kirupa.com/t/parse-error/14579/1 "2003-02-28T00:01:42Z")

</div>

I get this error… And I can’t find out what’s wrong…

Parse error: parse error, unexpected ‘;’ in g:\apache\www\guestbook.php on line 44

Here’s the code where the error is. (the table line is 37, error in 44, but the “;” can’t be the error… or?)  
\<br\>

\<table bgcolor="#AAAAAA" border=“0” Width=“75%” cellspacing=“1” cellpadding=“2”\>\<br\>  
\<?php\<br\>  
$query = “SELECT \* FROM guestbook ORDER BY date\_auto”;\<br\>  
$result = mysql\_query($query, $connection);  
\<p\> for ($i = 0; $i \< mysql\_num\_rows($result); $i++)\<br\>  
(\<br\>  
$name = mysql\_result($result, $i, “name”); //Line 44 \<br\>  
$email = mysql\_result($result, $i, “email”);\<br\>  
$email\_len = strlen($email);\<br\>  
$comment = mysql\_result($result, $i, “comment”);\<br\>  
$date = mysql\_result($result, $i, “date\_auto”);\<br\>  
$show\_date = date(“H:i:s d/m/y”, $date);\</p\>  
\<p\> echo ‘\<tr\>\<td bgcolor="#EEEEEE"\>\<br\>  
\<font\> face=“verdana” size=“2”\>’;\<br\>  
if ($email \> 0)\<br\>  
{\<br\>  
echo ‘\<b\>Name:\</b\> \<a href="mailto:’ . $email . ‘"\>’  
. $name . ‘\</a\>’;\<br\>  
}\<br\>  
else\<br\>  
{\<br\>  
echo ‘\<b\>Name:\</b\> ‘. $name;\<br\>  
}\<br\>  
echo ‘\<br\>  
\<br\>\<br\>  
\<b\>Comment:\</b\> ’ . $comment .’\</font\>\<br\>  
\<td\>\<br\>  
\<td widht=“1%” valign=“top” nowrap bgcolor="#EEEEEE"\>\<br\>  
\<font\>\<br\>  
\<b\>Date: \</b\>’ . $show\_date .’\<br\>  
\</font\>\<br\>  
\</td\>\<br\>  
\</tr\>\<br\>  
';\<br\>  
)\<br\>  
?\>\<br\>  
\</table\>

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 28, 2003, 9:17pm UTC](https://forum.kirupa.com/t/parse-error/14579/2 "2003-02-28T21:17:06Z")

</div>

```php

<table bgcolor="#AAAAAA" border="0" Width="75%" cellspacing="1" cellpadding="2">

<?php

$query = "SELECT * FROM guestbook ORDER BY date_auto";

$result = mysql_query($query, $connection);

for ($i = 0; $i < mysql_num_rows($result); $i++)
{
   $name = mysql_result($result, $i, "name"); //Line 44 
   $email = mysql_result($result, $i, "email");
   $email_len = strlen($email);
   $comment = mysql_result($result, $i, "comment");
   $date = mysql_result($result, $i, "date_auto");
   $show_date = date("H:i:s d/m/y", $date);

   echo '<tr><td bgcolor="#EEEEEE"><font> face="verdana" size="2">';

   if ($email > 0)
   {
      echo '<b>Name:</b> <a href="mailto:' . $email . '">' . $name . '</a>';
   }
   else
   {
      echo '<b>Name:</b> '. $name;
   }

   echo '<br> <b>Comment:</b> ' . $comment .'</font><td><td width="1%" valign="top" nowrap bgcolor="#EEEEEE">';
   echo '<font><b>Date: </b>' . $show_date .'</font></td></tr>';
}
?>
</table>

```

Okay man… I fixed her up for you… And I even added a little bit of management code wise… I think the first tutorial I’m going to create is how to write good looking code… :)… It’s alot easier to debug this way huh? hehe…

The main problem was… After your for loop you had a ( instead of { be careful about that buddy 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 28, 2003, 9:28pm UTC](https://forum.kirupa.com/t/parse-error/14579/3 "2003-02-28T21:28:46Z")

</div>

Thanx!

Yeah, it’s better when using “coding rules” 🙂

The code don’t look like taht here, it just became like that when I pasted it,

btw, how did ya make it look like taht??

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 28, 2003, 9:33pm UTC](https://forum.kirupa.com/t/parse-error/14579/4 "2003-02-28T21:33:42Z")

</div>

hmm… taht?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 28, 2003, 10:09pm UTC](https://forum.kirupa.com/t/parse-error/14579/5 "2003-02-28T22:09:23Z")

</div>

use PHP tags… put (php) before your code and (/php) after your code. But change the ( and ) to [and]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 28, 2003, 10:18pm UTC](https://forum.kirupa.com/t/parse-error/14579/6 "2003-02-28T22:18:36Z")

</div>

hmm, let me try that out

```php

<table bgcolor="#AAAAAA" border="0" Width="75%" cellspacing="1" cellpadding="2">

<?php

$query = "SELECT * FROM guestbook ORDER BY date_auto";

$result = mysql_query($query, $connection);

```

yeah, looks good!

Thanx!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 28, 2003, 10:34pm UTC](https://forum.kirupa.com/t/parse-error/14579/7 "2003-02-28T22:34:53Z")

</div>

😉

Anytime good buddy… 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 28, 2003, 10:47pm UTC](https://forum.kirupa.com/t/parse-error/14579/8 "2003-02-28T22:47:05Z")

</div>

For future debugging:  
always check the line before the one the error message throws back @ you…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 28, 2003, 11:04pm UTC](https://forum.kirupa.com/t/parse-error/14579/9 "2003-02-28T23:04:30Z")

</div>

Alognw itht he line it states 😉

Good point eyez.
