Jump to content

kenshintomoe225

Members
  • Posts

    36
  • Joined

  • Last visited

Everything posted by kenshintomoe225

  1. hmm... Well..there is a pointer associated with mysql_fetch_assoc. Each time you call it, the pointer moves up to the next row. In your code, you call it once to populate $rsSilkrobestyle, and then again each time your while loop runs. Does that query return one row? If it does, thats probably the reason for your error. For example, your code could look like this $silkrobestyle = "SELECT * FROM styles WHERE categoryID=13 ORDER BY styleID"; $silkrobestyle_query = mysql_query($silkrobestyle) or die(mysql_error()); The dropdown menu code is: <select name="style" class="dropdownboxstyles" id="style"> <?php while ($rsSilkrobestyle = mysql_fetch_assoc($silkrobestyle_query)) { ?> <option value="<?php echo $rsSilkrobestyle['styleID']; ?>"><?php echo $rsSilkrobestyle['style']; ?></option> <?php } ?> <?php mysql_data_seek($silkrobestyle_query, 0); ?> </select>
  2. not quite sure what you're asking here with your second post. After a player logs in, pull the team id out? SELECT player_name, team_id FROM players_table WHERE player_id='some_variable_you_set_via_form' is that what you're looking for?
  3. I would go with get_browser(), you might as well!
  4. Can you post the form as well please? This only shows how $_SESSION is being set, not $_GET
  5. Plan for expansion. Try to keep future changes to the structure of the database as cheap as possible by thinking of as many possible fields and tables early on, even if those tables end up empty or only have a few items in them. It's much more expensive to later go in and add columns and tables, and then relate them, after tons of data is already in place. Databases for a website will usually have some sort of 'user' table that is used as some sort of ACL, controlling what a certain user has access to. After that, it depends on what you want you site to do. I would designate one server as your database server, one as your web and application server, and have the web/app server connect to the database server. There are a number of things you can do. Namely, the way you write code is going to have an effect here, also the design of the database can play a part, and even the queries you write for that database. You might want to study relational databases in depth a little if efficiency is a big thing for you, as its a topic that would quickly fill one of these threads!! hope this helps!!
  6. I'm the "rather do it myself" type of person, so I don't mind the model implementations being done the way they are in CI. The only thing I need my framework to do at this point in time is implement MVC and give my applications a bit of structure that they otherwise might not have. The libraries and helpers that do come with CI are decently helpful as well!
  7. I would recommend checking out some generalized OOP books that look at the topic in depth. If a language is calling itself OO, the techniques and features you learn about in one of these books will apply. It's definitely worth looking into as you can then apply what you learn to tons of other languages and platforms. Here are some suggestions: http://www.amazon.com/Object-oriented-Programming-Brad-Cox/dp/0201103931 http://www.desy.de/gna/html/cc/Tutorial/tutorial.html and a google search for Object Oriented Programming will get you tons of results.
  8. I"m happy you're content with Zend I'd really like to start using it, but I'm still relatively new to PHP as well as frameworks. While I won't argue who is more feature rich, as Zend clearly wins that battle, it's like using a ballistic missile when you only need a fly swatter. The documentation on Zend is pretty good, I still had trouble getting it setup. I found CI"s doc's more helpful in that regard.
  9. That sounds like a great idea!
  10. he changed the if statement to $num = mysql_numrows($result); if($num != 0){ Makes a lot of sense actually If it returns 0 rows, then it fount nothing in the database.
  11. One potential problem I see right off the bat is your submit button and your text field have the same name. Please name them different things and try again.
  12. you know what total brain fart Forgot about submit buttons having values
  13. Could you please provide an explanation of what you changed? Copy and pasting code rarely helps someone learn
  14. i'm not quite sure I understand the question. Could you please rephrase?
  15. sure thing! And just as a quick tip, for something like keeping track of a logged in user, you want to set those session variables only once, like right after they login. Don't keep clobbering them with data, or else you run a very high risk of corrupting the values inside and breaking your page. if( $login == TRUE;) { $_SESSION['user'] = $username; $_SESSION['pass'] = $password; $login = FALSE; //don't touch any of these anymore. Its just an example, I'l leave it to your good sense to put it to work }
  16. Nah thats not the problem. <?php if(true) {?> <html> some html code here </html> <?php } ?> this is perfectly valid Also, can you paste the output of that SQL query for me?
  17. when you set the cookie, the script isn't going to pick it up until the page is refreshed, thats the nature of cookies. you could use the redirect function to refresh the page when the cookie is set, and then don't refresh anymore. http://us.php.net/header See if that helps, then we can proceed.
  18. ok, thats a start. Now what I want you to do is copy and paste your sql query into the sql command line and run it, that way we can see what the query actually returns when run.
  19. It looks like you're still setting your session variables every time you load that page, to whatever the value of $username and $password are. Also, I would change the names of the variables to make it easier to read and follow.
  20. did you move your while loop when you moved the forms? You said you moved the form from the if body to the else body, did you move that while loop along with it?
  21. When you load your logout page, make a call to session_destroy(); That'll end the session completely. Also, its usually not good practice to make use of deprecated functions as they aren't supported, and can potentially cause problems with newly added functions, or other parts of your application.
  22. Something I would recommend is making your own personal list of queries that will be run lots of times. Create some constant strings that contain those queries. Then, create a function for each query and pass mysql_query() that constant string. Or, for something more complicated where you might need to use the results from one query in another, the function will help group that code together. The constants are a good idea because it'll make your code easier to maintain if you use a given query in several places.
  23. Thanks for catching that honest mistake on my part, just got done dealing with some java
  24. !isset($row['user']) will evaluate to true, and execute the body code whenever $row['user'] is NOT set. If it is not set, and you then try to echo it out, you're gonna run into problems.
  25. submit buttons do just that, submit the form. A submit button will always just do whatever the action is set for the form. I would ust <input type=button...> and then set an onclick attribute to a custom javascript function that submits the name of button that was clicked. Of course, there are more solutions possible!
×
×
  • 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.