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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
brozman
Forum Newbie
Posts: 2
Joined: Tue Jun 21, 2005 11:30 pm
Location: New York, NY

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

Post 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]
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post 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;
brozman
Forum Newbie
Posts: 2
Joined: Tue Jun 21, 2005 11:30 pm
Location: New York, NY

got it

Post 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!
Post Reply