Jump to content

Avalanche

Members
  • Posts

    73
  • Joined

  • Last visited

    Never

Everything posted by Avalanche

  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]
  13. You would have to run a query and get the ref number, then run another which is like SELECT * FROM tablehere WHERE number=$refnum, then store the gathered name in a variable.
  14. [php:1:3d07c06ba5]<?php $query_events = mysql_query(\"SELECT * FROM bob_events ORDER BY ID DESC\"); ?>[/php:1:3d07c06ba5] [php:1:3d07c06ba5]<?php while($r=mysql_fetch_array($query_events)) { // cycle through events $event=$r[\"event\"]; // turn row variable to regular variable $event = addslashes($event); echo \"scrollercontent[0]=\'<b>-</b> $event\'n\"; // add on to scrollies } ?>[/php:1:3d07c06ba5] I have two events in the table, but it will only echo the last one. The two ones are: \"Cool Website Scripts\" and \"New addition to the Wile\'s family.\" Any idea why this is not working? Thanks.
  15. I think you could do that with a for each thing, but I don\'t use for each myself. Anyway, I believe what you had at first would work if you got rid of the apostrophes in your POST variables. So, instead of $_POST[\'name\'] use $_POST[name]. See if that works.
  16. Nevermind, figured it out.
  17. Yeah, I just now figured out you don\'t put the apostrophes around the field names, just the values. Anyway, thanks. (PS: When I tried inserting a time() into my database it came out like 839:49:49 when it\'s 4:43... the field type is time; should it be timestamp?)
  18. It still won\'t work. I also tried removing the if argument, and optimizing the table in phpMyAdmin (becaue apparently it needed optimization).
  19. [php:1:20ca43efce]// Record in change logs if roster_trackchanges is 1 if ($roster_trackchanges == 1) { $query_changes = \"INSERT INTO roster_changes(er, ee, type, date, time) VALUES(\'user\',\'\".$_SESSION[mem_alias].\"\',\'edited\',date(), time())\"; mysql_query($query_changes); }[/php:1:20ca43efce] I added a \"else { echo \"hey hey\"; }\" but the \"hey hey\" didn\'t come up, so $roster_trackchanges IS 1, it just doesn\'t insert.
  20. Yes, you will need to create a table with at least two fields. I would make one named \"username\" and one named \"password\". Try setting both to a varchar of 50. Also, you may want to encrypt the password before you insert it into your table.
  21. I do not believe you can upload an image to a MySQL database, however you can upload it to your website and then record the image\'s URL in the database.
  22. Okay, thanks. I also had to get rid the the \' \' around the field name (just not the new data). That\'ll teach me to use a PHPMyAdmin query...
×
×
  • 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.