Jump to content

l4nc3r

Members
  • Posts

    82
  • Joined

  • Last visited

    Never

Contact Methods

  • AIM
    l4nc3rr
  • MSN
    l4nc3r@comcast.net
  • Website URL
    http://www.ironcoding.com/

Profile Information

  • Gender
    Male
  • Location
    Massachusetts, US

l4nc3r's Achievements

Member

Member (2/5)

0

Reputation

  1. Hey man, along with anything you'd find with a plain ol' Google search, you can check out a series I wrote on quoting projects here: How to Create Accurate Quotes Pt. 1: Modeling Potential Projects The basic premise is you create a model for each project, create a time to complete the project from the model, and then multiply that by your desired rate. Also, even if you're learning as you go (which I still do for 90% of my projects), you need to do some research before hand to get a good idea of how long it's going to take you. Hope this helps! Tucker
  2. No need to complicate things with javascript, or even with posting to a separate script and then redirecting back. The way I usually do form validation is I have the action set to the same page and if the submit var is set I include the form validation file. So the way you would do it with multiple pages is, if the submit button is set, include the form validation file. If there is an error, do nothing and display the errors on the page. If there is no error, store the values in a session var and redirect to the next form page. So.. if(isset($_POST['submit'])) { include('formValidation.php'); if(!isset($error)) { $_SESSION['form'] = $_POST['value']; header('formPage2.php'); } } if(isset($error)) { echo $error; } // print out form
  3. I was trying to "actually help." You can't just post code, say it doesn't work, and expect to get helpful responses back. We need to know what your code is doing. If you followed the guidelines in that blog post, you could probably figure this out for yourself. That looks like fine output for $output. What does $obj print out?
  4. That's odd. Not really sure why echo doesn't work in that context. But why would you need it to? You can just echo out $i in the for statement.
  5. Including the file isn't enough--you have to call the function and echo out what it returns.
  6. Are PHP errors turned on? Did you check the source? Is it outputting HTML but you just can't see it? The function returns an output, it doesn't echo it automatically. When you use the function, are you using it like this? echo dynamic_checkbox_table(...);
  7. Use php tags, man. echo "<a href='".( strpos( '://', $row['website'] ) ? '' : '' ).$row['website']."' rel='nofollow'>".$row['website']."</a>\n";
  8. Gotta read those error messages, man. It says it's on line 84 in process_r.php where there was an unexpected "}". Generally, when you get an unexpected error, it means you forgot a semicolon in the line before it. include 'thank-you.php';
  9. You put all of your HTML inside of a variable. $content='';
  10. What error are you getting? What is $output equal to? What does the print_r on the $obj look like? When you're debugging, you have to know everything about your program. You want to know what every little variable is equal to and why it's acting the way it is. Post on my blog about it here.
  11. I'm assuming you're using an SQL dump to upload it. If that's the case, then you could just do one grand mysql_query() on the entire dump inside of a php script.
  12. You might've wanted to make it clear this was Drupal in the subject--I didn't know until I saw the "l" function, which I had to look up. Also, using $_REQUEST is a bad idea. You should change it to $_GET. So when you get data back from a database, it's ALWAYS in string form (unless you do prepared statements). So, with that in mind, the problem is in this code: if ($current_votes) { $new_votes = $current_votes + $value; db_query("UPDATE bonnier_vote SET votes = $new_votes WHERE nid = $nid"); } else { db_query("INSERT INTO bonnier_vote (nid, votes) VALUES ($nid, $value)"); } $current_votes is always going to return true (even if it's "0") because it's a string and therefore has value. What I think you want is this: $current_votes = (int)$current_votes; if ($current_votes + $value >= 0) { $new_votes = $current_votes + $value; db_query("UPDATE bonnier_vote SET votes = $new_votes WHERE nid = $nid"); } But that will only prevent it from going below 0. If you want it to, after it's been voted up and then down again to be prevented from being voted again, you would have to add some sort of check into the database. So when it's voted up, you would update the "voted" column to true for that vote. You'd allow it to go up and down, I'm assuming, as much as you want until it was 0 again and "voted" was true. Then no more voting would be allowed.
  13. Well, it should just keep moving through the code, so you could echo out some AJAX loader, run shell_exec, and in the line right after shell_exec do whatever. And so you know, shell_exec outputs the return from the command.
  14. Well, you should probably get learning those languages. You can't configure and edit a third party php script without knowing php. Check out this post on my blog for a good introduction to web programming and some places to find tutorials.
×
×
  • 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.