Jump to content

Yucky

Members
  • Posts

    81
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Yucky's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Fix: echo "<img src='http://datenight.netne.net/images/".$info['img']."' title='".$info['username']."' width='50' height='50'>";
  2. I used quick tags for brevity in the example. Apart from that, there's not really anything wrong with it. It seems to be the cleanest and quickest way of doing what he wanted.
  3. A bit rough, but here goes: <table width="300" border="1" cellspacing="0" cellpadding="0"> <?php foreach($yourArray as $key => $value): switch($value['yourCategory']) { case 1:$colour = "00000";break; case 2:$colour = "FFFFFF";break; } ?> <tr> <td bgcolor="#<?=$colour;?>"><?=$value['yourCategoryName']; ?></td> <td bgcolor="#<?=$colour;?>"><?=$value['yourCategoryData']; ?></td> </tr> <?php endforeach; ?> </table> Wouldn't be too hard to move the logic into the function that returns your data array.
  4. Your question doesn't really make any sense. What are you trying to achieve?
  5. I've told him this several times already. By default, HTML files will not be parsed by PHP.
  6. I said earlier that the file should be .php, not .html.
  7. You have to run the script on a proper server that supports PHP. You can't just preview PHP scripts in your browser.
  8. Given that you may want to return data to be displayed on the page as well as error messages, it seems logical to use multidimensional arrays. I find that it's easier to stick with one structure even when I don't need to send data/error messages back to the user rather than possibly changing it later down the line.
  9. Did you remember to use session_start();? Edit: Beaten to the punch.
  10. Using an array to hold errors is pretty standard. Have you considered using a multidimensional array instead? When I need to display errors to the user, I tend to use a multidimension array that might have a structure along the lines of: $array['data'][] - data needed be displayed goes in this subarray. $array['errors'][] - informative error messages are stored in this subarray and later looped through. $array['success'] - true/false. Helps to determine styling such as a tick or a cross.
  11. There's not anything you can do to prevent automated form filling. You can however try and prevent automated form submission through the use of captchas.
  12. Yucky

    Help

    Change: $qry = "SELECT * FROM users WHERE username='$_POST['username']'"; To: $qry = "SELECT * FROM users WHERE username='".$_POST['username']."'"; Take care with double/single quotes. With your original code, PHP would have seen $_POST[ and then been cut off by the single quote.
×
×
  • 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.