Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. $pattern = '/_/';
  2. first off, you do not need else if ($_POST['textfield'] != $row['title']) { because you do not need to specify the exact opposite of your if statement. All you need is a simple if (...) { } else { } In fact, you don't even need the if statement, since you're asking your database to return results based on the posted value in the first place. As far as your problem is concerned, that message will never echo because the while loop will only execute if it's true in the first place. If you want some kind of "nothing was found" message, you can do something like this: $query = "SELECT * FROM uploads WHERE title = '".$_POST['textfield']."' ORDER BY title ASC"; $result = mysql_query($query); $rows = mysql_num_rows($result); if ($rows > 0) { while($row = mysql_fetch_array($result)) { echo "<a href='index.php?p=view&sub=".$row['id']."'>".$row['title']."</a><br>"; } // end while } else { echo "Search field was not found. Please go back and enter a search item."; } // end else.
  3. perhaps put your die(..) on mysql_query instead of your $sql string assignment, see if it scream at you
  4. by speech marks you mean quotes? No, for the most part, php is a loosely typed language. It automatically converts data types as necessary. <?php $x = 10000; // initially considered an int echo 5 * $x; // output 50000 $x = "10000"; // initially considered as a string echo 5 * $x; // will still output 50000
  5. so..where are these vars being assigned? $name $spot $piret $text
  6. I think that's what he's saying he doesn't want to do, in the OP.
  7. I think the point is that he wants a user to be able to fill out a form on a webpage, instead of going to cpanel, which would involve php doing something, even if it's "using php to tell sometihng else to do it".
  8. well, I think you can do it by executing shell commands through php, if you have the access. Couldn't really help you out on how, but maybe that will point you in some kind of direction.
  9. You can setup email forwarding in your cpanel.
  10. well if you're not getting your die message from your connect, then you must be connecting okay. Add a die to your select_db see if that gives you an error (spelled right? does it exist?) also add a die to your mysql_query it should tell you something helpful as well. Also, i don't see where $userName is actually being assigned anything, so you may be connecting proper and all but it's returning nothing, causing your num_rows to fail.
  11. I assume you already have a login routine for your game? You take that principle and apply it to those other pages. Instead of checking to see if someone is logged in to access the page, you check to see if they are dead.
  12. if you're wanting to add form elements in real time on the fly use javascript.
  13. you put it inside a form element and you assign a name to it just like a form element: <form action = 'target.php' method = 'post'> <textarea name = 'blah' rows = '10' cols = '10'></textarea> </form> and then you access the input just like a regular posted var: target.php echo $_POST['blah'];
  14. moving on up to macros and afk bots huh? None of them are particularly better than the other, except that VC or VB would perhaps be easier on you, seeing as how they already have a framework built into them for interacting with windows, so you don't have to worry about that part.
  15. Being a good code writer does not make you a good writer writer.
  16. [code=php:0] ... [/code] tages are usually the only thing I ever use, unless I'm showing strictly html code.
  17. I could *probably* live with doing it this way: // comment about what I want to be true if((hours < 24) && (minutes < 60) && (seconds < 60)) { // comment about what happens if true return true; } // comment about what I want to be false else { // comment about what happens if false return false; } // end if..else
  18. If you know it's not PHP, then why are you posting in the php help forum? moved. As for your question. The short answer is: nothing. No official or self respecting encryption algorithm would have anything that small. If it is indeed an encryption algorithm, it's just a simple homemade one. If I had to put my chips on something, I'd say it's just the result of a random password generator.
  19. I use the 2nd one. Or rather, that's the closest one. Here's how I would write it: // comment about what I want to be true if ((hours < 24) && (minutes < 60) && (seconds < 60)) { // comment about what happens if true return true; // comment about if it's false } else { // comment about what happens if false return false; } // end if I followed Daniel's link and it looks like I follow about 95% (give or take) of their coding standard. Or rather, they follow me, seeing as how I've been writing code for much longer than they've been around
  20. QFT
  21. One would hope that a table full of news would have dates/times associated with them...
  22. I made my first gwbasic program when I was 5. It was a guessing game. I made it all by myself without just typing what I saw from some book.
  23. I didn't mention it in my post but I also had a lot of previous programming experience. But even still, I would call it "easy" to pick up. I'd even recommend it as a first language to learn for someone who's never done it before. You don't have to mess with things like compiling, declaring/handling data types, messing around directly with memory, etc.. so it's a good place to get your feet wet before diving into something deeper like c++ or java. I see lots of places offering php classes, even at traditional schools, but in my experience of hearing other people's stories of being in those classes, the teachers themselves are pretty much learning as they go, as well, and their code and coding practices are way behind the times for where php is at now. If I may be so bold as to say it, I think the only php "schooling" really worth a damn is to go to zend.com and get trained and certified by them. But even then, hundreds and thousands of people have been able to earn a living as freelancers and get decent paying webmaster or other ITT jobs solely from being self-taught. As with all other areas of occupations (short of McJobs), I imagine that that probably won't last a whole lot longer, though. You know how it is. People always want a piece of paper from you showing that you can do what you claim you can do.
  24. ...and that's why people like you come to places like this making "URGENT!!! NEED HELP ASAP" posts (maybe not you specifically...haven't looked at your post history lol)
  25. example: <?php // your form $form = <<<SOMEFORM <form action = '{$_SERVER['PHP_SELF']}' method = 'post'> some text <input type = 'text' name = 'sometext'> <input type = 'submit' value = 'submit'> </form> SOMEFORM; // if no posted vars, echo form if(!$_POST) { echo $form; // if nothing entered in field (or blank spaces) make an error msg } elseif (!$_POST['sometext'] || trim($_POST['sometext'] == '')) { $error = "must fill out field.<br />"; } // if there's an error msg, echo it and form again if ($error) { echo $error; echo $form; // otherwise, form is validated } else { // do something with $_POST['sometext'] here } ?>
×
×
  • 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.