Jump to content

YoungNate_Black_coder

Members
  • Posts

    47
  • Joined

  • Last visited

    Never

Everything posted by YoungNate_Black_coder

  1. all of the above becuase i was just getting an error before with the die but i removed it and it works fine now , i figured it out own my own with some debugging but is this a good way of going about this because im feeling like my hosting sucks because its takes forever for theese scripts to get executed.....
  2. i want to kno if im going about this corectly i want to update a some database values and delete some values apon a certain time and this cod sits on a cron job runiing every5 mins tell me if ive done anything wrong? <? // grab all clutches and check if they are due yet $con = mysql_connect('localhost','xxxuser','xxxpass'); mysql_select_db('ab6691_snakesbay_game',$con); $all = "SELECT * FROM cluth"; $clu = mysql_query($all)or die(mysql_error()); $all = mysql_fetch_assoc($clu)or die(mysql_error()); // check if they hatched yet while($all = mysql_fetch_assoc($clu)){ $now = strtotime(date("Y-m-d h:i:s")); $due = strtotime($all['due_date']); $id = $all['id']; echo "clutch id : $id"; if($now >= $due){ $all_s = "SELECT * FROM snakes WHERE `clutch_id` = '$id' "; $al_s = mysql_query($all_s); while($snake = mysql_fetch_assoc($al_s)){ // change for everyone! $sid = $snake['snake_id']; $sql = "UPDATE `ab6691_snakesbay_game`.`snakes` SET `staus` = 'nu' WHERE `snakes`.`snake_id` = '$sid'"; mysql_query($sql)or die(mysql_error()); echo "Snakes Have been Updated...<br>"; } $sql = "DELETE FROM `ab6691_snakesbay_game`.`cluth` WHERE `clutch_id` = '$id' "; mysql_query($sql)or die(mysql_error()); }else{ echo "the clutch woth the id <u>$id</u> Does not need to be updated "; } // delete that clutch $del = "DELETE FROM `ab6691_snakesbay_game`.`cluth` WHERE `cluth`.`id` = $id"; mysql_query($del)or die(mysql_error()); } echo "</table>"; ?>
  3. bu im calling for all rows like : select all from table where sex = 'female' and (if she is not pregnant)???? thiss will return all female snakes that isnt pregnant....
  4. okay so i changed my database structure to timestamp and when the snake gets pregnant i store now(), now in the same insert query how do i add 20 mins to that and check if that 20 mins has been passed on another page?
  5. i wanna query a database table for all rows by this id except this id ???
  6. and what should the timestamp structure be in mysql ?? because right now it is varcher jut because i wanted to be able to say ex. jan, 9 , 2011.... and whats the format for inputing the time now into the database?
  7. okay so i wanna how would i go about doing this? i want when my pregnant function takes place on my website i want to store a value in the database and when a ceritan time has been met i update the datbase to change a value in the database : like when the form is submitted chang a value to pregnant then store it in a database then when 20 mins pass change that to not pregnant ????
  8. okay, so im still working on this game and i was wonder is there anyother good rand functions out there?? like ay i have an array: array(dcvfvfvr,evrvgtfv,fvfvrfv,vfvfgvr,,fvergtvv) and i wanted to randomly select one of those values inside a foreach loop maybe untill it hits a certain number?
  9. let me give a better mark up after query and query after user post the form this is what im left with ex. albino/pastel/spider/ ex. pied/pastel/ ex. dram/bee those are three different random examples so say that first one is a male and that second is a female they are passed into the function like so $male = ....... $female = ...... i want to explode by the / ex. $traits = explode('/',$male); giving me an array .... now that i have this array with just the genetic background in it (ex. pied albino pastel) any pointers on a breed function from there with an array like that?
  10. what i mean is i like your code it works but thats not my format .... im asking is there a way to explode the array into varibles with keys then shuffle them to determine 1 snakes traits and then continue that procces over the random number givens for potential offspring?
  11. thanks for the help buddie your code was most helpful but i think i could have been a little clearer..... the main trait of the snake would be its base morph ex. albino (witch is aN rec Trait) and every thing its het for sits on a another row like such pastel /spaider/...../.... so that when i query and pass the info through a an option of an select menu the value togther would look like this: <option value=\"$base/$het\">$.....</option> so when the useer decides to breed the post data will look like this... ( base/het ) ex. or equily albino/pastel/spider then i explode by the forward slash (/)albino (/)pastel (/)spider now i have them in an array how do i get them alone like a loop? $trait[] = albino $trait[] = pastel $trait[] = spider $trait[] = ..... $trait[] = ..... then count ?????? im stuck but u did answer a very big question and for that i thank you sincerly!!!! i was wonder did i have to right out all the possible difernt combonations amongset the three traits or was there a faster way and u just showed me that that is the only way ..... lol! how would i go about seperating that array after the explosin?????
  12. okay so im making a ball python breeding game and im currently working on it right now and now im at the most important part fo the game the breed function!!!! now i l explain how it should work beacuse i dnt have any code yet for the function, but the rest of the site is done okay in a ball python breeding action in real life would go something like this : male + female = child now the male and female snake will have traits that will determine what the child is example there are three different king of traits for ball pythons co-dom , dom , and Rec codom - half domanant traits dom - compleatly dominant traits and rec - where both snakes are required to carrie the trait in order to produce it .... now i have some test snakes in my database like this id - morph(base morph) - het (enum yes or no) - and gen (.... whatever the snake traits are) so what i did was start by placing the traits with slashes that i will explode with ex. spider/pastel/enhi now i will use the base morph name ex. cinnimon ball. now here is where i need help after explod() i have any array i wanna run the if stament if they carry the same traits but it will be dynamic so i wont no where to implode ?? and i wanna kno is there a way to place dynamic varrable into an array say after they have bred i wanna give a random number of eggs then randomize what will hatch out them eggs any help would be greratly appreciated and admin if this is considred to be spam i apologize i love this forum and i dnt mean to spam if(this is considered to be spam){ echo "Sorry PHPFREAKS.COM"; }ELSE{ echo "THANKS FOR THE HELP"; }
  13. function get_inc(){ $clutches = "SELECT * FROM cluth WHERE uid = '$id'"; $clu = mysql_query($clutches)or die(mysql_error()); $result = mysql_fetch_array($clu,MYSQL_ASSOC); $i = 1; echo "<tr><td>Number.</td><td>clutch Size.</td><td>Worth</td></tr>"; while($result = mysql_fetch_array($clu,MYSQL_ASSOC)){ $cid = $result['id']; $sire = $result['sire']; $dame = $result['dame']; $datel = $result['date_layed']; $size = $result['size']; $price = $result['price']; echo "<tr><td>$i.</td><td> <a href=\"?room&height=350&width=520&modal=true\" class=\"thickbox\" title=\"$sire+$dame\"> ($size) Egg Clutch</a> </td><td>$price</td></tr>"; $i++; } }
  14. i havent wrote it up yet its just an if statement as followed: if(!isset($_SESSION['country'])){ header('location :post.php?'); }else{ ........
  15. okay, i am making a classifed ad site and im at my post an ad part of the site and what i wanna do is store the data selected into session varibles in the event they need to be called again and again they will be set this is where my problem is please help... <? session_start(); // when this gets rendered i dnt get redirected and those session varbles do not get set.... if(isset($_REQUEST['country'])&&($_REQUEST['state'])&&($_REQUEST['city'])&&($_REQUEST['cat'])){ $_SESSION['post_key'] = rand(100000,999999); $_SESSION['country'] = $_REQUEST['country']; $_SESSION['state'] = $_REQUEST['state']; $_SESSION['city'] = $_REQUEST['city']; $_SESSION['cat'] = $_REQUEST['cat']; header('location : compose.php?'.$_SESSION['post_key'].''); } ?> .... i have a html form below thats sending data in the get format but all the data is dynamic from a php script and ajax <form action="?" method="get"> <div id="panel1"> <h2>Location</h2> <fieldset> <table align="center"> <tr><td><label> Country</label></td> <td><select id="selection" name="country"> <option disabled>Select Country.....</option> <option value="1">USA</option> </select> </td></tr> <tr><td><label> State</label></td> <td><select id="state" name="state"> </select></td></tr> <tr><td> <label> City</label></td> <td><select id="city" name="city"> </select></td></tr> <tr><td> <label>Category</label></td> <td><select id="cat" name="cat"> </select></td><td></td></tr> </table> </fieldset> </div> <div id="compose"> <button type="submit" class="expand">Continue<img src="../images/arrow-down.gif"></button> </div> </form>
  16. the extra php tags wer putthere cause i thought that would help with the highlighting of code on this page im not that dump! and those are functions that are being called here on this page like function all_states{ echo " inside a while loop.... <ahref = ""...............> "; }
  17. i cant understand why this isnt working .... i have some functions worte up on anoter page but i cant get them to show up.. <? <? switch($_GET){ case (isset($_GET['state'])&&($_GET['city'])&&($_GET['cat'])&&($_GET['aid'])): ad($id); break; case (isset($_GET['state'])&&($_GET['city'])&&($_GET['cat'])): ads($state,$city,$cats); break; case (isset($_GET['state'])&&($_GET['city'])): all_cats($state,$city); break; case (isset($_GET['state'])): all_city($sid); break; default: ?> <form action=""> <select> <? all_states; ?> </select> <button class="b_l_r" type="submit">Find Citties...</button> </form> <? break;}?> ?>
  18. <? // find witch page user is trying to acces // if they are looking for cities i want to do the same thing for my citities(children category but im doin this on a page but i want it to show on my indexpage/// if(isset($_REQUEST['sid'])){ $sid = $_REQUEST['sid']; $i = 1; $tbl_st = "<table class=\"states_table\">"; mysql_connect("*****", "*****", "*********") or die(mysql_error()); mysql_select_db("young17_nateads")or die (mysql_error()); $cats = "SELECT * FROM `citys` WHERE sid = '$sid' ORDER BY `citys`.`name` ASC "; $sql = mysql_query($cats)or die(mysql_error()); $row = mysql_fetch_assoc($sql)or die(mysql_error()); do{ if($i % 6 == 0){ $name = $row['name']; $id = $row['id']; $rand = rand(100000000,999999999); $tbl_st .= "<tr class=\"states_tr1\"><td><a href=\"?explosion=find%sid=".$id."&name=".$rand."\">".$name."</a></td>"; }else{ $name = $row['name']; $id = $row['id']; $rand = rand(100000000,999999999); $tbl_st .= "<td><a href=\"?explosion=find%sid=".$id."&name=".$rand."\">".$name."</a></td>"; } $i++; }while ($row = mysql_fetch_assoc($sql)); $tbl_st .= "</table>"; } echo $tbl_st; }else{ // if they have not selected a state $i = 1; $tbl_st = "<table class=\"states_table\">"; mysql_connect("*****", "*****", "*********") or die(mysql_error()); mysql_select_db("young17_nateads")or die (mysql_error()); $cats = "SELECT * FROM `states` ORDER BY `states`.`name` ASC "; $sql = mysql_query($cats)or die(mysql_error()); $row = mysql_fetch_assoc($sql)or die(mysql_error()); do{ if($i % 6 == 0){ $name = $row['name']; $id = $row['id']; $rand = rand(100000000,999999999); $tbl_st .= "<tr class=\"states_tr1\"><td><a href=\"?explosion=find%sid=".$id."&name=".$rand."\">".$name."</a></td>"; }else{ $name = $row['name']; $id = $row['id']; $rand = rand(100000000,999999999); $tbl_st .= "<td><a href=\"?explosion=find%sid=".$id."&name=".$rand."\">".$name."</a></td>"; } $i++; }while ($row = mysql_fetch_assoc($sql)); $tbl_st .= "</table>"; } echo $tbl_st; ?> do anybody see anything wrong with my code? beacuse i cant get my citites table to echo out after a user has hit one of the states links.....
  19. my apoloigies ! but i already googled i dnt want a script i wanna kno how its done more like a tutorial !!!! so i can make my own!!!
  20. anybody got a simple text/select box with auto complete ?
  21. u should do a date picker for date purchased for the rest of that code it looks alright to me what version of php is your server because with new sytanx i dnt think @email is compatable i would just right it into isset varible: $mail = email(......); if(isset($mail)){ header('location: where.php?mailed=set'); } something like that is what i have runing on my site now..
  22. i just want a popout kind of page where i want to place html code and php code and evan more jquery into that lighbox.... any ideas?
  23. ok, so i am making this ball python breeding game , and i need a little help im about 60% done with the site and i hit the biggest wall of all, heres what i need help with: ok, so i have a form that has two select lists in it male and female, there options are an loop of mysql data for each (male,female) now the problem i have i want the game to be realistic and there some physics, genetics ,and a whirlwind of things that come into play with realistic ball python breeding..... just to name a few: ("If you have any help to offer with any of the following questions thanks alot!") questions: say i have a long array of "male morphs" and i wanna check for a value in that very array? how do i check for a value in an array where the value is a varible? percentage functions ....."just courius"!
×
×
  • 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.