Forum Moderators: coopster

Message Too Old, No Replies

Parse error message

         

rwoodfork

4:25 am on Jan 21, 2009 (gmt 0)

10+ Year Member



I get the folowing error message when executing the PHP script below:

Parse error: parse error, unexpected T_VARIABLE in /home/content/d/e/a/dealer1/html/detail.php on line 8

The beginning of the code is below. Line 8 is the one that reads, "$debugD = 0". Can someone please help me with fixing this error message.

<? php
############################################################
# DETAIL.PHP BY DANIEL BOORN
# COPYRIGHT (C) DANIEL BOORN, ALL RIGHTS RESERVED
############################################################

### DEBUG
$debugD = 0;
### END DEBUG

## Fetch database connection
require_once('Connections/myconn.php');
mysql_select_db($database_myconn, $myconn);

## Get Listing ID or set default
$colname_p = "1";//default
if (isset($_GET['id'])) {
$colname_p = (get_magic_quotes_gpc()) ? $_GET['id'] : addslashes($_GET['id']);
}

## Fetch property information
$query_p = "SELECT *,Date_Format(pdate,'%M %D %Y') as pdate FROM items WHERE id = ". $colname_p;
## DEBUG
if($debugD) echo 'Property SQL<hr>'.$query_p.'<br><br>';
$p = mysql_query($query_p, $myconn) or die(mysql_error());
$row_p = mysql_fetch_assoc($p);
$totalRows_p = mysql_num_rows($p);

## Update Hits ############
$newhits = ($row_p['hits'] * 1) + 1;
$update = "update items set hits =" . $newhits . " where id = ". $row_p['id'];
mysql_query($update,$myconn) or die(mysql_error());

## Fetch member contact information
$query_m = "select * from members where id = " . $row_p['mid'];
# DEBUG
if($debugD) echo 'Member Sql<hr>'.$query_m.'<br><br>';
$m = mysql_query($query_m,$myconn) or die(mysql_error());
$row_m = mysql_fetch_assoc($m);

## Fetch Header
$siteTitle = $row_p['address'] . ' - ' . $row_p['city'] . ", " . $row_p['state'] . " " . $row_p['zip'] . ' : ';
include('header.php');

?>

henry0

12:19 pm on Jan 21, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



rwoodfork, welcome to WebmasterWorld!

this kind of error most often comes from above the error line
Here you have an extra space in
<? php
which obviously got to be <?php :)

Habtom

12:32 pm on Jan 21, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<? php

There is a space in between.

change to

<?php

rwoodfork

3:10 pm on Jan 21, 2009 (gmt 0)

10+ Year Member



Thank you for your response. When I delete the space to make it <?php, I get the following error:

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

eelixduppy

5:50 pm on Jan 21, 2009 (gmt 0)



Echo out your queries before you send them to MySQL. Seems to me that you might have a quote in there that may be coming from the variables. Check the syntax and correct it if needed.

Habtom

6:17 pm on Jan 21, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



SELECT *,Date_Format(pdate,'%M %D %Y') as pdate

I am not sure the above is a correct syntax, either it is

SELECT *

or

SELECT Date_Format(pdate,'%M %D %Y') as pdate

henry0

6:25 pm on Jan 21, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Too many bugs, end quotes missing
magic_quotes: if no magic quotes there is no mysql_real_escape_string()
anyway magic_quotes should be off in your php.ini

you should write your own
Give it a start and come back with questions, we’ll help :)