Jump to content

Hellusius

Members
  • Posts

    55
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Hellusius's Achievements

Member

Member (2/5)

0

Reputation

  1. I made a CSS class [CODE].backgroundlayer  {                   height: 100%;                   width: 800;                   background-color: #EFDFC9;                   margin: 0px 0px 0px 0px;                   padding: 0px 0px 0px 0px;                   text-align: center;                   text-vertical-align: top;                   }[/CODE] And all other site content is within this table class, but the align doesn't seem to work. Am I doign something wrong?
  2. didn't think of that one, thanks for the header, and [code]function hello ($amount=20) {   for ($i = 0; $i <= $amount; $i++)   echo $i . "<br />\n"; } ?> <?php hello(); ?> [/code] is shorter ^_^
  3. well, I just wanted to echo the number 0 to 20 since the function has to play itself from 0 to 20 right, so I thought, if'd take varb "i" I would be safe
  4. I know this has no real relevance, but I would like to ask why this does not work. I wanted to echo each number from 0 to 20 [code]<?php function hello ($amount=25) {   for ($i = 0; $i < $amount; $i++)   return $i; } ?> <?php echo (hello($i)); ?>[/code]
  5. think I got it, you wrote "of" instead of "or" Edit: got some result :D [code]Rows  1 Row length ø 20 Row size  ø 2,068 Bytes Next Autoindex 2 Creation Sep 02, 2006 at 12:49 AM Last update Sep 02, 2006 at 10:00 PM Last check Sep 02, 2006 at 06:49 PM[/code]
  6. now I get an error on the line [code]mysql_select_db($db_name) or die(" Error selecting database: ". mysql_error()); // any problems?[/code] which is [code]Parse error: syntax error, unexpected T_STRING in /home/www/warnicro.awardspace.com/postit.html on line 16[/code]
  7. bumped into a new problem now [code]<?php if (isset($_POST['submit'])) {   // collect data sent from form but ONLY if it was submitted   $name = $_POST['name'];   $age = $_POST['age'];   $sex = $_POST['sex'];   // connection variables   $host = "******"; // almost inavariably   $db_name = "details";   $db_user = "******";   $db_pass = "******";   $db_table = "details";   // connect to host and select db   mysql_connect($host, $db_user, $db_pass);   mysql_select_db($db_name);   // create and execute the query to insert data   $query = "INSERT INTO $db_table (id, name, age, sex) VALUES ('', '$name' , '$age' , '$sex')";   $result = mysql_query($query) or die("Error: ". mysql_error(). " with query ". $query); // in case it bombs ?> <center> <table width="500" bgcolor="000000" cellspacing="0" cellpadding="0" align="center">   <tr>     <td> <font color="1055AA" size="3">Infromation has been added, <a href="/index.php">click here</a> to return to the homepage</font>     </td>   </tr> </table> </center> <?php } else { ?> <form action = "<?php echo $_SERVER['PHP_SELF']; ?>" method = "post"> Enter your name: <br /> <input type = "text" size = "40" name = "name" /><br /> Enter your age: <br /> <input type = "text" size = "3" name = "age" /><br /> Enter your sex: <br /> <input type = "text" size = "1" name = "sex" /><br /><br /> <input type = "submit" name = "submit" value = "Add Data" /> </form> <?php } ?>[/code] it gave me this error [quote]Error: No database selected with query INSERT INTO details (id, name, age, sex) VALUES ('', 'test' , '00' , 'v')[/quote] I know its something with that line, but I can't see what, any help is very much appreciated
  8. You can't really code html, since you cannot store them into what you can call a "variable" in CSS you can via classes, which you can use over and over again =)
  9. ok that made sense, starting to understand. anyway, I get a blanco page, but how can I see if anything is added to the database?
  10. Oops  :-[, sorry I did that, thank you for editing it, going to try the code now. P.S, hope you don't mind me asking, but what is the thing <?php } ?> on the bottom for?
  11. I made a database with a few things, just to take a peak at how things work, but I already stranded, I made a database, which I connected to and I made a few forms so you can insert a row into the database, this is the coding [code]<form action = "/postit.html" method = "post"> Enter your name: <br /> <input type = "text" size = "40" name = "name" /><br /> Enter your age: <br /> <input type = "text" size = "3" name = "age" /><br /> Enter your sex: <br /> <input type = "text" size = "1" name = "sex" /><br /><br /> <input type = "submit" value = "Add Data" /> </form> <?php // collect data sent from form $name = $_POST['name']; $age = $_POST['age']; $sex = $_POST['sex']; // connection variables $host = "*****"; // almost inavariably $db_name = "*****"; $db_user = "*****"; $db_pass = "*****"; $db_table = "details"; // connect to host and select db mysql_connect($host, $db_user, $db_pass); mysql_select_db($db_name); // create and execute the query to insert data $query = "INSERT INTO $db_table (id, name, age, sex) VALUES ('', '$name' , '$age' , '$sex')"; $result = mysql_query($query); ?>[/code] Did I forget something, cause nothing is being added to the database in my oppinion
  12. That works, Thank you very very much :)
  13. thank you. with that solved I bumped into another problem which is I want them to sum up but instead the are placed behind one another so the answer is 15315 while it should be 168
  14. I am trying to sum two variables, but it gives me the following error [code]Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/www/warnicro.awardspace.com/stats.php on line 3[/code] The php code is [code]<? echo "<font color=\"#EFDFA0\">Statistics<br />; $count = file_get_contents("count.txt"); $count2 = file_get_contents("count2.txt"); echo "<font color=\"#EFDFA0\">Homepage views: ".trim($count); echo "<font color=\"#EFDFA0\">Total page view: ".trim($count) + ($count2); ?>  [/code] Anyone see what I am doing wrong?
  15. Hellusius

    How to...

    I want to start learning how to use databases on sites, cause I can make them via "myphpadmin" page but I really have no clue how to use it really, like for instance how to make a register page to my site so people can register and etc. Now my question is, what is the best place to start reading about it, I know HTML properly, CSS more than enough, Javascript till certain extent, and very limited php.
×
×
  • 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.