Jump to content

Avalanche

Members
  • Posts

    73
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Avalanche's Achievements

Member

Member (2/5)

0

Reputation

  1. So in my case it would be like: [php:1:ed34137c45]SELECT * FROM tbl_users, tbl_userinfo WHERE tbl_users.id_key = tbl_userinfo.parent_id_key AND rank!=\'unset\'[/php:1:ed34137c45] Also, would I have to put \"AND tbl_users.rank ...\"? Thanks a bunch!
  2. Okay, I am making a membership system, and there are two tables for the members. One is tbl_users (has username, password, email, and rank), and the other is tbl_userinfo (has 10+ columns of other information). So, I split it up into two different tables so it wouldn\'t get to be a ginormous table. The rank that I mentioned in tbl_users can be admin, user, or unset. \"Unset\" means that the account hasn\'t been verified yet, and it doesn\'t let you log in if your account is \"unset.\" Now, on the page where it lists the users (but doesn\'t have the whole profile) it uses information only from the tbl_userinfo, and doesn\'t draw anything from tbl_users. However, I need it to only select users information from tbl_userinfo where their rank in tbl_users is not \"unset.\" I\'m not sure exactly how I could do this with my current table setup. Would I just have to move the rank over to tbl_userinfo? I you are able to understand what I mean. Thanks. PS: I have an id_key in the tbl_users, and a parent_id_key in the tbl_userinfo that are identical for each account.
  3. Okay, I figured it out. Apparently it didn\'t like that I was asking about a field name \"key,\" so it was stubborn and kept giving me errors. I just changed the field from \"key\" to \"user_key\" and everything works perfectly. All you need is a little bit of experimenting! :wink:
  4. Hello. I\'m having a problem with my script. This is the part that I\'m having the error at: [php:1:7e732ad053] function makeRandomPassword() { /*****************************/ /* */ /* Random Password Script */ /* Made By phpfreak */ /* */ /*****************************/ $salt = \"abchefghjkmnpqrstuvwxyz0123456789\"; srand((double)microtime()*1000000); for ($i=0; $i <= 7; $i++) { $num = rand() % 33; $tmp = substr($salt, $num, 1); $pass = $pass . $tmp; } return $pass; } $RANDOM_key = makeRandomPassword(); $query_registercheckIV = mysql_query(\"SELECT * FROM $tbl_users WHERE key=\'$RANDOM_key\'\"); // set register check query IV $number_matchammtIV = mysql_num_rows($query_registercheckIV) or die(mysql_error());; // count number of matches if($number_matchammtIV > 0) { // check for duplicate keys echo \"Sorry, an internal error has occurred. This is not your fault and it is nothing serious. All that you must do is register again. Sorry for the inconvenience.<p> <a href=\"register.php\">Click here to register again</a><br>\"; require(\"include/footer.php\"); // use footer file exit(); }[/php:1:7e732ad053] And here is the error I get: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/burnttoa/public_html/avalanche/bop/register.php on line 102 You have an error in your SQL syntax near \'key=\'p6jh8t26\'\' at line 1 $tbl_users has been defined, and \"key\" is a valid field in the table defined. Help please? Thanks.
  5. Hmm... what if I had two indentical queries, but with different names? Would that work (I would test it, but I\'m not on my PC that I use for PHP)? Thanks once again, I very much appreciate it.
  6. Okay... well it seems if I display only one of those two at the top, then it will only display the other of the two on the bottom. Basically, once I select it from the database it won\'t let me select it again... is there any way to, uh... unselect it after you\'re done or something? Thanks.
  7. Oh, whoops... I missread the question. He wanted to know how many records have that state... sorry, heheheh... :?
  8. Only two... I still can\'t figure it out. Want my entire page code?
  9. What I would use is: [php:1:c0bb7aeddb]$query = mysql_query(SELECT * FROM table ORDER BY state DESC); while($r=mysql_fetch_array($query)) { // cycle through states $state=$r[\"state\"]; // turn row variable to regular variable $count=$r[\"count\"]; // turn row variable to regular variable echo \"$state $count<br>n\"; // display state and count }[/php:1:c0bb7aeddb] That should loop through each different one displaying the state and count (assuming your column names are state and count... otherwise you need to change the $r[\"columnhere\"]). If it ends up in the reverse direction of what you want then change the DESC to ASC in the query. Good luck.
  10. Hello. Near the top of my code, I have a: [php:1:b3f9f9e1f6]while($r=mysql_fetch_array($query_events)) { // cycle through events // soon to be code here }[/php:1:b3f9f9e1f6] (the $query_events has already been defined) Then, on a lower part of my code I have another: [php:1:b3f9f9e1f6]while($r=mysql_fetch_array($query_events)) { // cycle through events // lots of code here }[/php:1:b3f9f9e1f6] For some reason the first one will work, but not the second one. Any reason why this might be happening? Thanks.
  11. I know, I was going to fix that later... anyway, I just figured out what it was. I had it start echoing it on one of the JavaScript\'s comment lines instead of a command line... I just had to add a n to the echo above it and it all worked out. Whoops. :roll:
  12. Try something like... [php:1:857bb6e23d]switch($_POST[\'company_size\']) { case 1: $where1 = \"Small\"; break; case 2: $where1 = \"Medium\"; break; case 3: $where1 = \"Large\"; break; default: break; } $query = \"SELECT name, County, sector, company_size FROM beacon WHERE itemhere LIKE $where1\";[/php:1:857bb6e23d]
×
×
  • 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.