For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > December 2006 > unexpected t_variable









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author unexpected t_variable
_Skare_Krow_

2006-12-23, 9:58 pm

I'm having trouble with my code and it barfs on the last line I have
included the lines before it are below
$histid = $_GET["histid"];
$sql = "select * from main_hist where histid = '$histid'";
$result = mysql_query($sql);
$r = mysql_fetch_array($result)
$maint_done = $r["maint_done"];
does anyone see anything wrong with this or do I need to include more of
the code.

Aaron
Hendri Kurniawan

2006-12-23, 9:58 pm

See the actual error code... It will say which line the problem lies.
In this instance... see the line:

$r = mysql_fetch_array($result)

You missed the terminating character (semi-colon).

Hendri

_Skare_Krow_ wrote:
> I'm having trouble with my code and it barfs on the last line I have
> included the lines before it are below
> $histid = $_GET["histid"];
> $sql = "select * from main_hist where histid = '$histid'";
> $result = mysql_query($sql);
> $r = mysql_fetch_array($result)
> $maint_done = $r["maint_done"];
> does anyone see anything wrong with this or do I need to include more of
> the code.
>
> Aaron

pangea33

2006-12-23, 9:58 pm


_Skare_Krow_ wrote:
> I'm having trouble with my code and it barfs on the last line I have
> included the lines before it are below
> $histid = $_GET["histid"];
> $sql = "select * from main_hist where histid = '$histid'";
> $result = mysql_query($sql);
> $r = mysql_fetch_array($result)
> $maint_done = $r["maint_done"];
> does anyone see anything wrong with this or do I need to include more of
> the code.
>
> Aaron


As in your case, this is often caused by a missing semi-colon.

$r = mysql_fetch_array($result)

_Skare_Krow_

2006-12-23, 9:58 pm

That's a real big duh!


_Skare_Krow_ wrote:
> I'm having trouble with my code and it barfs on the last line I have
> included the lines before it are below
> $histid = $_GET["histid"];
> $sql = "select * from main_hist

where histid = '$histid'";
> $result = mysql_query($sql);
> $r = mysql_fetch_array($result)
> $maint_done = $r["maint_done"];
> does anyone see anything wrong with this or do I need to include more of
> the code.
>
> Aaron

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com