Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. hmm. i assume that since you aren't getting your die message from your connect, that it's connecting.  add a die statement to your db select: mysql_select_db($dbname) or die(mysql_error()); maybe the db is not being selected.  also make sure your table name is spelled correctly in your query string.  you might also want to try echoing $query and using one of the echoed strings directly into the database like through phpmyadmin or something. also, your query is using $line which is your actual data; are you sure that's what the id is supposed to be, in your query? i think that's what you're shooting for, but i'm just making sure.  i saw that you originally had $line_num in your query and then you edited your post.
  2. coding does seem to have a "magic" feel to it, kinda like a magician doing all kinds of crazy hand motions and speaking wierd incantations to weave a spell that does something. At least, that's how i look at coders: the new age magicians. 
  3. .josh

    Mail Clients

    ..yeah i just go to gmail.com or hotmail.com or whatever.  i used outlook in the past. i wouldn't say it sucked, but i wouldn't use it again.  i like sticking to web-based mailboxes because then i can check my email and also have access to old emails from other computers.
  4. hi. yes, as lots of others have mentioned, using $_GET/$_POST (and properly checking for them) is what you must do. but i think people kind of skipped to step C and forgot about point B. since your register_globals is set to ON, when you pass a variable through your addressbar like [b]index.php?id=123 [/b] you can access it by simply doing something like this: [b]echo $id;[/b] well when they turn register_globals OFF, you can no longer do that. when you pass a variable through the address bar like above, you now have to access it like this: [b]echo $_GET['id'];[/b] same thing with posted variables from forms.  with register_globals set to ON, when you had a form and had a text input tag called name='blah' and you click submit, you can then access in your processing script by simply using $blah.  Well now you have to use $_POST['blah'] or $_GET['blah'] depending on your form's method.  $_POST and $_GET are arrays.  treat them like arrays, because that's what they are.  They are arrays of your variables passed to your next script from forms or address bars or whatever, and each array element 's name is the name of your variable. $_POST['variablename'] from here, you can then go back to the previous posts as far as checking to make sure they exist/are legit/convert them back to regular $variablename for your coding pleasure. 
  5. str_replace, ereg_replace, substr_replace just do www.php.net/insertoneofthosehere
  6. you sure that $file exists or that $lines holds the file that you are expecting? does your echo statement in your foreach loop echo out 2000 lines from the file, saying "blah deleted 0" "blah deleted 1" etc... ?
  7. nono, it's all about understanding the nature of the paper.  just lay the paper flat across as a bridge.  do not think of it as the paper bending, for that is impossible.  think of it as everything else bending around the paper.  you can put 100lbs of books on it, and the paper is not moving, rather the space around the paper.  Your eyes are just fooled into thinking the paper is bending because even light bends around it.  problem solved.  A++ in my book.
  8. i honestly don't think there are really any good schools out there that teach you things like flash and php and ajax and stuff, right now.  I could be wrong.  I haven't looked into it a whole lot, but I know that none of the community colleges in my area really go into it.  And I've talked to several people going to college for comp sci degrees and they pretty much concur.  Hell, even a couple of high school kiddies i know complain that their computer classes teach you a few basic html tags and that's it.  I'm sure there's got to be some good "online colleges" out there.  But at that point, you may as well do what virtually everybody else does - buy a book and/or read the manual and come to places like this.  I suppose I could go into some really long winded theory/explanation as to the nature of web development and the correlation between lack of formal school training and freelancing market, but I'd probably even put myself to sleep.  If you're looking for a teacher to stand in front of you, then I would look into some trade schools like ITT tech or DeVry or something.  Go for the cisco, network and a+ classes.  This isn't spot on to what you are looking for, but that would teach you things like [i]how[/i] the internet works, so learning to do web development should become a whole lot easier on the software level.  especially if you get into things like sockets.  my 2 cents.
  9. i tell you what. how about we trade.
  10. hahaha that's funny cuz you were like LOL OOPSZ and you're asking about OOP. OOPSZ....OOP..OOPSZ...OOP.. get it? HAHahahHAHaha, ermm, ahem. yeah. <goes away>
  11. haha. hahAHAHahHAA! Build a website for a new grill? haHAHahaHAHahHAHA! classic.
  12. [code] $query = "SELECT SUM(number) AS total FROM records";             $result = mysql_query($query);             $r = mysql_fetch_array($result);             echo "total is: {$r['total']}"; [/code]
  13. that warning is your browser itself giving you that warning - on your own computer (client side).  if there is a solution to getting rid of that warning, it's with a client side language like javascript.
  14. $row is an array of your data, with the field names as array elements.  extracting $row will create variables having the same name as your field names. do this loop to see what is actually being retrieved, and then you will see what variables are being extracted. foreach ($row as $key => $val) {   echo "key: $key  value: $val <br>"; } the "key" is the variable names that extract should build.
  15. [code] $_SESSION['basket'] = array(); $_SESSION['kurv'][0][0] = 5; $_SESSION['kurv'][0][1] = 3; $_SESSION['kurv'][1][0] = 1; $_SESSION['kurv'][2][3] = 25; echo count($_SESSION['kurv']) ; [/code]
  16. <input type = 'text' maxlength = '10'> this limits the number of characters to 10.  p.s. - moving to html forum. please ask questions in the proper forum k thx.
  17. a) why do you want it in 2 pages? b) the above code assumes register globals is set to ON. in the form, use value='{$_POST['email']}'  instead of $email. c) if you really want to do it in 2 pages, you're going to have to   1) make a cookie (user dependant)   2) start a session (best option)   3) store the information in a db or flatfile (not really convenient) to make a session: at the beginning of both of your scripts, put session_start(); this must be before anything else (except your <?php tag) then in your form, use $_SESSION['email'] as the input value for the email in your processing script, set $_SESSION['email'] = $_POST['email'] if there is an error, kick them back to the form with a header or something. 
  18. smaller project i'd like to eventually start: making a really really good search engine with 5 million options. larger project i'd like to eventually start: somehow making a 3d model of the internet. Not necessarily of every website out there, but maybe websites retrieved from a search, or something.  Or maybe of the whole damn thing after all.  I've always dreamed of surfing the internet in 3d.  Gotta love those sci-fi books :)
  19. okay so add a timestamp field to your table, associated with the user, and then have your script check the timestamp. if it is not old enough, then give the user an error message instead of executing the normal script.
  20. yes, yes you can.  but, if  your script is generating variable names in your form, and then you are using the foreach or extract methods to change them from $_POST['blah'] to $blah.. i have to ask you why you wish to do this?  you don't know your variable names, so you won't be able to access them later.  The only reason why generating variable names is really useful is for keeping them in an array for easy looping in the first place.  In which case, there's really no point in doing this.  well anyways, good lucks.
  21. is the user somehow logged in or can i randomly surf to this page and keep hitting reload?
  22. as in, never ever again, or just within a certain amount of time?
  23. try global $epts; $epts = mysql_result($result,0,'ep'); also, unless you passed $result as an argument ot the function, you're going to have to declare it as a global too.
  24. if you are not planning on logging anything special, then you can just cut your code in half, using $_REQUEST['id'], as suggested above. It will check the post and get, as it is an array of both.    since your error messages look the same and there seems to be no logging code or anything, then just use request.
  25. your $_POST is an array of all of the posted variables. the foreach loop does this: for each array element in the $_POST array, assign the element name to $key and it's corresponding value to $value.  Then (for each one of these $key/$value pairs), make new variable that is named the same as the array element ($key).  so for example, let's say you have a posted variable called number1 that holds the value '1' so that code will in essence do this: // $_POST['number1'] exists, cuz it was posted foreach ($_POST as $key => $value) {   $number1 = 1; } an alternative method is to use the [url=http://us2.php.net/extract]extract[/url] function: extract ($_POST); it pretty much does the same thing as the foreach loop, but there are extra arguments you can use, as far as overwriting pre-existing variable names, adding on prefixes, etc.. (refer to the linkie above)
×
×
  • 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.