Jump to content

F1Fan

Members
  • Posts

    1,182
  • Joined

  • Last visited

Everything posted by F1Fan

  1. Line 165 needed a }. <html> <head> <title></title> <link rel="stylesheet" type="text/css" href="simpletree2.css" /> </head> <?php $con = mysql_connect("mysql5.webdesignsbyliz.com","twilitegxa","minimoon"); if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("smrpg", $con); //get Sailor Moon's data from the "scout" table $result = mysql_query("SELECT * FROM scout where identity = 'Sailor Moon'") or die(mysql_error()); $row = mysql_fetch_array( $result ); $birthdatemonth = $row["birthdatemonth"]; $birthdateday = $row["birthdateday"]; $birthdateyear = $row["birthdateyear"]; $birthdate = $birthdatemonth . " " . $birthdateday . ", ". $birthdateyear; $identity = $row["identity"]; echo "<h1><center>$identity</center></h1>"; echo "<table border='0' width='100%'>"; // keeps getting the next row until there are no more to get echo "<tr><td width='25%'>"; echo "<b>Name:</b></td><td>"; echo $row['charactername']; echo "</td></tr><tr><td>"; echo "<b>Element Of Influence:</b></td><td>"; echo $row['elementofinfluence']; echo "</td></tr><tr><td>"; echo "<b>Age:</b></td><td>"; echo $row['age']; echo "</td></tr><tr><td>"; echo "<b>Birthdate:</b></td><td>"; echo $birthdate; echo "</td></tr><tr><td>"; echo "<b>Height:</b></td><td>"; echo $row['heightfeet']; echo "&#38;#39; " ; echo $row['heightinches']; echo "&#38;#34;"; echo "</td></tr><tr><td>"; echo "<b>Blood Type:</b></td><td>"; echo $row['bloodtype']; echo "</td></tr><tr><td>"; echo "<b>Hobbies:</b></td><td>"; echo $row['hobbies']; echo "</td></tr><tr><td>"; echo "<b>Favorite Color:</b></td><td>"; echo $row['favoritecolor']; echo "</td></tr><tr><td>"; echo "<b>Favorite Gemstone:</b></td><td>"; echo $row['favoritegemstone']; echo "</td></tr><tr><td>"; echo "<b>Favorite Food:</b></td><td>"; echo $row['favoritefood']; echo "</td></tr><tr><td>"; echo "<b>Least Favorite Food:</b></td><td>"; echo $row['leastfavoritefood']; echo "</td></tr><tr><td>"; echo "<b>Favorite School Subject:</b></td><td>"; echo $row['favoriteschoolsubject']; echo "</td></tr><tr><td>"; echo "<b>Least Favorite School Subject:</b></td><td>"; echo $row['leastfavoriteschoolsubject']; echo "</td></tr><tr><td>"; echo "<b>Strengths:</b></td><td>"; echo $row['strengths']; echo "</td></tr><tr><td>"; echo "<b>Weaknesses:</b></td><td>"; echo $row['weaknesses']; echo "</td></tr><tr><td>"; echo "<b>Goal:</b></td><td>"; echo $row['goal']; echo "..."; echo "</td></tr></table><p>"; echo $row['biography']; echo "</p>"; echo "</td></tr>"; echo "<tr><td> </td></tr>"; echo "</table>"; $result = mysql_query("SELECT * FROM stats where identity = 'Sailor Moon'") or die(mysql_error()); $row = mysql_fetch_array( $result ); echo "<table width='100%' valign='top'><tr><td width='50%' align='right' valign='top'>\n"; // added align='right' valign='top' echo "<table width='100%' border='0' id='stats' align='right'>\n"; // keeps getting the next row until there are no more to get echo "<tr><td colspan='3' id='th'>Stats And Derived Values</td></tr>\n"; echo "<tr><td>\n"; echo "<b>Body:</b></td><td col class='right'>\n"; echo $row['body']; echo "</td></tr><tr><td>\n"; echo "<b>Mind:</b></td><td col class='right'>\n"; echo $row['mind']; echo "</td></tr><tr><td>\n"; echo "<b>Soul:</b></td><td col class='right'>\n"; echo $row['soul']; echo "</td></tr><tr><td>\n"; echo " </td></tr><tr><td>\n"; echo "<b>Health Points:</b></td><td col class='right'>\n"; echo $row['health']; echo "</td></tr><tr><td>\n"; echo "<b>Energy Points:</b></td><td col class='right'>\n"; echo $row['energy']; echo "</td></tr><tr><td>\n"; echo "<b>Attack Combat Value:</b></td><td col class='right'>\n"; echo $row['acv']; echo "</td><td col class='right'>\n"; // added </td> echo " ("; echo $row['acv_sa']; echo " for Sailor Scout Attack)"; echo "</td>\n"; echo "</td></tr><tr><td >\n"; echo "<b>Defense Combat Value:</b></td><td col class='right'>\n"; echo $row['dcv']; echo "</td><td col class='right'>\n"; // added </td> echo " ("; echo $row['dcv_sa']; echo " for Sailor Scout Attack)"; //echo "</td>\n"; // that's an extra one echo "</td></tr><tr><td>\n"; echo "<b>Total Character Points:</b></td><td col class='right'>\n"; echo $row['tcp']; echo "</td></tr>\n"; echo "</table>\n"; //while statement for character_attributes while($row = mysql_fetch_array( $result )) { if ($row['attribute_id']=="Scout Powers"){ echo "<tr><td>\n"; echo $row['attribute_id']; echo " "; echo $row['desc']; } elseif ($row['desc']!=""){ echo "<tr><td> \n"; //indent two spaces echo $row['attribute_id']; echo " "; echo $row['desc']; } elseif ($row['sub']==1){ //not sure how to detect its subattributes, so you'll have to do that echo "<tr><td> \n"; //indent four spaces echo $row['attribute_id']; echo " "; echo $row['desc']; } else{ //this is the defeault echo "<tr><td> \n"; //indent six spaces echo $row['attribute_id']; echo " "; echo $row['desc']; } echo "</td><td width='2%'> </td><td width='1%' align='right'>\n"; echo $row['level']; echo "</td><td width='2%'> </td><td width='2%'> </td><td width='1%' align='right'>\n"; echo $row['points']; echo "</td><td width='2%'> </td></tr>\n"; } //end while statement $result = mysql_query("SELECT * FROM character_attributes ORDER BY attribute_id ASC") or die(mysql_error()); $row = mysql_fetch_array( $result ); echo "</td><td valign='top' width='50%' rowspan='2'>\n"; // added this whole line echo "<table width='100%' border='0' id='stats' align='left'>\n"; echo "<tr><td colspan='7' id='th'>Character Attributes And Sub-Attributes</td></tr>\n"; echo "<tr class='sub'><td>Attribute/Sub-Attribute</td><td colspan='3' align='center'>Level</td><td colspan='3' align='center'>Points</td></tr>\n"; echo "<tr><td></td></tr>\n"; // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { echo "<tr><td>\n"; echo $row['attribute_id']; echo " "; echo $row['desc']; echo "</td><td width='2%'> </td><td width='1%' align='right'>\n"; echo $row['level']; echo "</td><td width='2%'> </td><td width='2%'> </td><td width='1%' align='right'>\n"; echo $row['points']; echo "</td><td width='2%'> </td></tr>\n"; } echo "</table></td></tr><tr><td valign='top' width='50%'>\n"; $result = mysql_query("SELECT * FROM character_defects where identity = 'Sailor Moon' ORDER BY defect_id ASC") or die(mysql_error()); $row = mysql_fetch_array( $result ); echo "<table border='0' width='100%' id='stats' align='right'>\n"; echo "<tr><td colspan='3' id='th'>Character Defects</td></tr>\n"; // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { echo "<tr><td>\n"; echo $row['defect_id']; echo " "; echo $row['desc']; echo "</td><td>\n"; echo $row['bp']; echo " BP"; echo "</td></tr>\n"; } echo "</table>\n"; echo "</td><td>\n"; echo "</td></tr></table>\n";
  2. OK, something is up. I just tested on my server. I made it all one file: <form name="aa" method="post"> <input type="text" name="xx" value="77"> <input type="image" name="deleteasn" value="Delete" src="images/1.gif" alt="Delete"> </form> <?php print_r($_POST); ?> and when I clicked the delete button, this is what I get: Array ( [xx] => 77 [deleteasn_x] => [deleteasn_y] => [deleteasn] => Delete )
  3. What happens when you try this: CREATE TABLE "users" ( "id" int(11) NOT NULL AUTO_INCREMENT, "username" varchar(30) NOT NULL, "password" varchar(40) NOT NULL, "email" varchar(140) NOT NULL, "regdate" int(10) NOT NULL, "ip" varchar(15) NOT NULL, "lastdate" int(10) NOT NULL, PRIMARY KEY ("id") ); CREATE TABLE "forgot" ( "username" varchar(30) NOT NULL, "password" varchar(40) NOT NULL, "email" varchar(140) NOT NULL, "regdate" int(10) NOT NULL, "ip" varchar(15) NOT NULL );
  4. I don't know what your new field name is, so I'll say it's "field_name." elseif ($row['field_name']==1){
  5. Yeah, that creates all sorts of variable scope issues. To get a variable into a function without it being an argument, you need "global $varname;" at the beginning of the function (inside the {}). So, try either adding $fileArray to your arguments for function get_include_contents or add global $fileArray to the top of your get_include_contents function.
  6. Like someone already said, the "_x" and "_y" are the coordinates that were clicked. You really should be getting three: delete delete_x delete_y If you don't see it, try doing a print_r($_POST); to see everything that you're getting. Maybe you'll see something you didn't before.
  7. That's because my code wasn't complete, and I had a typo. Both in this line: elseif ($row['attribute_id']="?"){ //not sure how to detect its subattributes, so you'll have to do that needs to have two "==" and you need to fill in the "?".
  8. OK, I'm lost. Your code is too complicated to follow all broken out like that. List it all in order with the file name right before each section of code so it's easier to follow.
  9. Where is get_include_contents defined? Why don't you use include?
  10. In the top of your function inside of myfile.php, add this line: <?php global $fileArray; ?>
  11. Yes, I believe that when you're referring to table and column names, you use "double quotes" and when referring to data, you use 'single quotes.'
  12. Do you just want multiple items to be checked, or do you still want to limit it somewhat?
  13. Again, just add a "/" at the beginning of your links. <a href="/admin/" class="leftnav">Home</a> <a href="/category/" class="leftnav">Category</a> <a href="/product/" class="leftnav">Product</a> <a href="/order/?status=Paid" class="leftnav">Order</a> <a href="/config/" class="leftnav">Shop Config</a> <a href="/user/" class="leftnav">User</a> <a href="/<?php echo $self; ?>?logout" class="leftnav">Logout</a>
  14. Let's say your website is www.example.com and your file is in the "folder/products" directory. Here's what you need to know: <a target="_blank" href="test.html">test1</a><br> <!-- links to ww.example.com/folder/products/test.html --> <a target="_blank" href="/test.html">test1</a><br> <!-- links to ww.example.com/test.html --> <a target="_blank" href="../test.html">test1</a><br> <!-- links to ww.example.com/folder/test.html --> So, if you always want your links to go to ww.example.com/folder/products/test.html, making all your links: <a target="_blank" href="/folder/products/test.html">test1</a> will work.
  15. This will give you what you want: <?php $subtotal = number_format(($row[2] + $row[3] + $row[4]), 4, '.', ''); ?>
  16. I guess it's personal preference. However, sprintf is for strings and number_format is for numbers, so to me it makes more sense to "format a number" using the function that is designed to format numbers, rather than strings. Again, maybe it's just me. There's nothing "wrong" with sprintf, especially if you're used to using it more. I almost never use sprintf, because I mostly format numbers, so number_format is what I know.
  17. OK, one thing that you should learn about if statements is this: if (conditionA) do actionA if (conditionB) do actionB In this case, these are the possibilities: just actionA, just actionB, both actionA and actionB, or neither actionA or actionB if (conditionA) do actionA elseif (conditionB) do actionB In this case, these are the possibilities: just actionA, just actionB, or neither actionA or actionB if (conditionA) do actionA else do actionB In this case, these are the possibilities: just actionA, or just actionB if (conditionA AND NOT conditionB) do actionA elseif (NOT conditionA AND conditionB) do actionB In this case, these are the possibilities: just actionA, just actionB, or neither actionA or actionB Hopefully that helps you with learning if statements. So, on to your code. Working with the same section with the while statement: <?php while($row = mysql_fetch_array( $result )) { if ($row['attribute_id']=="Scout Powers"){ echo "<tr><td>\n"; echo $row['attribute_id']; echo " "; echo $row['desc']; } elseif ($row['desc']!=""){ echo "<tr><td> \n"; //indent two spaces echo $row['attribute_id']; echo " "; echo $row['desc']; } elseif ($row['attribute_id']="?"){ //not sure how to detect its subattributes, so you'll have to do that echo "<tr><td> \n"; //indent four spaces echo $row['attribute_id']; echo " "; echo $row['desc']; } else{ //this is the defeault echo "<tr><td> \n"; //indent six spaces echo $row['attribute_id']; echo " "; echo $row['desc']; } echo "</td><td width='2%'> </td><td width='1%' align='right'>\n"; echo $row['level']; echo "</td><td width='2%'> </td><td width='2%'> </td><td width='1%' align='right'>\n"; echo $row['points']; echo "</td><td width='2%'> </td></tr>\n"; } ?> Are we getting anywhere?
  18. I agree. A multidimensional array is your best bet. <?php $Value1 = "hello"; $Value2 = "world"; $Value3 = "HI"; $array[$Value1][$Value2] = $Value3; print_r($array); ?>
  19. You will need to use "text-align: center;" in your CSS. However, keep in mind that this will only center the stuff inside that particular element and will not center the element on the page. Since there are no width attributes, the elements are only as wide as the widest stuff in them, so they won't appear centered on the page. You will have to either add "width: 100%;" to your CSS, or if you want everything on the page centered by default, you could apply the "text-align: center;" to your <body> tag. That will center everything in that element (in this case, the whole body).
  20. OK, that gives me a good starting place. I'll help you more tomorrow.
  21. OK, you did confuse me. write it out in a fake if/else statement like this: if the attribute_id is <whatever>, do <something> else if the attribute_id is <whateverelse>, do <somethingelse> and you can nest them, if necessary, like: if the attribute_id is <whatever>, do <something> else do this if statement: if the <some other key> is <whatever>, do <something> else if the attribute_id is <whateverelse>, do <somethingelse> ...
  22. Add {} around any array within double quotes, like this: $html .= "<html><body>{$_POST["Message"]}</body></html>"; And drop the semicolon.
  23. Add [] to your select name, so: <select name="request_choices[]" multiple="multiple" style=" width:170px;height:70px;">
×
×
  • 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.