Jump to content

craygo

Staff Alumni
  • Posts

    1,972
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by craygo

  1. will it be a problem to have both numbers in the array. Reason I am asking is I eventually need to insert these into a table, so I want to have it in a format I can insert. I think this will be tough to do, because eventually I may use this elsewhere and if there is a case where I only have 10 teams but 20 weeks of golf, then the teams will play each other more than once. So the no repeat will have to cancel out itself once all teams have been played. I am not even sure this is posible with php but I am trying like hell to do it. If you want table structure I have right now i will post Ray
  2. bump it up fellas!! :)
  3. ok I got the idea you have there, but I still got a problem. With what you have the randow number is picked but it can also be repeated. So I am coming up with things like this. My players all have unique ids in order so I only have to use the database to get the number of players. I have this code based a little on wisewood's post. [code]<?php // will get this number from database $players = '20'; // add one to the weeks because I want to start at 1 and go the desired weeks $weeks = 10+1; // loop through the desired weeks for($i=1;$i<$weeks;$i++){ $p1 = rand((($players/2)+1), $players);   if($i !== $p1){   echo "$i vs $p1<br>";   } } ?>[/code] Which returns [code]1 vs 14 2 vs 18 3 vs 14 4 vs 14 5 vs 14 6 vs 13 7 vs 11 8 vs 19 9 vs 20 10 vs 13[/code] Obviously player 14 cannot play 4 people in one week I want it to look like this but without all the other stuff. I just need the 1 vs 2 part [a href=\"http://eagolf.theelders.net/2006/schedule.pdf\" target=\"_blank\"]http://eagolf.theelders.net/2006/schedule.pdf[/a] Any thoughts?? Ray
  4. I am trying to create a php application for my golf league. What I need to do is setup matches. Here is a senario: I have 20 players we play for 20 weeks All players are in a MySql database with a unique ID for each What I want to do is have php randomize matches for the players for all 20 weeks but not play the same person if at all possible. Obviously if it were 10 players for 20 weeks then playing someone twice would be fine but not till he has played everyone first. Thanks Ray
  5. Ya i see i tested my code out with just some variables above. This worked for me [code]echo"<OPTION VALUE='".$record['name']." ".$record['date']."'>".$record['name']." ".$record['date']."</OPTION>";[/code] Ray
  6. you need to get rid of the single quotes. should be [code]echo"<OPTION VALUE='".$record["name"]." ".$record["date"]."'>$record['name'] $record['date']</OPTION>";[/code] Ray
  7. OK brother here are a few questions for you. Where will this site be hosted?? hosting company, self, friend ... If already hosted, do they offer MySQL? Also if already hosted(probably a dumb question if you are here) do they have php and what version is it?? Other than that, once you have these things set what you want is totally doable. Ray
  8. craygo

    time()

    Check your system time. The time function returns the current time of the server it is on. I am not farmiliar with apache, but does apache have it's own internal clock??? If you cannot find it you could use this to adjust it [code]<? // get current server time $servtime = time(); // get required offset in seconds $offset = 60*60;  //60*60 = 3600 seconds or 1 hour // put them together $currenttime = $servtime + $offset; // Format it to your liking $formatted_time = date("m/d/Y H:i:s", $currenttime); // Echo it out echo $formatted_time; ?>[/code] Damn!! Apoc beat me to it :) Ray
  9. you are trying to create your array before the page is submitted. You have to submit the page then get the values into an array then run your query. This is how I have always done it. [code]if($action == changebankallow){ echo "<br><br>Select Members:<br>"; echo "<form method='post' action=clan.php?action=allowmembers>"; // Start count for values $i = 1;             $members1 = mysql_query("select * from `players` where `clan_name` = '$clan[name]'order by `display_name` asc");                 while($member = mysql_fetch_array($members1)) { if ($member[clan_bank] == Yes){   $checked="checked"; }else{   $checked=""; } echo "<input type='checkbox' name='mem".$i."' value='$member[id]' $checked> $member[display_name] ($member[clan_bank])<br>"; $i++; } echo "<input type=submit value=Update>"; echo "</form>"; if($action == allowmembers){ $access = ''; $MEMBER = array(); $initials = 'mem'; foreach ($_POST as $key => $value) {   $access .= "$key=$value&";   if (substr($key, 0, 3) == $initials) {     $MEMBER[]= ''.$value.''; } } $result = mysql_query ("UPDATE players SET clan_bank =Yes where id IN ($MEMBER); echo "Updated Successful"; if(!$result) { echo "<B>UPDATE unsuccessful:</b> ", mysql_error(); exit; } }[/code] I have not tested all of your code so let me know if there is a problem Ray
  10. 2 tables would be the best way to do what you need cat_table: cat_id cat_description blah blah blah sub_cat_table sub_id cat_id sub_description blah blah blah Now put all your main catagories in one table and when you enter in the info for the sub catagories you just enter in the cat_id for the main catagory. And when you run quries you just join by cat_id. Ray
  11. You could ask it :) This will loop thru the fields and give info for each. [code]$i=0; $res = mysql_query('select * from testing') or die (mysql_error());; while ($i < mysql_num_fields($res)) {    echo "Information for column $i:<br />\n";    $meta = mysql_fetch_field($res, $i);       echo "<pre> blob:        $meta->blob max_length:  $meta->max_length multiple_key: $meta->multiple_key name:        $meta->name not_null:    $meta->not_null numeric:      $meta->numeric primary_key:  $meta->primary_key table:        $meta->table type:        $meta->type default:      $meta->def unique_key:  $meta->unique_key unsigned:    $meta->unsigned zerofill:    $meta->zerofill </pre>"; $i++; }[/code] Obviously you could just shorten the code for one field but the $meta->blob will return a 0 for no blob and 1 for a blob field. Also $meta->type will return actual field type blob, string, int ect.. Ray
  12. I know exactly what you are saying. You will have 2 accounts in the table. if you scroll through the fields you will see one for user level. I believe 1 is a regular user and 2 is an admin. Just look for the account with the 2 in it.
  13. OK if you are using php nuke you have to do a few things. 1. go to a site that will convert your password to the md5 hash. go here [a href=\"http://b-con.us/pages/md5_nojs.php\" target=\"_blank\"]http://b-con.us/pages/md5_nojs.php[/a] type in the password you want then copy the hash the is returned when you click convert. 2. go to your mysql database and find the table nuke_users. 3. Find the row with your username or do a search for your username. 4. Edit the row, then go to the password field and paste in the password hash you just got. Please be careful in the tables cause you don't want to change too many things. Ray
  14. Well there are alot of php forums. I have worked with alot of them but will need to know which one you have. You should be able to go into the table and assign yourself a new password, but I need to know which one you use. Ray
  15. I do not think you will be able to do that. PHP is a server side script. So that means the script has to run in it's entirety on the server before if even outputs anything on the screen for you. I could be wrong but that is my understanding of how php works. Maybe some of the other Masters can give you a little more info. Ray
  16. if you are not connecting to default socket then you can manually enter it in your connection string with the host name. [code]$host = "127.0.0.1:3307"; $user = "someuser"; $password = "somepassword"; $dbname = "somedatabase"; $mysql_conn = mysql_connect($host, $user, $password); mysql_select_db($dbname, $mysql_conn) or die(mysql_error());[/code] Ray
  17. Depends on what you are retrieving. Most of the time text, number don't need and kind of formating or cleaning. but long text fields with say html or line breaks or thing like that would need to be so called "cleaned" to display properly. It all depends on the type of data you are storing. Ray
  18. What program are you using for forum? And you said you have access to the mysql database?
  19. You don't need to do anything if you already know where you start when you log in. If you start in public_html and you want to go to folder "images" which is in public_html you would just use images/filename.jpg if you notice there is no forward slash "/" in front of my directory name. By leaving out the forward slash it will change directory relative to the current location or directory. Ray
  20. Not that I do not want to help you out but why would you want to do this?? You could use php to randomize the output of the data rather than have another table. Ray
  21. If you are going to use that then enclose the field or table name in back ticks `PrimaryKeyField#` Ray
  22. I see you point well in order to do it corectly do this here I do not know what your sql looks like so I will wing it here. This is also done outside of the php tags [code] <input type=checkbox name="ud_islive" value"1" <? if($row['isalive'] == '1'){ print 'checked'; }>[/code] And obviousely you will have it grabbing the value on the next page. on updated.php you should have an if then there. [code]if(isset($_POST['ud_isalive'])){ $isalive = 1; } else { $isalive = 0; }[/code] Than use $isalive in your update query Ray
  23. Well first thing i notice is that you are using $_GET['type'] in 2 different places but giving the same info. Unless your table name is the same as your field name you are going to get an error. Cause acording to your parameters your sql is going to look like this. [code]DELETE FROM TableName WHERE TableName# = '1' LIMIT 1[/code] Might have to modify your code to pass the tablename, primarykeyfield and id. Not just tablename and id. Or since you know the table name and field name just get the id [code] DELETE FROM TableName WHERE PrimaryKeyField# = '".$_GET['id']."'";[/code] Only way you need to do all the other stuff is if your list is coming from several tables, which it looks like it isn't Ray
  24. I looked at the page and it seems fine. The problem looks like the caching of the page. When I go back and forth and keep checking published and unchecking it. When I return to the page, i get it as it was the first time i went to it. If i just click refresh it shows me the changes. So it looks like it is a caching problem and not a script problem. Ray
  25. Do you mean the text comes up exactly as you typed it? If that is the case you have a problem with your installation of php. Or it could be you did not name the file *.php. Unless you have modified your default web server installation you need to name the files *.php in order for php to parse the script. Ray
×
×
  • 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.