Unexpected $end in php script? -
Unexpected $end in php script? -
i have bit of code looks fine me, maintain getting next error:
"parse error: syntax error, unexpected $end in /home/txclanco/public_html/hotmuze/addsong.php on line 21"
this script takes in input form, checks duplicates , if there duplicate, not create new row add together 1 'rating' row songname song typed in. if there isn't duplicate, script add together info new row. info types are:
id = a_i/int songname = varchar artist = varchar rating = intthe script below mysql info blanked out:
<? mysql_connect("localhost", "***", "***") or die(mysql_error()); mysql_select_db("***") or die(mysql_error()); $songname = $_post['songname']; $artist = $_post['by']; $ratenum = 1; $chkquery = "select * hotmuze songname='$songname'"; $plusonequery = "select * hotmuze songname='$songname'"; $updatequery = "update hotmuze set rating='$rating2' songname='$songname'"; $checkdata = mysql_query($chkquery); $checkrows = mysql_num_rows($checkdata); if($checkrows==0) { $insquery = "insert hotmuze (id, songname, artist, rating) values('', '$songname', '$artist', '$ratenum'"; $insdata = mysql_query($insquery); } if($checkrows!=0) { $plusdata = mysql_query($plusonequery); } if(mysql_num_rows($plusdata)!=0) { $result = mysql_fetch_assoc($plusdata); $rating = $result['ratng']; $rating2 = $rating + 1; mysql_query($updatequery); echo "data inserted"; } ?> line 21 being:
if($checkrows!=0) { // brace on line 21 $plusdata = mysql_query($plusonequery); } any ideas wrong script? know unexpected $end error means there's brace out of place, time, it's fine?
change this
$insquery = "insert hotmuze (id, songname, artist, rating) values('', '$songname', '$artist', '$ratenum'"; to
$insquery = "insert hotmuze (id, songname, artist, rating) values('', '$songname', '$artist', '$ratenum')"; you have missed ) @ end
php
Comments
Post a Comment