Jump to content

Recommended Posts

I am starting to dread coming here for help.....rrrfff

 

whats wrong here with my update code?:

 

global $scripturl , $context;

echo'
<a href="http://vsk-ayc.totalh.com/index.php?page=221">RETURN TO THE START PAGE</a><br>
<table class = "bordercolor" cellSpacing="1" cellPadding="1" width="100%" border="0">
	<tr class ="catbg">
		<td width = "100%">Recent Race Reports:</td>
	</tr>
</table>
<form action="'.$scripturl.'?page=221'.$GET['page'].'" method="post">
<input id="submitted" name="submitted" type="hidden" value="TRUE" />';

$raceq = 	"SELECT race_table.raceID, race_table.raceDate, race_table.hostName, 
		race_table.boatsInRace, race_table.seriesID,
		series_table.seriesName, race_table.factor , 
		race_screenshots_table.imageURL, race_table.approved
		FROM race_table
		LEFT JOIN series_table ON race_table.seriesID = series_table.seriesID
		LEFT JOIN race_screenshots_table ON race_table.raceID = 
		race_screenshots_table.raceID
		ORDER BY raceID DESC;";
$result = mysql_query($raceq);
	while($row = mysql_fetch_array($result))
	{
	$raceID = $row['raceID'];
	echo '<br />
	<table class="bordercolor" cellSpacing="1" cellPadding="1" width="100%" border="0">
		<tr class ="catbg">
			<td>Race ID:</td>
			<td>Date:</td>
			<td>Host Name:</td>
			<td>Boats:</td>
			<td>Series Name:</td>
			<td>Factor</td>
			<td>Image URL:</td>
			<td>Approved</td>
		</tr>
		<tr class="catbg4">
			<td width="10%">' . $row['raceID'] . '</td>
			<td width="10%">' . $row['raceDate'] . '</td>
			<td width="20%">' . $row['hostName'] . '</td>
			<td width="10%">' . $row['boatsInRace'] . '</td>
			<td width="20%">' . $row['seriesName'] . '</td>
			<td width="5%">' . $row['factor'] . '</td>
			<td width="20%">
				<a href="javascript:void(window.open(\'' . $row['imageURL'] .'\',\'\',\'
				resizable=yes,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,
				fullscreen=no,dependent=no,width=1024,height=768\'))">VIEW IMAGE</a></td>';
	if ($context['allow_admin'] AND $row['approved'] != "Yes")
	{
			echo'
			<td width = "5%">
                                <select id="approved" name="approved" style="WIDTH: 50px" value ="" />
			     <option value="Yes">Yes</option>
			     <option value="No">No</option></td>
		</tr>
	</table>
	<table class = "bordercolor" cellSpacing="1" cellPadding="1" width="100%" border="0">
		<TR class ="windowbg3">
			<td width = "20%">Skipper Name</td>
			<td width = "20%">Position</td>
			<td width = "20%">Race Points</td>
			<td width = "20%">Match Points</td>
			<td width = "20%">Fleet Points</td>
		</tr>
	</table>';
	}
	else
	echo'
			<td width = "5%">' . $row['approved'] . '</td>
		</tr>
	</table>
	<table class = "bordercolor" cellSpacing="1" cellPadding="1" width="100%" border="0">
		<TR class ="windowbg3">
			<td width = "20%">Skipper Name</td>
			<td width = "20%">Position</td>
			<td width = "20%">Race Points</td>
			<td width = "20%">Match Points</td>
			<td width = "20%">Fleet Points</td>
		</tr>
	</table>';
			$ptsq =	"SELECT race_table.raceID , pts_table.skipperName, 
					pts_table.position, pts_table.racePoints , 
					pts_table.matchPoints , pts_table.fleetPoints
					FROM pts_table
					LEFT OUTER JOIN race_table ON pts_table.raceID = race_table.raceID
					WHERE race_table.raceID = '$raceID'
					GROUP BY pts_table.skipperName, race_table.raceID
					ORDER BY race_table.raceID, pts_table.racePoints DESC
					LIMIT 0 , 30;";
			$result2 = mysql_query($ptsq);
			while($row2 = mysql_fetch_array($result2))
			{
			echo'
				<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" 
				width="100%" border="0">
					<TR class ="windowbg3">
						<TD width = "20%">' . $row2['skipperName'] . '</td>
						<TD width = "20%">' . $row2['position'] . '</td>
						<TD width = "20%">' . $row2['racePoints'] . '</td>
						<TD width = "20%">' . $row2['matchPoints'] . '</td>
						<TD width = "20%">' . $row2['fleetPoints'] . '</td>
					</tr>
				</table>';
			}										
	}
