BillyBoB Posted July 31, 2006 Share Posted July 31, 2006 ok heres the part of code that's giving me an error [code]<?php if($_GET[name]) //line 119 { $name = $_GET['name']; $query = mysql_query("SELECT * FROM programs WHERE programname = $name") or die(mysql_error()); $qarray = mysql_fetch_array($query); $count = $qarray['count']; $count = $count + 1; $update = mysql_query("UPDATE programs SET count = '$count' WHERE id = $qarray['id']") or die(mysql_error()); //line 126 echo(" <meta http-equiv=\"Refresh\" content=\"0; URL=http://dreamshowstudios.net/programs/$name.exe \" /> "); exit(); } //line 131?>[/code]but heres the error [code]Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/dreamsh/public_html/programs.php on line 126[/code]Now this code is built on my programs page where if they click a program the url would be likehttp://dreamshowstudios.net/programs.php?name=PROGRAMNAMEthen i want it to add a number to the counter and send it to the database and then finally pop the download up :) Quote Link to comment https://forums.phpfreaks.com/topic/16084-um-error-i-cant-figure-this-out/ Share on other sites More sharing options...
king arthur Posted July 31, 2006 Share Posted July 31, 2006 Make this line[code]$update = mysql_query("UPDATE programs SET count = '$count' WHERE id = $qarray['id']") or die(mysql_error());[/code]into this:[code]$update = mysql_query("UPDATE programs SET count = '$count' WHERE id = " . $qarray['id']) or die(mysql_error()); [/code] Quote Link to comment https://forums.phpfreaks.com/topic/16084-um-error-i-cant-figure-this-out/#findComment-66270 Share on other sites More sharing options...
BillyBoB Posted July 31, 2006 Author Share Posted July 31, 2006 um that didnt work so good either Quote Link to comment https://forums.phpfreaks.com/topic/16084-um-error-i-cant-figure-this-out/#findComment-66494 Share on other sites More sharing options...
wildteen88 Posted July 31, 2006 Share Posted July 31, 2006 Change this:[code]<meta http-equiv=\"Refresh\" content=\"0; URL=http://dreamshowstudios.net/programs/$name.exe \" />[/code]to:[code]<meta http-equiv=\"Refresh\" content=\"0; URL=http://dreamshowstudios.net/programs/{$name}.exe \" />[/code] Quote Link to comment https://forums.phpfreaks.com/topic/16084-um-error-i-cant-figure-this-out/#findComment-66497 Share on other sites More sharing options...
BillyBoB Posted July 31, 2006 Author Share Posted July 31, 2006 nope that part works good please read the first post Quote Link to comment https://forums.phpfreaks.com/topic/16084-um-error-i-cant-figure-this-out/#findComment-66500 Share on other sites More sharing options...
AndyB Posted July 31, 2006 Share Posted July 31, 2006 [code]$update = mysql_query("UPDATE programs SET count = '$count' WHERE id = '" . $qarray['id']. "'") or die(mysql_error()); [/code] Quote Link to comment https://forums.phpfreaks.com/topic/16084-um-error-i-cant-figure-this-out/#findComment-66501 Share on other sites More sharing options...
Chetan Posted July 31, 2006 Share Posted July 31, 2006 Its simple[code]<?php if($_GET[name]) //line 119 { $name = $_GET['name']; $query = mysql_query("SELECT * FROM programs WHERE programname = $name") or die(mysql_error()); $qarray = mysql_fetch_array($query); $count = $qarray['count']; $count = $count + 1; $update = mysql_query("UPDATE programs SET count = '$count' WHERE id = $qarray['id']") or die(mysql_error()); //line 126 echo(" <meta http-equiv=\"Refresh\" content=\"0; URL=http://dreamshowstudios.net/programs/$name.exe \" /> "); exit(); } //line 131?>[/code][code]<?php if($_GET[name]) //line 119 { $name = $_GET['name']; $query = mysql_query("SELECT * FROM programs WHERE programname = '$name'") or die(mysql_error()); $qarray = mysql_fetch_array($query); $count = $qarray['count']; $count = $count + 1; $update = mysql_query("UPDATE programs SET count = '$count' WHERE id = '$qarray[id]'") or die(mysql_error()); //line 126 echo(" <meta http-equiv=\"Refresh\" content=\"0; URL=http://dreamshowstudios.net/programs/$name.exe \" /> "); exit(); } //line 131?>[/code]you see you need to put '' around data for mysql and also you use $VAR['name'] when you dont include it in a string and have "" around it. In such case when you use "" around it becomes $VAR[name] Quote Link to comment https://forums.phpfreaks.com/topic/16084-um-error-i-cant-figure-this-out/#findComment-66503 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.