-
Hi John,
I have sent you mail - thanks for the contact details.
By edit I mean the following:
I have some script that looks like this and what you see here produces the information one would see on a row of the page in question.
PHP Code:
<tr class="alt2">
<td>WANDERERS</td>
<td>18 SEPTEMBER 2011</td>
<td>?</td>
<td>OPEN/CLOSED</td>
<td><form action="https://www.payfast.co.za/eng/process" method="post">
<input type="hidden" name="cmd" value="_paynow">
<input type="hidden" name="receiver" value="junior@hayesgolf.co.za">
<input type="hidden" name="item_name" value="Payment - Wanderers - Glacier Series">
<input type="hidden" name="item_description" value="payment">
<input type="hidden" name="amount" value="120.00">
<input type="hidden" name="return_url" value="http://www.gnjgf.co.za/entryform.php">
<input type="hidden" name="cancel_url" value="http://www.gnjgf.co.za/Glacier_Main.html">
<input type="submit" style="width:66px;height:20px;background-color:#B5CCE4;font-size:10px; font-family: arial, sans-serif;" value="PAY NOW">
</td>
</tr>
After it has been edited the information as seen above would now look like this
PHP Code:
<tr class="alt2">
<td>WANDERERS</td>
<td>18 SEPTEMBER 2011</td>
<td>?</td>
<?php
if($num_rows >= 80){
echo '<td><font style="font-size:11px" color="Red" face="Arial">CLOSED</td>
<td> </td>';
}
else {
echo '<td><b><font style="font-size:11px" color="Blue" face="Arial">OPEN</b></td>
<td><form action="https://www.payfast.co.za/eng/process" method="post">
<input type="hidden" name="cmd" value="_paynow">
<input type="hidden" name="receiver" value="junior@hayesgolf.co.za">
<input type="hidden" name="item_name" value="Payment - Wanderers - Glacier Series">
<input type="hidden" name="item_description" value="payment">
<input type="hidden" name="amount" value="120.00">
<input type="hidden" name="return_url" value="http://www.gnjgf.co.za/entryform.php">
<input type="hidden" name="cancel_url" value="http://www.gnjgf.co.za/Glacier_Main.html">
<input type="submit" style="width:66px;height:20px;background-color:#B5CCE4;font-size:10px; font-family: arial, sans-serif;" value="PAY NOW">
</td>
';
}
?>
</tr>
I hope this help in providing information as to how I edit my file.
Thanks again for you help
-
So this is some sort of limitation of your editor? I can edit the file you sent me to make it look like you want. Even NotePad can do that. What editor are you using?
Anyways, the file you sent cannot be the whole deal. It makes frequent reference to:
PHP Code:
if($num_rows >= 80){
But $num_rows is never defined nor (as is implied it should be by the above test) incremented in it.
So I would tend to assume that the file you sent me is an include to another file that has that information/process on it.
But I would also observe that what you have in the file you sent seems awfully redundant. This leads me to believe that perhaps it's a generated file, or should be. Is it?
If so, I need the file that makes it. If not, we need to make it a generated file by creating a file that will generate it.
Do you have a database? Is that where all of this is coming from?
-
Hi John,
Thanks for the reply.
Your are correct in noticing that I make reference to another file.
I am trying to vreate a tournament entry form that will limit the field isze to 80. The information is doen via MySQL and ideally the excercise would be that if the emtries are equal to or greater tha 80 the player will not be able to enter.
If one veiws the file then the information that is produced in the left hand column will determine my result.
So yes you are correct the two need to be linked.
PHP Code:
<?php
$connect = mysql_connect("localhost", "e****a_r***t", "r****h") or
die ("Hey loser, check your server connection.");
mysql_select_db("eghfya_Members");
$quey1="select * from _Form_Nr_3 ORDER BY `i_wish_to_play` ASC, `surname` ASC ";
$result=mysql_query($quey1) or die(mysql_error());
?>
<!------------------------------------------------------------------>
<! THIS SECTION CHANGES WHAT THE TABLE LOOKS LIKE >
<!------------------------------------------------------------------>
<table border=1 width="85%" bordercolor="#D3E2FE" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF" style="font-size:11px" cellspacing=0>
<!------------------------------------------------------------------>
<! THIS SECTION CHANGES THE MAIN HEADING >
<!------------------------------------------------------------------>
<caption><b><font style="font-size:20px" color="#376091" face="Arial">
</font><b><caption>
<!------------------------------------------------------------------->
<! THIS SECTION FETCHES THE INFORMATION FROM THE MYSQL TABLE >
<!------------------------------------------------------------------->
<?php
$counter = array();
$last_wish_to_play = "";
$firstNAsAString = "";
while($row=mysql_fetch_array($result)){
//----------------------------------------------------------------------------------------------------
// THIS SECTION ADDS 3 EMPTY LINES IF THERE IS A SPLIT BUT ONLY AFTER SOME RECORDS HAVE BEEN DISPLAYED
//----------------------------------------------------------------------------------------------------
if($i > 0 AND $row['i_wish_to_play'] != $last_wish_to_play)
{
echo '<tr>
<td colspan="3"> </td>
</tr>';
}
//------------------------------------------------------
// THIS SECTION ADDS HEADINGS
//------------------------------------------------------
if ($row['i_wish_to_play'] != $last_wish_to_play) {
echo '<tr>
<td colspan="3" align="center" bgcolor="#376091"><font style="font-size:11px" color="#FFFFFF" face="Arial"><b>'.$row['i_wish_to_play'].'</b></font></td>
</tr>';
echo '<tr>
<td bgcolor="#376091"><font style="font-size:11px" color="#FFFFFF" face="Arial"><b>FULL NAME</b></font></td>
<td align="center" bgcolor="#376091"><font style="font-size:11px" color="#FFFFFF" face="Arial"><b>HANDICAP</b></font></td>
<td align="center" bgcolor="#376091"><font style="font-size:11px" color="#FFFFFF" face="Arial"><b>CELL NUMBER</b></font></td>
</tr>';
}
echo '<tr><td bgcolor="#B5CCE4"><font style="font-size:10px" color="#000000" face="Arial">';
echo '<option value="'.strtoupper($row['surname']).', '.strtoupper($row['name']).'">'.strtoupper($row['surname']).', '.strtoupper($row['name']).'</option>';
echo '</td><td align="center" bgcolor="#B5CCE4"><font style="font-size:10px" color="#000000" face="Arial">';
echo $row['my_handicap_is'];
echo '</td><td align="center" bgcolor="#B5CCE4"><font style="font-size:10px" color="#000000" face="Arial">';
echo $row['cell_phone'];
if($row['i_wish_to_play'] != $last_wish_to_play)
{
// the first n words to extract
$n = 5;
// extract the words
$words = explode(" ", $row['i_wish_to_play']);
// chop the words array down to the first n elements
$firstN = array_slice($words, 1, $n-1);
// glue the 3 elements back into a spaced sentence
$firstNAsAString = implode(" ", $firstN);
}
if(!isset($counter[$firstNAsAString]))
$counter[$firstNAsAString] = 0;
else
$counter[$firstNAsAString]++;
$last_wish_to_play = $row['i_wish_to_play'];
$i++;
echo '</td></tr>';
}
echo '</table>';
?>
The othe rpart which shows the left hand side of the page is this part:
PHP Code:
<!------------------------------------------------------------------>
<! THIS SECTION CHANGES THE MAIN HEADING >
<!------------------------------------------------------------------>
<table>
<td colspan="2" width="25%" align="center" bgcolor="#376091"><font style="font-size:12px" color="#FFFFFF" face="Arial"><b>TOTAL ENTRIES</b></font></td>
</table>
<!-------------------------------------------------------------------->
<! THIS SECTION COUNTS THE ROWS THAT ARE UNIQUE AND PROVIDES RESULT >
<!-------------------------------------------------------------------->
<?php
echo '<table border=1 bgcolor=#B5CCE4 bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF" cellspacing=0>';
foreach($counter as $key => $value)
{
echo '<tr>
<td align="center" width="10%" bgcolor="#B5CCE4"><font style="font-size:12px" color="#000000" face="Arial"><b>'.$value.'</b></font></td>
<td colspan="2" width="65%" align="center" bgcolor="#B5CCE4"><font style="font-size:10px" color="#000000" face="Arial">'.$key.'</font></td>
</tr>';
}
echo '</table>';
?>
I currently use a program called BlueVoda which is freely downloadable form the internet - WYSIWYG web builder
I would be so appreciatetive if you could help me there as it is where I would be going to.
Regards
Rob
-
Hi John,
I have edited the text file and tried to insert back to the html.
Same problem - it is limiting me to the amount of characters in the file -really wierd.
The idea was a good one.
Regards
Rob
-
Hi John,
I have managed to make the changes useing Cpanel - so the first part is done.
Thanks for your willingness to help me with it.
Without being presumpteous do you perhaps see your way to assist me with the second part - i.e making the link work so as to count to 80 and then close the tournament?
I look forward to your reply
Regards
Rob
-
A reason I asked about the database is that I'm not real up on that (MySQL in this case I think) or the PHP required to interface with it.
I'm pretty sure now that's what you're doing. I do know that if you want to count records and/or loop through them - that's pretty straightforward stuff. Unfortunately it's stuff I'm just not all that familiar with yet. It's on my list.
What I would suggest is opening a new thread in PHP:
http://www.dynamicdrive.com/forums/f...splay.php?f=11
Show them what you have as far as the PHP goes, give them a link to the output. Ask your question in terms of getting the output to look how you want it to look. You may also need to tell them about the structure of your database.
Or - I assume you got most of this stuff somewhere. There's probably documentation and a forum there. If either is any good, one and/or the other would probably be a better place to go to for your answers than anywhere on this forum.
-
Hi John,
Thanks for the advice and assistance.
I will try the new thread and see where it leads.
Kind Regards
Rob
-
Hi John,
I have had the thread closed by "DDADMIN" and advised to continue with the process on this thread.
I thought it was a differnet issue and accepted your advice.
No matter lets see hwta transpires.
Regards
Rob
-
I had no idea that by following my advice you would be opening a third thread on this. This really is a MySQL/PHP question and should never of been in javascript (my forte). So I guess (in order to satisfy that and ddadmin) I'll move it to PHP. I should also give you a warning about cross posting, but I think you get the idea. It probably could also use a new title - Using data from MySQL, with a see also to:
http://www.dynamicdrive.com/forums/s...d.php?p=239416
-
Hi John,
Thaks for your reply and help - I never meant to cause any problems here and your warning / advice will be headed.
Thanks for moving the thread to the correct place.
I hope I will find reply soon.
Regards
Rob