if ($context['allow_admin'])
{
echo'
	<br>
	<table class = "bordercolor" cellSpacing="1" cellPadding="1" width="100%" border="0">
		<tr class ="catbg">
			<td>Submit Approvals:</td>
		</tr>
	</table>
	<br>
	<table>
		<tr>
		<INPUT type="submit" value="Submit"><INPUT type="reset" value="Reset">
		</tr>
	</table>
	</form>';
}


if (isset($_POST['submitted'])) 
{

while (isset($_POST['approved']))
{
echo $_POST['approved'];
$approved = mysql_real_escape_string($_POST['approved']);
mysql_query 	("UPDATE race_table.approved
				SET race_table.approved = '$approved'
				WHERE race_table.raceID = '$raceID';");
}
}

Link to comment
https://forums.phpfreaks.com/topic/86215-mysql-update/
Share on other sites

Try changing this bit:

if (isset($_POST['submitted'])) 
{

while (isset($_POST['approved']))
{
echo $_POST['approved'];
$approved = mysql_real_escape_string($_POST['approved']);
mysql_query 	("UPDATE race_table.approved
				SET race_table.approved = '$approved'
				WHERE race_table.raceID = '$raceID';");
}
}

 

To:

if (isset($_POST['submitted'])) 
{

while (isset($_POST['approved']))
{
echo $_POST['approved'];
$approved = mysql_real_escape_string($_POST['approved']);
mysql_query 	("UPDATE race_table
				SET race_table.approved = '$approved'
				WHERE race_table.raceID = '$raceID';");
}
}

Link to comment
https://forums.phpfreaks.com/topic/86215-mysql-update/#findComment-440351
Share on other sites

like what is always being mentioned here put a die on your query and put mysql error

to know what is the error and your update..

 

mysql_query 	("UPDATE race_table.approved
				SET race_table.approved = '$approved'
				WHERE race_table.raceID = '$raceID';");

 

dont know if that valid because race_table.approved  should be databasename.tablename..

 

so this should be

 

mysql_query 	("UPDATE race_table
				SET race_table.approved = '$approved'
				WHERE race_table.raceID = '$raceID';");

 

nah ken is so fast..

Link to comment
https://forums.phpfreaks.com/topic/86215-mysql-update/#findComment-440353
Share on other sites

when i try this

 

if (isset($_POST['submitted']))
{

while (isset($_POST['approved']))
{
	echo $_POST['approved'];
	$approved = mysql_real_escape_string($_POST['approved']);
	mysql_query ("UPDATE race_table
				SET race_table.approved = '$approved'
				WHERE race_table.raceID = '$raceID';// or die ("Could not execute query");");
}
}

Link to comment
https://forums.phpfreaks.com/topic/86215-mysql-update/#findComment-440365
Share on other sites

Why did you comment out the ending?

 

if (isset($_POST['submitted']))
{

while (isset($_POST['approved']))
{
	echo $_POST['approved'];
	$approved = mysql_real_escape_string($_POST['approved']);
	mysql_query ("UPDATE race_table
				SET race_table.approved = '$approved'
				WHERE race_table.raceID = '$raceID'") or die ("Could not execute query");
}
}

Link to comment
https://forums.phpfreaks.com/topic/86215-mysql-update/#findComment-440369
Share on other sites

would this accomplish the same thing?

if (isset($_POST['submitted']))
{

if (isset($_POST['approved']))
{
$approved = mysql_real_escape_string($_POST['approved']);
mysql_query ("UPDATE race_table
			SET race_table.approved = '$approved'
			WHERE race_table.raceID = '$raceID'") or die ("Could not execute query");
}
}

Link to comment
https://forums.phpfreaks.com/topic/86215-mysql-update/#findComment-440387
Share on other sites

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.