Jump to content

Simon Mayer

Members
  • Posts

    44
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://ribbontree.co.uk

Profile Information

  • Gender
    Male
  • Location
    Manchester, United Kingdom

Simon Mayer's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. You should set this in your MySQL query, rather than your PHP You would need to use LIMIT to specify the maximum number of results (and an offset if you are doing a later page). At the end of your query, add something like ' LIMIT ' . $offset . ', ' . $limit You would have to define $offset and $limit by something else, such as $_GET attributes in the URL.
  2. Yes, there are a few options, but anything you do would take time to implement, as you would need to have a corresponding load option. The biggest obstacle would be getting the data from where it is stored, into the relevant rows. You could: Store the data locally (suitable on a temporary basis) by using cookies Save the data to a database, then give the user a permalink or a password to access it Output the data to some kind of file, like CSV, Json or XML and then get the user to download it. I think the database would be your best option, but you would need to structure the tables properly and then develop the queries to write to and read from the database.
  3. What is the problem you're having? The more detail you give, the more likely someone is going to be able to help.
  4. Try this: <?php $array = array('t1', 't2', 't3', 't4', 't5', 't6', 't7', 't8'); $j = count($array); for ($a=0; pow(2, $a) <= $j; $a++) //determine the highest power of 2 that will go into the array count { $y[$a] = 1; $maxpower = $a; } for ($i=1; $i < $j*2; $i++) { if($i % 2 != 0) //odd number rows for teams { $line[$i] = '<td><input type=button class="team" value="' . $array[($i-1)/2] . '"></td>'; } else { for($b=0; $b<=$maxpower; $b++) { if($i % pow(2, $b) == 0) //even rows for future rounds. every 2^1 rows for first winner, 2^2 for second winner, 2^3 for third and so on. { if($i % pow(2, $b+1) != 0) //does not divide by the next power of 2, so this must be the last available cell { $line[$i] .= '<td><input type=button class="team" value="">name="WIN'.$b.'_'.($y[$b]++).'</td>'; } else //the input will be added in a future round { $line[$i] .= '<td> </td>'; } } } } } ?> <html> <body> <table> <?php foreach($line as $row) { ?> <tr> <?php echo $row; ?> </tr> <?php } ?> </table> </body> </html> particular changes: $y[$a] = 1; name="WIN'.$b.'_'.($y[$b]++)
  5. each row has a value $i - perhaps that could be useful. If not, you should be able to create a new incrementing value as you work through the loops. I didn't go too deeply into that, as I'm not familiar with your code and didn't want to interfere with what you've done already.
  6. Changing the name is one solution, but it is good practice to use grave accents (backticks) ` ` ideally avoid reserved words AND use grave accents Eventually you may be unlucky enough to come up against another reserved word. Perhaps if the table was built by someone else. If you are used to using grave accents, you are unlikely to encounter any unexpected syntax errors.
  7. It looks like you are not validating contents before calling mail(). Try something like this. if ($_POST['codigo'] == $_POST['seguranca']) { if(strlen($_POST['relevantfieldname']) > 0) { if (mail($para,$assunto,$conteudo,$headers) == true)
  8. Here is something that works as a standalone example. You will need to customise it to work with your script, but I suspect you will find that relatively straight forward. The most difficult thing here was getting the mathematics right in order to place the rows in the right place. <?php $array = array('t1', 't2', 't3', 't4', 't5', 't6', 't7', 't8'); $j = count($array); for ($a=0; pow(2, $a) <= $j; $a++) //determine the highest power of 2 that will go into the array count { $maxpower = $a; } for ($i=1; $i < $j*2; $i++) //needs almost twice as many rows as teams { if($i % 2 != 0) //odd number rows for teams { $line[$i] = '<td><input type=button class="team" value="' . $array[($i-1)/2] . '"></td>'; } else { for($b=0; $b<=$maxpower; $b++) { if($i % pow(2, $b) == 0) //even rows for future rounds. every 2^1 rows for first winner, 2^2 for second winner, 2^3 for third and so on. { if($i % pow(2, $b+1) != 0) //does not divide by the next power of 2, so this must be the last available cell { $line[$i] .= '<td><input type=button class="team" value=""></td>'; } else //the input will be added in a future round { $line[$i] .= '<td> </td>'; } } } } } ?> <html> <body> <table> <?php foreach($line as $row) { ?> <tr> <?php echo $row; ?> </tr> <?php } ?> </table> </body> </html>
  9. I think I can do something, but it probably won't be tonight. In case it helps, I've worked out that the teams appear on every other row in round 1 on every fourth row in round 2, every eighth row in round 3, etc.
  10. Just so I understand, are you wanting to produce something like this? A -A or B B --A or B or C or D C -C or D D
  11. Just a thought... Did you mean to use $name? If you have $this->id, I'd expect you to be using $this->name too.
  12. The repeating background image in the footer (/style/black/menu.png) looks like a tyre-tread, viewed from above. I think it is distracting to have it fade, then be followed by the dark top edge of the same image, then fade, and so on. Also, I think you should consider have the same username/password for the main site and the forum. You can probably merge these from the outset, but once you have users registering separately for both, it becomes extremely difficult.
  13. I think there is too much contrast between the dark-blue background and the white space - particularly the "Need a Mortgage" banner. Perhaps either a lighter background colour, or a way of blurring it into the white spaces would be better. Also, the "New listings" are too tightly packed. Perhaps increase the margin/padding below each listing.
  14. Will something like this do? <?php $array = array('t1', 't2', 't3', 't4', 't5', 't6', 't7', 't8'); $j = count($array); for ($i=0; $i < $j/2; $i++) { echo $array[$i] . ' V ' . $array[$j - $i - 1] . '<br/>'; } ?>
  15. It's not possible to see where you need to echo, as we cannot see the bit of the page that contains your submit button. It would be easiest to explain if you can provide your full code (including HTML) for the page.
×
×
  • 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.