TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

May 25, 2024, 06:15:00 PM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,197
  • Total Topics: 21,221
  • Online today: 155
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 144
  • Total: 144

Article no longer working

Started by TimUSA, October 21, 2010, 05:09:50 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TimUSA

I recently upgraded my forum to RC2 and upgraded my TP. I have a few articles that are no longer working. Let start with this one first. In this code is a query that populates a drop down with the names from the members list. This is the part that is not working.

Here is the code: (The problem area starts at about line 88) //enter race information


/*
*AYC SCORING AND RANKING PROGRAM
*CREATED BY: Tim Willford
*EMAIL: tim.willford@yahoo.com
*VERSION: 2.0
*/


/////CONFIGURATION/////
global $scripturl;
$date = date("Y/m/d");
function upload(){
echo'
<form name="form1" method="post" action="'.$scripturl.'?page=181'.$get['page'].'" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="500000">
<input type="file" name="pix">
<br>
<input type="submit" name="Upload" value="Upload Picture">
</form>';
}


echo '
<style type="text/css">
#leftcontent
{
float: left;
margin-left: 10;
padding-right: 5;
}
#rightcontent
{
float: right;
margin-left: 10;
padding-right: 5;
}
</style>';

//FORM 1: ENTER RACE INFORMATION

//submit screenshot
if(!isset($_POST['Upload'] ))
{
echo'
<table class = "bordercolor" cellspacing="1" cellpadding="1" width="100%" border="0">
<td class ="catbg">SUBMIT SCREENSHOT:</td>
</table>
<br>';
upload();
}
else
{
if($_FILES['pix']['tmp_name'] == "none")
{
echo'<p>File did not upload. File size must be less than 500K</p>';
upload();
}
if(!ereg("image", $_FILES['pix']['type']))
{
echo'<p>File is not a picture. Please try another file.</p>';
upload();
}
else
{
copy ($_FILES['pix']['tmp_name'], "screenshots/".$_FILES['pix']['name']) or die('Could not upload.');
echo'Your file has uploaded correctly:<br>';
echo $_FILES['pix']['name'];
echo'<br>';
echo $_FILES['pix']['size'];
}
}

//enter race information
if((isset($_POST['Upload'] )) && (!isset($_POST['form1'] )))
{
echo'
<table class = "bordercolor" cellspacing="1" cellpadding="1" width="100%" border="0">
<tr class ="catbg">
<td>ENTER RACE INFORMATION:</td>
</tr>
</table>
<br>';
echo'
<form action="'.$scripturl.'?page=182'.$get['page'].'" method="post">
<input name="form1" type="hidden" value="TRUE" />
';

//enter race host:
echo'
<div id="leftcontent">
Host<br>
<select id="host" name="host" style="width: 204px" value ="';
echo '" />';
$query = "SELECT `realName`
FROM `smf_members`
ORDER BY `realName`;";
$result = mysql_query($query);
if(mysql_num_rows($result))
{
while($row = mysql_fetch_row($result))
{
print("<option value=\"$row[0]\">$row[0]</option>");
}
}
mysql_data_seek($result, 0);
echo'
</select>
<br>';

//enter race date
echo'
Date:<br>
<input type="date type" name="date" id="date" style="width: 200px" value="' . $date . '"/>
<br>';

//enter number of boats
echo'
Number of Boats:<br>
<input type="text" name="boats" style="width: 200px" maxlength="20" size="20" />
<br>';

//enter race type
echo'
Race Type:<br>
<select id="factor" name="factor" style="width: 204px" value ="';
echo '" />
<option value="1" selected>Fleet Race</option>
<option value="2">Match Race</option>
        <option value="6">Club Race</option>';
        if ($context['allow_admin'])
        {
        echo'
        <option value="8">Championship</option>';
        }
        echo'
</select>
<br>';

//enter series name
echo'
Series Name:<br>
<select id="series" name="series" style="WIDTH: 204px" value ="';
echo '" />
<option value="Fleet Ladder Series">Fleet Ladder Series</option>
<option value="Match Ladder Series">Match Ladder Series</option>';
$seriesquery = "SELECT `seriesName`
FROM `series_table`
ORDER BY `seriesID` DESC ;";
$seriesresult = mysql_query($seriesquery);
while($row = mysql_fetch_row($seriesresult))
{
print("<option value=\"$row[0]\">$row[0]</option>");
}
echo'
</select>
<br>
<br>
<input type="submit" value="Submit Race Information"><br><input type="reset" value="Reset">
<br style="clear: left" />
</div>';

//display screenshot
echo'
<div id="rightcontent">
<img width="500" src="http://vsk-ayc.totalh.com/screenshots/' . $_FILES['pix']['name'] . '" alt="" />
<br>
<input type="text" READONLY name="image" style="WIDTH: 500px" value="http://vsk-ayc.totalh.com/screenshots/' . $_FILES['pix']['name'] . '" />
<br style="clear: both" />
</div>

</form>';
}


I think if i figure this one out it will give me clues to fix the rest. Did the globals change in RC2?

TimUSA

Solved... smf_members / realName in RC2 is changed to real_name

ZarPrime

Tim,

There were many changes to database queries in SMF 2.0 RC2, even a few more in SMF 2.0 RC3.

ZarPrime

TimUSA

Ok maybe you can help me with this one then, because it is not working either and i am stumped


global $settings;

/////TOP 5 FLEET POINTS
$query = "SELECT pts_table.skipperName, sum(pts_table.fleetPoints) as SumfleetPoints,
smf_members.ID_MEMBER, thm.value AS country
FROM pts_table
LEFT JOIN smf_members ON pts_table.skipperName = smf_members.realName
LEFT JOIN smf_themes AS thm ON (thm.ID_MEMBER = smf_members.ID_MEMBER AND thm.ID_THEME = 1 AND
thm.variable = 'country')
WHERE pts_table.fleetPoints> 0
GROUP BY pts_table.skipperName
ORDER BY SumfleetPoints DESC
LIMIT 0 , 5;";
$result = mysql_query($query);
if(mysql_num_rows($result))
{
echo'
  <table class = "bordercolor" cellSpacing="1" cellPadding="1" width="100%" border="0">
    <tr class ="titlebg">
      <td width = "100%">Top 5 Fleet Race Ladder:</td>
    <tr>
  </table>
  <table class = "bordercolor" cellSpacing="1" cellPadding="1" width="100%" border="0">
    <tr class ="catbg4">
    <td width = "5%"></td>
      <td width = "70%">Skipper Name:</td>
      <td width = "25%">Ladder Points:</td>
    </tr>
  </table>';
$x = 1;
  while($row = mysql_fetch_row($result))
  {
  echo'
<table class = "bordercolor" cellSpacing="1" cellPadding="1" width="100%" border="0">
<tr>
    <td width = "5%" class = "catbg2"><img src="' . $settings['default_images_url'] . '/flags/' . $row[3] . '.png" /></td>
      <td width = "70%" class = "titlebg">' . $x++ . ': ' . $row[0] . '</td>
      <td width = "25%" class = "catbg2">' . $row[1] . '</td>
</tr><br />
  </table><br />';
  }
}


*****SOLVED****** I guess i really need to dig into my code and change all my queries.

ZarPrime

Tim,

For now, I will leave this to Freddy.  He's a lot better at this coding thing than I could ever dream of being. ;)

ZarPrime

IchBin

The same problems exists in that one TimUSA. You need to change all the SMF database table row names to match what they have changed to in the latest version.