Forum Moderators: coopster

Message Too Old, No Replies

syntax error, unexpected T VARIABLE

         

scott815

1:53 pm on Sep 29, 2008 (gmt 0)

10+ Year Member



I am new to php and trying to learn. Got error message below on code below.

Parse error: syntax error, unexpected T_VARIABLE in /home2/ytbvacat/public_html/includes/common.inc(1355) : eval()'d code on line 5

<?php
mysql_connect("localhost", "#*$!xx", "#*$!xx") or die(mysql_error()); //mysql_connect ($server,$username,$password )
mysql_select_db("#*$!#*$!xx") // this should go after mysql_connect

$test = 'SELECT COUNT(*) AS `Rows`, `field_rental_state_value` FROM `content_type_vacation_rental` GROUP BY `field_rental_state_value` ORDER BY `field_rental_state_value` LIMIT 0, 30 ';
$result = mysql_query($test);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo "Count :" . $row['Rows'] . "<br>" . "field_rental_state_value : " . $row['field_rental_state_value']. " <br>" .
}
?>

eelixduppy

3:01 pm on Sep 29, 2008 (gmt 0)



You are missing a semi-colon at the end of the following line:

echo "Count :" . $row['Rows'] . "<br>" . "field_rental_state_value : " . $row['field_rental_state_value']. " <br>"[b];[/b]

And Welcome to WebmasterWorld! :)

scott815

4:36 pm on Sep 29, 2008 (gmt 0)

10+ Year Member



Thanks for the help but now i get another error says I have same error on line five. See line five below.

$test = 'SELECT COUNT(*) AS `Rows`, `field_rental_state_value` FROM `content_type_vacation_rental` GROUP BY `field_rental_state_value` ORDER BY `field_rental_state_value` LIMIT 0, 30 ';

eelixduppy

4:56 pm on Sep 29, 2008 (gmt 0)



Sorry I missed this one. You are also missing a semi-colon after this line:

mysql_select_db("#*$!#*$!xx");

grallis

5:04 pm on Sep 29, 2008 (gmt 0)

10+ Year Member



Often if you get a warning or error on a specific line, the error actually lies in the line above that line, so check this line out -
mysql_select_db("#*$!#*$!xx") ... no semicolon there either.

Also, try using double quotes for queries - it makes things easier for creating dynamic queries :)

grallis

5:04 pm on Sep 29, 2008 (gmt 0)

10+ Year Member



Damn, shouldnt have answered the phone :P

scott815

7:18 pm on Sep 29, 2008 (gmt 0)

10+ Year Member



Thank you for all the help.