Jump to content

ryeman98

Members
  • Posts

    286
  • Joined

  • Last visited

    Never

Everything posted by ryeman98

  1. So I have this code that if one of the entries columns says 'yes' then the checkbox should be checked and if the column says 'no' then the checkbox should be unchecked. My code isn't working. Help please? $acara = mysql_query("SELECT * FROM CustomisationClothes WHERE acara='acara'"); $aisha = mysql_query("SELECT * FROM CustomisationClothes WHERE aisha='aisha'"); $blumaroo = mysql_query("SELECT * FROM CustomisationClothes WHERE blumaroo='blumaroo'"); if ($acara == "yes") { echo "<td align='center'>Acara<br /><input type='checkbox' name='acara' value='".$acara."' checked='checked' /></td>"; } else { echo "<td align='center'>Acara<br /><input type='checkbox' name='acara' value='".$acara."' /></td>"; } if ($aisha == "yes") { echo "<td align='center'>Aisha<br /><input type='checkbox' name='aisha' value='".$aisha."' checked='checked' /></td>"; } else { echo "<td align='center'>Aisha<br /><input type='checkbox' name='aisha' value='".$aisha."' /></td>"; }
  2. lol true. I feel like such a tool though
  3. Ok, so the link is supposed to go to editCloth.php?edit=name name is going to be the pet's name that will be pulled out of the database... but that's beside the point. The code I have here is editClothes.php and instead of the link sending the admin to editCloth.php, it stays at editClothes.php Any ideas? <?php $pagetitle = "xxxxxxxxxxx"; include($_ENV['SITE_HTMLROOT']."/header.php"); require($_ENV['SITE_HTMLROOT']."/includes/dbconnect_class.php"); $db = new DB; $sPHPSELF = $_SERVER['PHP_SELF']; ?> <h1>Edit Clothing</h1> <?php // Display the list $query = mysql_query("SELECT * FROM CustomisationClothes ORDER BY name") or die(mysql_error()); while($result = mysql_fetch_array($query)) { echo "<a href\"/editCloth.php?edit=".$result['name']."\">".$result['name']."</a><br />"; } // End while ?> <?php include($_ENV['SITE_HTMLROOT']."/footer.php"); ?>
  4. Well it is displaying everything except for the links. Again... that didn't work. :-\
  5. I know they don't have anything to do with it. The link that I'm working on is going to submit to the isset. I have a while loop now but still... no dice...
  6. That doesn't really make a difference. It still doesn't work... :-\
  7. Neither way is working. I'm going to post the entire code. But, there is no errors at all. <?php $pagetitle = "........."; include($_ENV['SITE_HTMLROOT']."/header.php"); require($_ENV['SITE_HTMLROOT']."/include/dbconnect_class.php"); $db = new DB; $sPHPSELF = $_SERVER['PHP_SELF']; ?> <h1>Edit Clothing</h1> <?php if ($_GET['edit'] == $name) { $name = $_POST['name']; $edit = mysql_query("SELECT * FROM CustomisationClothes WHERE name='$name'"); while($row = mysql_fetch_array($edit)) { echo "<img src=\"".$row['img_url']."\" alt=\"".$row['name']."\" /> <form name=\"editClothes\" action=\"editClothing.php\" method=\"post\"> <b>Name:</b> <input type=\"text\" name=\"name\" value=\"".$row['name']."\" /><br /> <b>IMG URL:</b> <input type=\"text\" name=\"img_url\" value=\"".$row['img_url']."\" /><br />"; $acara = mysql_query("SELECT * FROM CustomisationClothes WHERE acara"); $aisha = mysql_query("SELECT * FROM CustomisationClothes WHERE aisha"); if ($acara == "yes") { echo "<input type='checkbox' name='acara' value='".$acara."' checked='checked' />"; } else { echo "<input type='checkbox' name='acara' value='".$acara."' />"; } if ($aisha == "yes") { echo "<input type='checkbox' name='aisha' value='".$aisha."' checked='checked' />"; } else { echo "<input type='checkbox' name='aisha' value='".$aisha."' />"; } ?> <input type="submit" name="submit" value="Edit Clothing" /> </form> <?php } // End while } else { // Display the list $query = mysql_query("SELECT * FROM CustomisationClothes ORDER BY name") or die(mysql_error()); $result = mysql_fetch_assoc($query) or die(mysql_error()); echo "<a href\"".$sPHPSELF."?edit=".$result['name']."\">".$result['name']."</a>"; } // End else ?> <?php include($_ENV['SITE_HTMLROOT']."/footer.php"); ?>
  8. I don't get any errors or anything so I just don't get why it won't work. I'm connected to the database and the table that I have is there. It's supposed to display each Clothing item by a link... <?php // Display the list $query = mysql_query("SELECT * FROM CustomisationClothes ORDER BY name"); $result = mysql_fetch_array($query); echo "<a href\""; echo $sPHPSELF; echo "?edit="; echo $result['name']; echo "\">"; echo $result['name']; echo "</a>"; ?>
  9. Ok. I think I know now. Only thing... do the P_id's have to be the same?
  10. I'm pretty sure I know what you mean, I just don't know how you'd enter these into the db...
  11. The pets table has all of the pets and the clothes table has all of the clothes. If the pet name in clothes is yes for the certain peice of clothing, then it should display on that pet's page (GET Method) and if it says no, as in it isn't a wearable peice of clothing, it shouldn't display. In a few months there will be hundreds of clothing items. That's why I created two tables...
  12. Well there are two tables: Pets: id name img_url and Clothing: id name img_url petname petname ... Is that wrong or can I still do something with it? Everything works find except for that one single query...
  13. Still isn't working... I'm not quite sure what you mean but it's like id name img_url petname petname ... There are 54 different pet names... they are ENUM 'yes', 'no' The ones that are yes mean that the peice of clothing is wearable, if it isn't, I don't want it to display.
  14. So I'm grabbing a pet from one table and I have all the clothing on another table. Each pet has a column in the Clothing table. How can I grab the specific pets clothing from the second table? I hope that makes sense. My code: $petquery = mysql_query("SELECT * FROM CustomisationPets WHERE name='$name'"); $petresult = mysql_fetch_array($petquery); echo "<img src=\"".$petresult['img_url']."\" alt=\"".$petresult['name']."\" /><br />"; echo "<b>".$petresult['name']."</b><br />"; echo "Below you can see all the clothes the ".$petresult['name']." can wear."; $clothesquery = mysql_query("SELECT * FROM CustomisationClothes ORDER BY name WHERE $name='yes'");
  15. Wow am I tired or what! xD Thanks.
  16. Maybe I should've posted the rest of the code. I kinda figured people would look at that other page for the full code though } // End if } // End while } // End if results [code] [/code]
  17. Hi there! I've been using the multiple column script here: http://www.phpfreaks.com/forums/index.php/topic,95426.0.html And I've gotten this error right now: Parse error: syntax error, unexpected T_ECHO in /home/4617/domains/somesite.com/html/customisation/ryetest.php on line 36 And this is the code: 35. if (++$i == $max_columns { 36. echo "</tr>"; 37. $i=0; Help? Thanks!
  18. I still get the same error :-\ I checked the table name and it's right so I just don't get it...
×
×
  • 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.