moviedrome Posted March 19, 2007 Share Posted March 19, 2007 Can anyone tell me where i'm going wrong My php code is this //Change reward if (isset($_REQUEST['h_change_reward']) and $_REQUEST['h_change_reward'] != "") { $rewardid=$_REQUEST['item']; if ($rewardid != "" and $rewardid > 0) { $query_rs_rewards = "UPDATE fg_user SET rewardid=".$rewardid; $query_rs_refs = "UPDATE fg_user SET refsneeded=".echo $row_rs_rewards['referralpoints']; $rs_refs = mysql_query($query_rs_refs, $referral_system) or die(mysql_error()); $rs_rewards = mysql_query($query_rs_rewards, $referral_system) or die(mysql_error()); header("Location: user.status.php"); } } Quote Link to comment https://forums.phpfreaks.com/topic/43393-parse-error-syntax-error-unexpected-t_echo-in-contentstartuphostplusfrfre/ Share on other sites More sharing options...
bwochinski Posted March 19, 2007 Share Posted March 19, 2007 $query_rs_refs = "UPDATE fg_user SET refsneeded=".echo $row_rs_rewards['referralpoints']; Don't think the echo should be in there. Quote Link to comment https://forums.phpfreaks.com/topic/43393-parse-error-syntax-error-unexpected-t_echo-in-contentstartuphostplusfrfre/#findComment-210747 Share on other sites More sharing options...
per1os Posted March 19, 2007 Share Posted March 19, 2007 $query_rs_refs = "UPDATE fg_user SET refsneeded=".echo $row_rs_rewards['referralpoints']; should be $query_rs_refs = "UPDATE fg_user SET refsneeded=". $row_rs_rewards['referralpoints']; Quote Link to comment https://forums.phpfreaks.com/topic/43393-parse-error-syntax-error-unexpected-t_echo-in-contentstartuphostplusfrfre/#findComment-210749 Share on other sites More sharing options...
moviedrome Posted March 19, 2007 Author Share Posted March 19, 2007 ok, thanks that's got rid of that one the page now loads but when i hit submit i get You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 Quote Link to comment https://forums.phpfreaks.com/topic/43393-parse-error-syntax-error-unexpected-t_echo-in-contentstartuphostplusfrfre/#findComment-210752 Share on other sites More sharing options...
moviedrome Posted March 19, 2007 Author Share Posted March 19, 2007 thought it might help if i pasted all the code. basically what the script did before i played with it was update the field reward id in table fg_user with the newly selected reward id. What i want it to do is update that, but also update refsneeded in fg_user as well. All help would be most appreciated, i'm rubbish at this! lol. The only bit i added was these 2 lines, before that it worked fine $query_rs_refs = "UPDATE fg_user SET refsneeded=".$row_rs_rewards['referralpoints']; $rs_refs = mysql_query($query_rs_refs, $referral_system) or die(mysql_error()); <?php require_once('Connections/referral_system.php'); ?> <?php mysql_select_db($database_referral_system, $referral_system); //Change reward if (isset($_REQUEST['h_change_reward']) and $_REQUEST['h_change_reward'] != "") { $rewardid=$_REQUEST['item']; if ($rewardid != "" and $rewardid > 0) { $query_rs_rewards = "UPDATE fg_user SET rewardid=".$rewardid; $query_rs_refs = "UPDATE fg_user SET refsneeded=".$row_rs_rewards['referralpoints']; $rs_refs = mysql_query($query_rs_refs, $referral_system) or die(mysql_error()); $rs_rewards = mysql_query($query_rs_rewards, $referral_system) or die(mysql_error()); header("Location: user.status.php"); } } $query_rs_rewards = "SELECT * FROM fg_rewards"; $rs_rewards = mysql_query($query_rs_rewards, $referral_system) or die(mysql_error()); $row_rs_rewards = mysql_fetch_assoc($rs_rewards); $totalRows_rs_rewards = mysql_num_rows($rs_rewards); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><!-- InstanceBegin template="/Templates/template.dwt" codeOutsideHTMLIsLocked="false" --> <head> <!-- InstanceBeginEditable name="doctitle" --> <title>Reward List</title> <!-- InstanceEndEditable --> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <!-- InstanceBeginEditable name="head" --> <!-- InstanceEndEditable --> <link type="text/css" href="default.css" rel="stylesheet" > <style type="text/css"> <!-- .style5 {color: #668000} --> </style> </head> <body topmargin="0"> <? include("inctop.php")?> <!-- InstanceBeginEditable name="EditRegion3" --> <form name="form1" action="rewards.list.php" method="get"> <table align="center" width="75%" border="0" cellspacing="1" cellpadding="1"> <tr> <td align="center"> Select New Reward From List </td> </tr> </table> <br> <table align="center" width="75%" border="0" cellspacing="1" cellpadding="1"> <font size='1'> <?php $imgcount = 0; do { if (($imgcount % 3) == 0) { if ($imgcount <> 0) { echo "</tr>"; } echo "<tr align='center'>"; }?> <td bgcolor="#CCCCCC" > <b><?php echo $row_rs_rewards['name']; ?><br></b> <img src="Images/<?php echo $row_rs_rewards['image'];?>"><br> <input name="item" type="radio" value="<?php echo $row_rs_rewards['id'];?>" <? if ($row_rs_rewards['id'] == $_REQUEST['rewardid']) echo "checked";?>><br> <?php echo "( ".$row_rs_rewards['referralpoints']." Referrals)"; ?><br> </td> <?php //if ((($imgcount % 3) == 0 and $imgcount <> 0) or $imgcount == 0 ){ echo "</tr>"; } $imgcount++; } while ($row_rs_rewards = mysql_fetch_assoc($rs_rewards)); ?> </tr> </font> </table> <table width="100%"> <tr align="center"> <td> <input name="submit" type="submit" value="Change Reward"> <input name="h_change_reward" type="hidden" value="form1"> </td> </table> </form> <!-- InstanceEndEditable --> <? include("incbottom.php")?> </body> <!-- InstanceEnd --></html> <?php mysql_free_result($rs_rewards); ?> Quote Link to comment https://forums.phpfreaks.com/topic/43393-parse-error-syntax-error-unexpected-t_echo-in-contentstartuphostplusfrfre/#findComment-210754 Share on other sites More sharing options...
moviedrome Posted March 19, 2007 Author Share Posted March 19, 2007 anyone know? Quote Link to comment https://forums.phpfreaks.com/topic/43393-parse-error-syntax-error-unexpected-t_echo-in-contentstartuphostplusfrfre/#findComment-210778 Share on other sites More sharing options...
moviedrome Posted March 19, 2007 Author Share Posted March 19, 2007 Just a few pointers will do? Do you need my table layout or anything? Quote Link to comment https://forums.phpfreaks.com/topic/43393-parse-error-syntax-error-unexpected-t_echo-in-contentstartuphostplusfrfre/#findComment-210794 Share on other sites More sharing options...
bwochinski Posted March 19, 2007 Share Posted March 19, 2007 Well it's a SQL syntax error, so the problem is with one of your SQL statements. Try echoing the statements before you run the query, so you can see what is actually being sent. Often times unexpected variable values can cause this. Quote Link to comment https://forums.phpfreaks.com/topic/43393-parse-error-syntax-error-unexpected-t_echo-in-contentstartuphostplusfrfre/#findComment-210802 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.