Jump to content

freshrod

Members
  • Posts

    25
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

freshrod's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I posted this before in nOOb, but really didn't get it figured out. It's really puzzling me. Basically I have a value in a DB field that I want to check. The column is set up like this: 'alumInfo enum ('0','1') NOT NULL default='0', I query it like this: $sql = mysql_query ("SELECT alumInfo FROM users WHERE username='$username' AND password='$password'"); Then I want to check what the value is. If it's 0 I want to print one thing, if it's 1 I want to print something else. I've tried something like this: $row = mysql_fetch_array($sql); // I'm thinking the problem lies here... if($row['alumInfo'] == '0') { echo "one thing"; } else { echo "something else"; } It seems to ignore the first 'echo' and only prints the last one, even though the default value is '0'. Any suggestions? Thanks. I know there is data in the field from looking with my MySQL Command Line, but: echo '<p>alumInfo is: ',$row['alumInfo'],'<p>'; gave me no result. So possible I'm doing the query wrong? Or is it the mysql_fetch_array? Thanks.
  2. Maybe I'm asking the wrong question. Is there a better way to run a query, check the data, and run an if/else of it? Maybe my problem lies in my approach? Or the way I'm writing the query?
  3. Thanx Ober. When I run (SELECT * FROM users;) it shows a 0 in the field. I really don't know what the deal is. I've used similar querys and such before... never had this much trouble.
  4. Thanx for the help thorpe, but it still isn't showing the echo? I pasted the code in that you put. I really don't understand what the problem is.
  5. I posted about this before and got an answer, but while it did stop the error, it still isn't working how I wanted. Basically I have a value in a DB field that I want to check. The column is set up like this: 'alumInfo enum ('0','1') NOT NULL default='0', I query it like this: $sql = mysql_query ("SELECT alumInfo FROM users WHERE username='$username' AND password='$password'"); Then I want to check what the value is. If it's 0 I want to print one thing, if it's 1 I want to print something else. I've tried something like this: $row = mysql_fetch_array($sql); // I'm thinking the problem lies here... if($row['alumInfo'] == '0') { echo "one thing"; } else { echo "something else"; } It seems to ignore the first 'echo' and only prints the last one, even though the default value is '0'. Any suggestions? Thanks.
  6. argh! so close... Thanx again Violent.
  7. I don't know why I can't figure this out... but I haven't yet. Basically I have a value in a DB field that I want to check. The column is set up like this: 'alumInfo enum ('0','1') NOT NULL default='0', I query it like this: $sql = mysql_query ("SELECT alumInfo FROM users WHERE username='$username' AND password='$password'"); what I want to do next is where the problem lies (at least I think it is). I want to check what the value is. If it's 0 I want to print one thing, if it's 1 I want to print something else. I've tried something like this: $row = mysql_fetch_array($sql); if({$row['alumInfo']} == 1) { // I've tried writting this several ways... apparently all wrong echo "one thing"; } else { echo "something else"; } but that's getting me nothing but errors. Help?
  8. I have a multipage form from which people are selecting different things (which are then sent via POST then stored as a SESSION) from each page. I would like to add in between each a script that will let them confirm that they chose what they wanted, before they go on to the next choice. If not, then they can go back. What I'm not sure about is what to do with the SESSION? Do I need to destroy it? Or will it get overwritten? Here is the basic code I have now: <?php session_start(); $_SESSION['align'] = $_POST['align']; if ( isset ( $_SESSION['align'] )) { print "<p>You have selected " . $_SESSION['align'] ." for your Characters Alignment.</p>"; } else { print print '<p>Please go back and select an Alignment for your Character!</p>'; exit; } ?> <table> <tr> <td>If you are sure sure about your Alignment choice, continue to the next page. Otherwise select the 'Back' button. </td> </tr> <tr> <td><form><input type="button" name="align_back" value="BACK" onClick="history.go(-1);return true;"></form> </td> <td><form method="post" action="char_breed.php"><input type="submit" name="align_confirm" value="NEXT"></form> </td> </tr> </table> Thanks for any help or suggestions.
  9. Thanks Barand, It was A by the way. You wouldn't happen to know any good resources where I could find answers to those sorts of questions as they would relate to game creation, would you? Or I guess I can just keep posting here. Don't get me wrong, I love this site!!! I just didn't know if everyone wanted to hear about my troubles making a game, or if there was a place specifically for that kind of thing.
  10. Wow. Thanks for the in depth post, Crayon Violent. I think you thought more about it than I did. lol. I guess to be more specific, I was thinking that a lot of the posts had to do with MMO-RPG type games. Kind of like the ones you mentioned. This seems to be a really popular field (maybe toooooo popular) right now, and it actually seems to include many different aspects of making dynamic websites. The fact that they are so popular is what really seemed strange that I don't seem to find any forums or sites dedicated (or even with just a section dedicated) to it. I just thought that if there was a forum or something specific to that, it would be a great way to collect many different question, and more importantly, similar answers (or even tutorials) in one place. While I agree that all games are different (well... hmmmm) many of the things about them can be recycled, such as similar codes, functions, queries, and DB structure. Just a thought. p.s. I like your picture. p.s.s. Yeah, there was one thing I'm thinking about now with my own game, but it really isn't a PHP question. It has to do with how to set-up the DB. Not the SQL or anything, but like the best way to arrange it, if that makes sense? For instance, there are users (with their own stored unique info), and the users have characters (with different unique stored info), so should these be 2 separate tables in the DB, or just one big old long one? What would that do to the DB drag.... blah, blah, blah. Questions like that.
  11. If you could post exactly what those lines in the MySQL table say, or the PHP code where the query is, I might be able to help you better.
  12. Greetings. Yeah, I'm one of those guys how is trying to use PHP to create some crazy game. Actually I am really trying to learn PHP, but just copying examples out of books wasn't really forcing me to learn PHP. I was just learning how to copy text well. So I notice that, while there seem to be several threads and questions relating to game creation, there doesn't seem to be any one section dedicated to this topic. I haven't found one any where else either. I was wondering if anyone knew of one (or if I was just missing it here somewhere), or wondering if perhaps we could start one? Thanks for any help.
  13. [!--quoteo(post=368880:date=Apr 26 2006, 10:53 AM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Apr 26 2006, 10:53 AM) [snapback]368880[/snapback][/div][div class=\'quotemain\'][!--quotec--] Are yoy running that code on a local setup of Apache/PHP? If you are then you will need to configure PHP to use an SMTP server in order for emails to be sent! You can configure the SMTP server in php.ini file. If you are running it off your webhost then it should work or your webhsots has disabled the use of using th mail function. [/quote] Duh-Oh! They don't call me nOOb for nothing. Thank you wildteen88!
  14. I'm relieved to see you guys are having problems with mail as well. In every tutorial, book, article, whatever I read, they make it sound like sending mail with the 'mail()' function is the easiest thing in the world. But I've tried and tried, and even simple code like this: <?php // Your email address $email = "freshrod@freshrod.com"; // The subject $subject = "testing"; // The message $message = "I hope this works!"; mail($email, $subject, $message, "From: $email"); echo "The email has been sent."; ?> just doesn't seem to work.
  15. AH-HA!!! I got it to work (of course getting it to work doesn't always mean I did it RIGHT, hahaha). All I did was switch out where I had: value="{$data[jobName]}" for value="{$row[jobName]}" and it seems to be working. Thanks for the help.
×
×
  • 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.