Jump to content

Parse error: syntax error, unexpected T_ECHO in /content/StartupHostPlus/f/r/fre


Recommended Posts

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");

}

 

}

 

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

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);

?>

 

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.