Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
unexpected syntex error
Old 09-07-2007, 04:05 AM unexpected syntex error
Junior Talker

Posts: 4
Trades: 0
Hi,
I'm getting the following error message,
Quote:
Parse error: syntax error, unexpected $end in D:\Inetpub\vhost\myroho.com\httpdocs\asearching.ph p on line 34
The php script is as follows,
PHP Code:
<?php 
// Connects to your Database 
mysql_connect("localhost""adder""clifford") or die(mysql_error()) ; 
mysql_select_db("real") or die(mysql_error()) ;
$country = isset($_POST['menuFilesDMA']) ? preg_replace('/[^a-zA-Z0-9\ ]/'''$_POST['menuFilesDMA']) : ''
$type = isset($_POST['Type']) ? preg_replace('/[^a-zA-Z0-9\ ]/'''$_POST['Type']) : ''
$Abstract = isset($_POST['keyword']) ? preg_replace('/[^a-zA-Z0-9\ ]/'''$_POST['keyword']) : ''
$where = array(); 
if (
$country) { 
     
$where[] = "country='$country'"

if (
$type) { 
     
$where[] = "type='$type'"

if (
$Abstract ) { 
     
$where[] = "Abstract LIKE '%$Abstract%'"

if (
$where) { 
     
$sql "SELECT * FROM items WHERE " implode(' AND '$where); 
     
// query and display results 
 
while($info mysql_fetch_array$data )) 

//Outputs the image and other data
Echo "<b>country:</b> ".$info['country'] . "<br> "
Echo 
"<b>type:</b> ".$info['type'] . " <br>"
Echo 
"<b>Abstract:</b> ".$info['Abstract'] . " <hr>"

?>
I am new to php and cannot see what my error might be,
Any help would be much appriciated,
Thanks
Colin
cs1h is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-07-2007, 04:20 AM Re: unexpected syntex error
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
This error is typical of an } forgotten or misplaced.
Look at your last if block.

You open the if, then you open the while.
You close the while, and you don't close the if.
I think your error lies there.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 09-07-2007, 04:27 AM Re: unexpected syntex error
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
He's right... here's the code with the error fixed:

PHP Code:
<?php 
// Connects to your Database 
mysql_connect("localhost""adder""clifford") or die(mysql_error()) ; 
mysql_select_db("real") or die(mysql_error()) ;
$country = isset($_POST['menuFilesDMA']) ? preg_replace('/[^a-zA-Z0-9\ ]/'''$_POST['menuFilesDMA']) : ''
$type = isset($_POST['Type']) ? preg_replace('/[^a-zA-Z0-9\ ]/'''$_POST['Type']) : ''
$Abstract = isset($_POST['keyword']) ? preg_replace('/[^a-zA-Z0-9\ ]/'''$_POST['keyword']) : ''
$where = array(); 
if (
$country) { 
     
$where[] = "country='$country'"

if (
$type) { 
     
$where[] = "type='$type'"

if (
$Abstract ) { 
     
$where[] = "Abstract LIKE '%$Abstract%'"

if (
$where) { 
     
$sql "SELECT * FROM items WHERE " implode(' AND '$where); 
     
// query and display results 
}
 while(
$info mysql_fetch_array$data )) 

//Outputs the image and other data
Echo "<b>country:</b> ".$info['country'] . "<br> "
Echo 
"<b>type:</b> ".$info['type'] . " <br>"
Echo 
"<b>Abstract:</b> ".$info['Abstract'] . " <hr>"

?>
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Reply     « Reply to unexpected syntex error
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.37814 seconds with 12 queries