Jump to content

Ifa

Members
  • Posts

    88
  • Joined

  • Last visited

    Never

About Ifa

  • Birthday 12/13/1982

Contact Methods

  • Website URL
    http://cutepoll.sectiongraphix.net/forum/

Profile Information

  • Gender
    Male
  • Location
    Rauma, Finland

Ifa's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. It's actually empty, not is_empty ;)
  2. I think AndyBs solution is good, and you should use it, but this so that you can learn more: [code=php:0]switch($team_id){ case 1: echo '1st Team'; break; case 2: echo '2nd Team'; break; case 3: echo '3rd Team'; break; etc }[/code] Right way to use if would be: [code=php:0]if($team_id == 1){ echo '1st Team'; } elseif($team_id == 2){ echo '2st Team'; } elseif($team_id == 3){ echo '3rd Team'; }[/code] etc
  3. Ifa

    Math problem

    Ah, that makes sense :)
  4. [CODE] <?PHP if(!$_POST["new_html"]){ ?> <form action="" method="post"> <textarea name="new_html"><?PHP echo str_replace("<", "&lt;", file_get_contents('file.html')); ?></textarea> <input type="submit" value=" Save " /> </form> <?PHP } if($_POST["new_html"]){ $file = fopen('file.html', '+w') or die('Could not open file'); fwrite($file, $_POST["new_html"]); fclose($file); echo 'Changes saved'; } ?>[/code]
  5. Ifa

    Math problem

    I'm somewhat new to mysql, what do you mean by locked?
  6. Ifa

    Math problem

    This is getting funny: $var = $var2 + 10; mysql_query("UPDATE table SET var = $var WHERE some=thing ") or die('Query failed: ' . mysql_error()); echo $var; the echo returns 16, but the update makes it 18... And though it seems extremely odd, IE just makes it right, and firefox doesn't. So much for it being a serverside language ;) $var2 = -1 * round(($var3 * $var4) / $var5, 0); Oh and with  or without ' ' seems to make no diffrence...
  7. [code]<?PHP session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Login</title> </head> <body> <?php   if (isset($HTTP_POST_VARS['user_name'])&&(isset($HTTP_POST_VARS['pwd']))) {     // getting data from the login form       $user_name = $HTTP_POST_VARS['user_name'];       $pwd = $HTTP_POST_VARS['pwd']; $connection = mysql_pconnect('localhost', 'root', 'justus') or die ('Unable to connect!'); // select database for use mysql_select_db('sme_cms') or die ('Unable to select database!'); $query = 'select * from auth '           ."where name='$user_name' "           ." and pass=password('$pwd')";   $result = mysql_query($query);   if (mysql_num_rows($result) >0 )   {     // if they are in the database register the user id     $HTTP_SESSION_VARS['valid_user'] = $user_name;      } } if (isset($HTTP_SESSION_VARS['valid_user']))   {     echo 'You are logged in as: '.$HTTP_SESSION_VARS['valid_user'].' <br />';     echo '<a href="logout.php">Log out</a><br />';   }   else   {     if (isset($user_name))     {       // if they've tried and failed to log in       echo 'Could not log you in';     }     else     {       // they have not tried to log in yet or have logged out       echo 'You are not logged in.<br />';     }   }     ?> </body> </html>[/code]
  8. Try adding the session_start(): to the top of the file, or if you are including the file, at the top of the file that is including it....
  9. Ifa

    Math problem

    Oops, your right about the from, I use where, I just wrote the code as an example and made a tiny mistake :) No, the data isn't coming from a form, it's a number that is increased in a loop. But thanks, I'll try it without no single quotes. I can test it now though, as I'm at work, and all this comp has is IE... To be more spesific, the number is a calculation actually, $var = round($var2 / $var3, 0);
  10. Ifa

    Math problem

    $var = 1; mysql_query("UPDATE table SET var=var+'$var' FROM somewhere"); For some reason only Internet Explorer makes the math correct, other browsers always return a bit higher number than they should (ie 1+1 = 5). I'm quite lost...
  11. Ajax is not so much php as it is javascript.
  12. easiest way would be to use [url=http://www.w3schools.com/tags/tag_acronym.asp]acronym[/url] It deosn't really follow the mouse (I think), but it's easy to use
×
×
  • 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.