Welcome to WebmasterWorld Guest from 35.175.191.168

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

unexpected T CONSTANT ENCAPSED STRING

     
3:10 pm on Jun 26, 2008 (gmt 0)

Junior Member

10+ Year Member

joined:May 7, 2008
posts:45
votes: 0


I have posted on a few different forum boards now about this problem and I have yet to find someone who can figure out the problem... Hopefully someone here can. I just keep getting this error:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/muzicwar/public_html/postmuzic.php on line 58

Heres my script:

<?php
if(isset($_POST['btnSubmit']))
{
include 'login.php';

$track_1 = trim($_POST['track_1']);
$track_2 = trim($_POST['track_2']);
$track_3 = trim($_POST['track_3']);
$track_4 = trim($_POST['track_4']);
$track_5 = trim($_POST['track_5']);
$track_6 = trim($_POST['track_6']);
$track_7 = trim($_POST['track_7']);
$track_8 = trim($_POST['track_8']);
$track_9 = trim($_POST['track_9']);
$track_10 = trim($_POST['track_10']);
$track_11 = trim($_POST['track_11']);
$track_12 = trim($_POST['track_12']);
$track_13 = trim($_POST['track_13']);
$track_14 = trim($_POST['track_14']);
$track_15 = trim($_POST['track_15']);
$track_16 = trim($_POST['track_16']);
$track_17 = trim($_POST['track_17']);
$track_18 = trim($_POST['track_18']);
$track_19 = trim($_POST['track_19']);
$track_20 = trim($_POST['track_20']);
$track_21 = trim($_POST['track_21']);
$track_22 = trim($_POST['track_22']);
$track_23 = trim($_POST['track_23']);
$track_24 = trim($_POST['track_24']);
$track_25 = trim($_POST['track_25']);
$track_26 = trim($_POST['track_26']);
$track_27 = trim($_POST['track_27']);
$track_28 = trim($_POST['track_28']);
$track_29 = trim($_POST['track_29']);
$track_30 = trim($_POST['track_30']);
$details = trim($_POST['details']);
$dl = trim($_POST['dl']);
$user = trim($_POST['user']);
$trackn = trim($_POST['trackn']);
$genre = trim($_POST['genre']);
$year = trim($_POST['year']);
$art = trim($_POST['art']);
$artist = trim($_POST['artist']);
$albumname = trim($_POST['albumname']);
if ($albumname == '')
{
exit;
}
if ($dl == '')
{
exit;
}
if ($artist == '')
{
exit;
}
{
$query = "INSERT INTO albuminfo (track, details, dl, user, trackn, genre, theyear, art, artist, albumname) VALUES ";
$inserts = array();
for($n=1;$n <= 30;$n++){
  $track = ${'track_'.$n};
  if(empty($track)) break;
  $insert[] = "('$track', '$details', '$dl', '$user', '$trackn', '$genre', '$theyear', '$art', '$artist', '$albumname')";
}
if(count($inserts)){
  $query .= implode(',',$inserts);
  mysql_query($query) or die('YOUR FIELD WAS TO LONG!');
} }
?>
<html>
<script language="Javascript" type="text/javascript">
<!--
function addField(area,field,limit) {
if(!document.getElementById) return;
var field_area = document.getElementById(area);
var all_inputs = field_area.getElementsByTagName("input");
var last_item = all_inputs.length - 1;
var last = all_inputs[last_item].id;
var count = Number(last.split("_")[1]) + 1;

if(count > limit && limit > 30) return;

if(document.createElement) {
var li = document.createElement("li");
var input = document.createElement("input");
input.id = field+count;
input.name = field+count;
input.type = "text";
li.appendChild(input);
field_area.appendChild(li);
} else {
field_area.innerHTML += "<li><input name='"+(field+count)+"' id='"+(field+count)+"' type='text' /></li>";
}
}
//-->
</script>
<body>

<form name="albuminfo" method="POST">
Track:
<ol id="tracks_area">
<li><input type="text" name="track_1" id="track_1" /></li>
<li><input type="text" name="track_2" id="track_2" /></li>
<li><input type="text" name="track_3" id="track_3" /></li>
<li><input type="text" name="track_4" id="track_4" /></li>
<li><input type="text" name="track_5" id="track_5" /></li>
</ol>
<input type="button" value="Add track Field" onclick="addField('tracks_area','track_',10);" />
Artist Name:
<input name="artist" type="text" size="20" maxlength="50">
Album Name:
<input name="albumname" type="text" size="20" maxlength="50">
Length:
<input name="length" type="text" size="6" maxlength="6">
Details:
<input name="details" type="text" size="20" maxlength="200">
Download Links:
<input name="dl" type="text" size="20" maxlength="75">
Your Username:
<input name="user" type="text" size="20" maxlength="50">
Genre:
<select name="genre">
<option value="" selected>--Select Your Genre--</option>
<option value="metal">Metal</option>
<option value="rock">Rock</option>
<option value="raphop">Rap/Hip-Hop</option>
<option value="country">Country</option>
<option value="folk">Folk</option>
<option value="classical">Classical</option>
<option value="techtrance">Techno/Trance</option>
</select>
Year:
<input name="theyear" type="text" size="4" maxlength="4">
Artwork:
<input name="art" type="text" size="20" maxlength="50">
<input name="btnSubmit" type="submit" value="Post Muzic">
</form>
</body>
</html>

[edited by: Spiceydog at 3:11 pm (utc) on June 26, 2008]

3:22 pm on June 26, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:May 6, 2005
posts:863
votes: 0


Usually indicates a missing } to close, I counted your open versus close and ended up with one missing here

} } }
?>
<html>

try it with the 3 }'s

3:29 pm on June 26, 2008 (gmt 0)

Junior Member

10+ Year Member

joined:May 7, 2008
posts:45
votes: 0


Yah i noticed that myself right after I posted this... still doesnt work though... hmmm
3:43 pm on June 26, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:May 6, 2005
posts:863
votes: 0


What error is it giving now then?
3:44 pm on June 26, 2008 (gmt 0)

Junior Member

10+ Year Member

joined:May 7, 2008
posts:45
votes: 0


o same thing... same error in the same place:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/muzicwar/public_html/postmuzic.php on line 58
4:32 pm on June 26, 2008 (gmt 0)

Full Member

10+ Year Member

joined:July 13, 2007
posts:235
votes: 0


On line 57, you have an extra {. The code around it:

if ($artist == '')
{
exit;
}
{

The problem is the last line--I suspect there should have been an else in between the } and {. :)