Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. you made some typos. [code] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php if (!$_POST['submit']) { ?> <form method="post" action="<?=$_SERVER['PHP_SELF']?>"> Enter number of rows <input name="rows" type="text" size="4"> and columns <input name="columns" type="text" size="4"> <input type="submit" name="submit" value="Draw Table"> </form> <?php } else { ?> <table border="1" cellspacing="5" cellpadding="0"> <?php //set variables from form input $rows = $_POST['rows']; $columns = $_POST['columns']; //loop to create rows for ($r = 1; $r <= $rows; $r++) { echo "<tr>"; //loop to crearte columns for ($c = 1; $c <= $columns; $c++) { echo "<td>&nbsp;</td>\n"; } echo "</tr>\n"; } ?> </table> <?php } ?> </body> </html> [/code]
  2. It's up to you. That's a design issue.
  3. perhaps you need to be a bit clearer.  Are you for instance, wanting to have a list of stuff that you want to be able to move up and down the list, such as, on a message board, having say 10 forums, and being able to move a forum up or down the list? if so, then what you will want to do is create another field in your table called "layout_order" or other some such descriptive thing.  Then you will want to in your query, order by layout_order.  If you want to "bump" the item up a notch, then you would swap numbers with the it and the one above it. 
  4. read the part in the manual about mixing html with php code
  5. is this what you are looking for? [code] <?php function Get_Image($path) {   $ctr = 0;   if ( $img_dir = @opendir($path) ) {       while ( false !== ($img_file = readdir($img_dir)) ) {         // add checks for other image file types here, if you like         if ( preg_match("/(\.jpg)$/", $img_file) ) {             $images[$ctr] = $img_file;             $ctr++;         } // end if       } // end while       closedir($img_dir);       $image = $images[array_rand($images)];       return $image;   } else {         return "invalid path";   } // end else } // end function $somepath = 'path/to/images/'; $image = Get_Image($somepath); ?> [/code] you could of course modify this to return more than 1 result by changing this: [code] $image = $images[array_rand($images)]; [/code] to this: [code] $num = 50; // or however many for ($x = 0; $x < $num; $x++) {   $image[] = $images[array_rand($images)]; } [/code] and then it would return an array of image names to be used as such: [code] // from first example: echo "<img src = '$somepath/$image'>"; // example if returning array: echo "<img src = '$somepath/{$image[0]}'>"; // first picture echo "<img src = '$somepath/{$image[2]}'>"; // third picture // example of displaying all of them: foreach ($image as $val) {   echo "<img src = '$somepath/$val'>"; } [/code]
  6. [url=http://www.php.net/eval]eval()[/url]
  7. .josh

    bored

    [quote author=steelmanronald06 link=topic=113052.msg459196#msg459196 date=1162062163] i think he is trying to start one of those games where you take the code he made, edit/add to it, and repost it [/quote] hey that sounds like a cool game! omg you're useful afterall! ;D methinks I shall start a game thread for that.
  8. .josh

    bored

    if you're even bored-er, how about turning that into a class so you can play with it some more.
  9. slightly off topic: you shouldn't be putting your $_GET variables directly into your queries like that.  This doesn't have anything to do with resources; it's a security issue.  Doing that makes your site ripe for sql injection. Here's a thought: maybe someone has figured out this, and they are exploiting you. Have you checked any of your logs? checked your database?
  10. yeah, that should work.  although, depending on the end goal and stuff, there might be a more efficient way of doing that. for instance, if you were wanting to have a form field in which you put in the queries, you could just create a loop for it, etc..
  11. hola and welcome to the forums.  it would be easier for us to help you if you actually told us what the problem was? I mean, I see some things you should probably change, logic and security-wise, but does it work and you are looking on how to improve it, or do you have a specific problem with it?
  12. ...as in, go to another page, or including the file? be more specific. here are some examples: [code] $blah = 1; if ($blah == 1) {   // example 1: redirect to new page   header('Location: newpage.php'); exit;   // example 2: include the script   include('somepage.php'); } else {   // condition was false. spit out error or access denied or stick your tongue out at them } [/code]
  13. [code] <?php   $conn = mysql_connect('localhost','username','password') or die(mysql_error());   $db = mysql_select_db('dbname',$conn) or die(mysql_error());   $sql = "put your query string here";     $result = mysql_query($sql, $conn) or die(mysql_error()); ?> [/code]
  14. i know you said you wanted to refrain from using add/stripslashes, but this is what i use, and it's been okay thusfar: [code] function clean_var($value){   if (get_magic_quotes_gpc()) { stripslashes($value); }   if (!is_numeric($value)) { mysql_real_escape_string($value); }      return $value; } [/code]
  15. here try this. [code] <?php   $email = $_REQUEST['email'] ;   $name = $_REQUEST['name'] ;   $classdateandtime = $_REQUEST['classdateandtime'] ;   $instructors = $_REQUEST['instructors'] ;   $address = $_REQUEST['address'] ;   $city = $_REQUEST['city'] ;   $state = $_REQUEST['state'] ;   $zip = $_REQUEST['zip'] ;   $phone = $_REQUEST['phone'] ;   $Q1 = $_REQUEST['Q1'] ;   $Q2 = $_REQUEST['Q2'] ;   $Q3 = $_REQUEST['Q3'] ;   $Q4 = $_REQUEST['Q4'] ;   $Q5 = $_REQUEST['Q5'] ;   $Q6 = $_REQUEST['Q6'] ;   $Q7 = $_REQUEST['Q7'] ;   $Q8 = $_REQUEST['Q8'] ;   $Q9 = $_REQUEST['Q9'] ;   $comments = $_REQUEST['comments'] ;   $headers  = 'MIME-Version: 1.0' . "\r\n";   $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";   $message = "From: $email   <strong>Name:</strong> $name   Class Date and Time: $classdateandtime   Instructors: $instructors   Address: $address   City: $city   State: $state   Zip: $zip   Phone Number: $phone     This learning Experience was: $Q1   Were the stated learning objectives met?: $Q2   If applicable, were prerequisites appropriate?: $Q3   Were program materials both accurate and effective?: $Q4   Did program materials contribute to the achievement of the learning Objectives?: $Q5   Was the time allotted to the learning experience appropriate?: $Q6   Were the facilities and/or the technological equipment appropriate?: $Q7   Were the handouts and advanced preparation materials satisfactory?: $Q8   Was the classroom facilitator's knowledge and experience satisfactory for the course material?: $Q9     Comments: $comments";   mail( "myname@myname.com", "EPSA CAP2 Evaluation Results", $message, $headers);   header( "Location: http://www.estateplanningschools.com/thankyou.html" ); ?> [/code]
  16. (Ken beated me) if nothing else: [code] <?php $blah = 0; echo ($blah) ? "yes" : "no"; // or make a function function YesNoFormat($x) {   return ($x)? "yes" : "no"; } echo YesNoFormat($blah); ?>  [/code]
  17. well for one thing, it's <b > .. </b > (no spaces) not <bold>...</bold>
  18. you know my profile does say I am a boy and I have mentioned my wife several times before...even in this thread..
  19. ...and that's why we don't write code for people here.  That's why it's better left to freelancers who have access to the servers to make it work, for people who don't want to learn it on their own.
  20. Long and boring details about Crayon's quirks: First off, here is a picture of me. It's somewhere around 5 or 6 years old.  I'm too lazy to upload a more recent picture so I grabbed this off my profile from another website [img]http://darwinawards.com/ikon/member/plaztekk1.jpg[/img] Favorite bands of all time: Rage Against the Machine, Simon and Garfunkel, Enya, Cranberries, Poe, Trance (though I'm pretty picky on what I like on that. Mostly slower and just mellow. Tempo of no more than 90-ish, but no less than 80-ish and it has to be fairly complex).  Anything classical. Not too hot on piano though. I like strings mostly. Least favorite Music Genre: Country.  Like nails on a chalkboard.  Every time I hear a country song playing, all I hear is some old dog howling. Favorite color: Blue, lavendar. To me, blue signifies calmness and coolness, things which I strive to be.  I choose lavendar as more accurately my color though, because Even though I strive for the calm and coolness of blue, I have that hint of energy and..not so much rage, but impatience that goes with red. But I lean more towards the blue side of lavendar, because I've gotten tons better over the years.  Red and Blue make more of a purple than a lavendar.  Lavendar has some white thrown into it.  I like to think that the reason why I am leaning more towards the blue end of that, is because of God, thus God signifies the white.  That's also where 'crayon violent' derives from. The color violet is in the same family, but I chose it because I could do a play on words with it: viole[b]n[/b]t.  It just sounded a lot cooler than Crayon Lavendar.  I hate sports. For instance, football (american): Watching big guys get paid a lot to run around in tights just doesn't appeal to me.  Wrestling: legit sport or not, again, watching two guys in spandex grabbing at each other just doesn't appeal to me.  Overall, watching other people get paid a lot of money to play a game just doesn't appeal to me.  I'm down for [i]playing[/i] some street hockey though - old school style where at the end of the day there's a 100% chance of going home with cuts scrapes and bruises, 75% chance sprained ankle etc.. 50% chance someone broke something ;D It's just not cool any other way ;D Things I watch on TV: Lost (haven't watched any of season 3 yet. I'm waiting for the dvd because I don't like having to wait a whole week between episodes). It's not normally my type of series, but my wife likes it, and one day during season 1 she was watching it and I was in the room and saw some of it, and it's not so much that I *LIKE* it, but that I just wanna see what happens next/how it ends.  I do like watching the new series called Heroes.  I mean, it's nothing all that *special* but it's somewhat entertaining enough to watch.  I like Comedies, old Kung Fu flicks, and Anime.  Even chick-flick comedies, though that's pushing it.  As long as the romance part is in the background as some underlying plot, and comedy is the centerpiece, that's fine.  Acceptable: 50 First Dates.  Unacceptable: Sliding Doors.  Some random favorite movies of mine: Evil Dead 2, Army of Darkness, anything by Hayao Miyazaki (except Nausiica; I didn't really care for it) but especially Spirited Away.  His recent release: Howl's Moving Castle was thoroughly enjoyable, and to be honest, I think it might de-throne Spirited Away on my list of favorite Miyazaki films.  The debate is still open on that, though. Anything Kevin Smith.  What did you all think of Clerks II? I liked it, but man, I think they could have done better. I still liked it though. Office Space, Vampire Hunter D, Ninja Scroll, most of Jet Li's stuff, and the list goes on. I also like watching Avatar.  This gets its own paragraph because I thought I'd share a particularly amusing (IMO) anecdote about Avatar.  About a month ago I was chillin' on the computer and suddenly I hear my 4 year old crying from the bathroom.  So I go in to investigate and he's sitting on the floor with a cup of water between his legs crying.  I asked him what was wrong and he told me that he tried and tried and tried but he just can't water bend.  I about shit my pants laughing at that, which would have been okay, cuz I was already in the bathroom. I'm compulsively sarcastic.  I can't help it.  Someone says something or does something, and it just comes out.  At best, people call me an asshole for that; at worst, I keep getting into trouble.  Lol, I just can't help it.  It's like Tourette Syndrome where my 'tic' is sarcasm, lol.  Actually, I wouldn't necessarily call it sarcasm (even though people usually take it that way).  I personally like to call it bluntly pointing out the truth and/or irony of the situation at hand.  I will concede that I have no tact whatsoever, but that is not the same as telling lies or being an asshole.  Take for instance the provibial woman asking her man if she's fat.  Instead of dancing around the subject, I just tell her she's fat.  You aren't gonna really feel good about yourself unless you're honest with yourself enough to recognize things you don't like and then fix them.  Closing your eyes and listening to lies does not solve the problem. I've been a smoker for about 12 years.  About 2 months ago I decided to quit (again, for real this time, I swear! ;D ) but I still smoke about 2-3 cigs a week, which any smoker can tell you that that's nothing, and it is certainly a lot better than the pack a day I smoked.  But I should be able to stop even that much pretty soon, so hopefully this time it should be for really real.  I don't drink, as I don't like the taste of alcohol.  I used to smoke a lot of pot and do a lot of acid.  A lot. Not even gonna get into how much or even drug related stories.  But I've been sober of that for 7 years now. My favorite kind of food is mexican food.  Enchiladas, fajitas, burritos, tortilla soup, mm...  even just plain old beans and rice will do it for me.  I'm pretty good at making enchiladas and fajitas, and people constantly harass me to make tortilla soup.  I also enjoy making breads (by hand, no bread machine), like french bread or ciabatta bread. mm...bread. I love the smell of freshly baked bread.  <drools> I hate getting up in the middle of the night to go to the bathroom.  It takes me forever to go to sleep in the first place.  I feel I'm being gypped on sleep.  Stupid bladder.  If I had to choose between pirates, vikings or ninjas, I'd go for the ninjas.  Well, I don't know... ninjas are cool, but come on, pirates! And vikings!  There needs to be an epic battle involving all 3.  umm, My first born son's name is Exodus. People give me odd looks on that.  If this next Kid is a girl, we're naming her Genesis.  I'm sure we'll get just as many odd looks from that.  I think i'm borderline obsessive compulsive.  For instance, If I count money, I have to count it 3 times.  First time because it's being counted, 2nd time to make sure it's the same as 1st, 3rd time to make sure I didn't happen to consistently mis-count twice in a row.  If I come up with a different number the 2nd time, I have to count a minimum of 4 times now.  The end goal is that I must come up with the same number 3 times.  If I turn something off, like lights or an oven, I have to go back and check it again to make sure I turned it off.  I don't simply do the off-on-off-on-off thing people do with light switches though.  I have to actually leave the room and come back a minute or 2 later.  The whole point is that I may have forgotten to turn it off.  I can obviously see that I turned it off when I'm standing there turning it off, so flipping the switch on and off is pointless and stupid.  But I don't really have germ issues or anything like that.  Although, my wife and I are both pretty adamant about taking showers before our bedroom adventures...does that count?  Hmm..okay, I prefer to wear slacks and a t-shirt.  I don't really care for jeans.  They are too hot and constricting and heavy.  That's why I like slacks.  Nothing fancy; walmart brand will do.  I also like wearing "slipper" shoes - shoes without shoelaces that just slip onto your feet.  Less hassle in putting them on, and they generally aren't as hot or constricting.  I don't really care for dress shoes like that though, like loafers.  They are too hard and usually cut into the front of my feet, where the tongues usually are.  Although my 'favorite' colors are blue/lavendar, I generally prefer to dress in dark or pale earthtones.  I don't really like wearing shirts with logos/words on them. This includes band shirts, witty remarks, etc.. I refuse to be a walking advertisement, even for things I like.  Besides, even if the shirt is witty, the tackiness of wearing it overpowers the wittiness.  Maybe if I could get away with wearing something like "OMG Just Shut the F*ck up already you talk too much" (without the *) then I might go for that...kinda ironic considering how long winded this post is, huh? AhahAHaha..shut up.  Umm..what else, what else.. well there really isn't a whole lot else to tell, I guess. The End.
  21. yeah i forgot to mention that, but obsidian mentioned it.  I'd like to re-iterate it though: You will be VERY hard pressed to find an insurance company that will cover pre-existing conditions, and they certainly will NOT pay for any portion of pre-existing bills, even if they WILL cover the pre-existing condition from then on (which they probably won't).  So whatever you've racked up in bills so far, that's completely up to you to resolve. You could possibly file bankruptcy. Chapter 11 or 7. But those laws are changing to make it harder to file bankruptcy.  And laws vary from state to state.  If you are looking to lessen/remove debt, look into that, instead of insurance. 
  22. This forum is not for writing scripts for you, nor recommending 3rd party scripts.  If you wish for someone to write a script for you, please post in the freelance forum (read forum rules first).  If you want some recommendations for 3rd party scripts, ask in the misc. forum.  If you want some help on your self-made code that you already have, then php help forum is indeed the right place for this.  But it doesn't look like that's what you're leaning towards.  For now, I am moving this to misc. forum for people to offer recommendations. 
  23. we are not here to write your code for you. We are here to help debug your code that you yourself are working on.  If you want someone to write your code for you, please go post in the freelance forum (read the forum rules before doing so).
  24. add this to your function: global $connection; [code] <? require("connection.php"); function geteditcontent($inTable,$inId){ global $connection;                 $sql="select * from $inTable where regionId='$inId'"; $result=mysql_query($sql,$connection) or die(mysql_error()); while($row=mysql_fetch_array($result)) { $info[] = $row; } return $info; } ?> [/code]
  25. 'description' and 'content' spelled right? man..idk, it looks legit...
×
×
  • 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.