Page 1 of 1

probably simple, why this error: parse error, unexpected $

Posted: Tue Jun 21, 2005 11:33 pm
by brozman

Code: Select all

<?php

$query = 'SELECT title, year FROM movies';
$findQ = 'SELECT * FROM movies WHERE title = ';
$newQ = $findQ + $name;

$link = mysql_connect('mysql.mogacode.com', 'mogac001', 'blabla2004') or die('Could not connect: ' . mysql_error());
echo "Connected to DB';

mysql_select_db('mogac001') or die('Can't connect to DB' . mysql.error());

$result = mysql_query($query) or die('Could not connect: ' . mysql_error());

while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
    echo 'Something work damit';  }


?>

More specifically the error is: Parse error: parse error, unexpected $ in /xxxxxx/auth.php on line 18


All help is apprecieated, trying to learn PHP.

Boris Rozman :idea:

d11wtq |

Code: Select all

tags  [/color]

Posted: Tue Jun 21, 2005 11:44 pm
by hawleyjr
Welcome to DevNet. Please read "Posting Code in the Forums"

viewtopic.php?t=21171

You have a parse error. Php uses a period (.) to parse strings and variables. Using a + sign php will try to add the two variables.

Code: Select all

$newQ = $findQ + $name; 

$newQ = $findQ . $name;

got it

Posted: Tue Jun 21, 2005 11:55 pm
by brozman
That was helpful and i also found all the quoting errors.

A little confused but Dreamweaver colored them for me and i figured it out.

Thanks!