code in an article that references csv is broken

For Joomla! 3.x Coding related discussions, you could also use: http://groups.google.com/group/joomla-dev-general

Moderators: ooffick, General Support Moderators

Forum rules
Locked
kellyduncan
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Wed Dec 13, 2017 6:41 pm

code in an article that references csv is broken

Post by kellyduncan » Wed Dec 13, 2017 7:08 pm

Hello!

I am brand new here. I was attempting to help a friend with an article on his site that is used for a tournament registration. The code in the article references a csv file to make it easier for the previous participants to register. Team numbers need to be entered by the participants in the article to find the rest of the needed information. The numbers no longer find any of the teams. I believe that a new csv file was uploaded to take the place of the previous year, and the "form" used in the article no longer works.

I'm not sure how to upload the csv and make the article reference it. I'm not even sure where the previous file exists.

I have the code pasted below. Could it be as simple as naming the new csv with the same name as the referenced file? I really have no idea what to do. I'd happily pay someone if this makes any sense to walk me through it.

source code from post:

<!--?php
$user = $_POST['user'];
// team name is SCHOOL in db

echo '<div style="margin:auto; width:500px; display:block">
<h1>Tournament Registration</h1>
';
//echo '<h1 style="text-align:center">'.$tid.'</h1>';

// GET TEAM INFO
// NEW TEAM
if($_POST['teamChoose'] == 'newTeam') {
$newTeamDiv = 'display:block';
$existTeamDiv = 'display:none';
$hide1 ='display:block';
}
// EXISTING TEAM
elseif($_POST['teamChoose'] == 'existingTeam') {
$existTeamDiv = 'display:block';
$newTeamDiv = 'display:none';
$hide1 ='display:none';

}

//echo $_POST['teamChoose'];
// If existing Team No CHANGE
// <!-- ******************************************************************************************************************************************* -->
// <!--// START EXISTING TEAM DIV-->
echo '<div style="'.$existTeamDiv.'">';

if (!isset($_POST['getteam'])) {

echo '<form action="" method="post" >
<em>Step 2 of 4</em>
<div style="display:table-row;height: 25px;">
<strong>TEAM #</strong>
</div>

<div style="display:table-row;height: 25px;">
<label style="display:table-cell">Team Number: </label>
<input style="display:table-cell; background-color:#FFFFFF" autocomplete="OFF" name="teamnumber" size="4" type="number" step="1"
required></div><div style="display:table-row;height: 25px;">
<input type="submit" name="getteam" value="Retrieve Team" style= "border:#000000 solid 1px; font-weight:bold; margin:15px 10px;margin-left: 100%; display:block">

</form>
</div>';

}
// <!-- RETRIEVE TEAM INFO -->

elseif(isset($_POST['getteam'])){
$tid = $_POST['tid']; // SCHOOL NAME
$user = $_POST['user'];
$newTeamDiv = 'display:none';
$teamnumber = $_POST['teamnumber'];
$teamname = $_POST['teamname'];
// Connect to Database
$con = mysql_connect("localhost","setxfish_treg","!8=y)vUx,8[4");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

// Select table
mysql_select_db("setxfish_registration", $con);
$result = mysql_query("SELECT * FROM TRegTable WHERE teamnumber = '$teamnumber'")
or die(mysql_error());

if(mysql_num_rows($result) == 0) {
// if team number is not found
echo '<form action="" method="post" >

<div style="display:table-row;height: 25px;">
<strong>TEAM NUMBER</strong>
</div>

<div style="display:table-row;height: 25px;">
<label style="display:table-cell">Team Number: </label>
<input style="display:table-cell; background-color:#FFFFFF" autocomplete="OFF" name="teamnumber" size="4" type="number" step="1"
required></div>
<div style="display:table-row;height: 25px;">
<input type="submit" name="getteam" value="Retrieve Team" style= "border:#000000 solid 1px; font-weight:bold; margin:15px auto;margin-left: 100%; display:block">

</form>
</div>';
// break out to variable TEAM choose
echo '<div style="display:table-cell; background-color:#E50A05; font-weight:bold; color:#ffffff; padding:10px 125px; margin:auto">No Team Number Found</div>';
$hide1 = 'display:none';


// Offer to send back to start
}
else {
while($row = mysql_fetch_array($result)){
// Declare Variables and Row Status

//$team = $row['teamnumber'];
$fname1 = $row['fname1'];
$lname1 = $row['lname1'];
$fname2 = $row['fname2'];
$lname2 = $row['lname2'];
$fname3 = $row['fnamec'];
$lname3 = $row['lnamec'];
$teamname = $row['teamname'];
$teamnumber = $row['teamnumber'];
Last edited by toivo on Wed Dec 13, 2017 9:26 pm, edited 1 time in total.
Reason: mod note: moved to 3.x Coding

User avatar
AMurray
Joomla! Exemplar
Joomla! Exemplar
Posts: 9739
Joined: Sat Feb 13, 2010 7:35 am
Location: Australia

Re: code in an article that references csv is broken

Post by AMurray » Wed Dec 13, 2017 9:05 pm

A link to the website, and the exact file that you're having trouble with would be more useful. We really need to see the functionality on the page you're describing.

Also can you please post the FPA Report, see the top of this forum page for detail.
viewtopic.php?f=621&t=582860
Regards - A Murray
General Support Moderator

User avatar
AMurray
Joomla! Exemplar
Joomla! Exemplar
Posts: 9739
Joined: Sat Feb 13, 2010 7:35 am
Location: Australia

Re: code in an article that references csv is broken

Post by AMurray » Wed Dec 13, 2017 9:07 pm

Can you advise what extension is being used for this - or is this a piece of code written or found on the web somewhere and integrated into the site?
Regards - A Murray
General Support Moderator


Locked

Return to “Joomla! 3.x Coding”