Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. $i=0; while($row = mysql_fetch_array($result)) { $color = (($i % 2) == 0)?"red":"blue"; echo "<tr bgcolor={$color}>"; echo "<td><div align='center'>" . $row['unit'] . "</td>"; echo "<td><div align='center'>" . $row['name'] . "</td>"; echo "<td><div align='center'>" . $row['rank'] . "</td>"; echo "<td><div align='center'><a href='mailto:" . $row['email'] . "'>" . $row['email'] . "</a></td>"; echo "</tr>"; $i++; } echo "</table>"; The ? and : is the ternary operator (shortened if/else). The % is the modulus operator. In case you want to read more up on them and how they work.
  2. Print out $User, I have a vague feeling that it is not being populated. As inside the 2nd is_dir if that is going to the else since when you are moving the file $target_path contains an empty value.
  3. It could also be that, the information provided to us does not help us diagnose your problem. Given that this is technically a 3rd party script (I take it you got it from paypal) maybe you need to goto the sandbox help forums and ask them there why it is not working. I never used paypals sandbox or the script they provide, so it could be simply that the information you are passing is invalid as the error suggests. A rule of thumb, if you do not get an answer to your question within a day, chances are you have worded it wrong, you are posting in the wrong section, or you need to do some more research on your own to figure it out. As we cannot test what you have (nor would I want to) and without being able to actively test that script I cannot help resolve it. Sure I could make guesses, but they are just that. A guess, which could lead you in the wrong direction.
  4. Hence the problem with PHP Freelancing. You have every n00b underbidding the good programmers to get the job. The best way I have found to get some extra side jobs is just find contacts. I have met a few through this forum and offered me work at my normal rate. Sometimes I took a job for less and let them know that this was an "introductory" rate to get my foot in the door and the subsequent jobs, if they liked my work, would be at my normal rate and let them know my normal rate. Probably about a 75% success rate of getting another job with my normal rate. Granted it was simple jobs I took on and not massive projects, so for the most part they just contact me to fix some issues that they are stumped with or to add a modification to a script. But that is just my experience. Granted I have a great full-time job so I do not need the extra cash/projects. So that setup works out great for me. If you are a decent coder, finding a job will not be entirely difficult, as it should show in your work. You need a good work ethic as well to produce an item on time and to not under or over bid that item. A knowledge of how long a project should take is probably the hardest thing to do. The person offering the job tends to think it should be done in an hours worth of time. Which is most of the time ludacris and so you will have to tell them the low-down of how long it would actually take you to do it and deliver it on that time frame. Well end of that little blurge
  5. premiso

    Curl

    As a side note, depending on how big the flv is, you may want to increase the memory_limit temporarily too to be at least the size of the flv since you have to store it into memory before you write it to the file.
  6. $newpo, $newmo, $username and $_SESSION['id'] were not set. Also you did not add the = after the id part like I suggested. But basically your variables are not being assigned a value like you are expecting them to. [code=php:0]} else { $pagepo = ($_POST['po1'] + $_POST['po4']); $pagemo = ($_POST['mo2'] + $_POST['mo3']); $newpo = ($currentpo + $pagepo); $newmo = ($currentmo + $pagemo); $query = "UPDATE ".$mysqltable." SET resultspo = '".$newpo."', resultsmo = '".$newmo."' WHERE username = '".$username."' AND id = '".$_SESSION['id']."'"; mysql_query($query) or die("There was a mysql error<br />Query: {$query}<br />Error Returned: " . mysql_error()); //JavaScript page redirect... echo '<script>location.href="passiontest2.php"</script>' } // Close if/else ?> Change that part, as the query was running even if the condition was true due to the fact it was not inside the else brackets.
  7. } ?> <?php That will cause an issue with header tags, as there is a space there that is considered a "white space" and constitute output being sent to the browser. There is also no need for that so just remove the php tags from there and see if that solves the problem. Also please use instead of the quote tags to surround code.
  8. Let's give the SQL error a better look and feed you out helpful information: $query = "UPDATE ".$mysqltable." SET resultspo = '".$newpo."', resultsmo = '".$newmo."' WHERE username = '".$username."' AND id '".$_SESSION['id']."'"; mysql_query($query) or die("There was a mysql error<br />Query: {$query}<br />Error Returned: " . mysql_error()); Modify that and report what it states. My bet, is that the id is missing the equals is causing the problem. So try changing this and see if that helps: $query = "UPDATE ".$mysqltable." SET resultspo = '".$newpo."', resultsmo = '".$newmo."' WHERE username = '".$username."' AND id = '".$_SESSION['id']."'"; If not add the better error reporting I showed (should only be used in development environment).
  9. PHP Contact Form Tutorial
  10. Why not post the MySQL error message so we can help resolve that.
  11. Basic Pagination on PHPFreaks PHPFreaks has a great pagination tutorial written by CV. If that is what you are after take a look at that tutorial.
  12. Change the first if to be is_dir Since you are checking DIR and not for a FILE, that would be the right one to use for that if. //Testing if there is a file in perm_images = to the name in $User if (is_dir('perm_images/$User')) {
  13. Remove the //link to etc. Use file to read them into an array, and iterate through the array to display those links. $links = file('urls.txt'); foreach ($links as $link) { echo '<a href="' . $link . '" target="_blank">' . $link . '</a><br />'; } Simple as that. If, however, you want to define the links so you can use them later on, this may work for you: urls.txt style:http://www.whatever.com/stylesheets/stylesheet.css nav:http://www.whatever.com/nav.php $links = file('urls.txt'); $linkArray = array(); foreach ($links as $link) { list($name, $link) = explode(":", $link); $linkArray[$name] = $link; } // other code echo '<link href="' . $linkArray['style'] . '" rel="stylesheet">'; include($linkArray['nav']); Not sure if that is what you are getting at. Hopefully that helps you figure out what you need. (I would put the foreach and above into an include file, then include that file on each page you wish to use the variables.) Then below the other code would be the code in the file that you want to be "dynamic".
  14. $sql = "SELECT COUNT(prison) FROM players WHERE prison > 0"; $result = mysql_query($sql); $prisonCount = mysql_result($result, 0, 0); echo $prisonCount . "<br />"; Basic PHP and MySQL, I would suggest reading a tutorial on that.
  15. I would setup the field to be a MySQL DATE field. Then on the submitted section do something like this (assuming that you used POST as the submit method) if (isset($_POST['submit'])) { $bday = $_POST['year'] . "-" . $_POST['month'] . "-" . $_POST['day']; // do the mysql insert with $bday as the field. } Before entering the date into the DB, you may want to run a checkdate on the values to make sure they are a valid date.
  16. echo "<td><div align='center'><a href='mailto:" . $row['email'] . "'>" . $row['email'] . "</a></td>"; A simple hyperlink. You may want to look into learning some basic HTML.
  17. Does "perm_images" have write permissions (0775 or 0777) if not, you will have to be able to write to that directory to create one in it. Also do you have display_errors turned on and error_reporting set to E_ALL, if not turn it on as that will give you an error which could tell you why it is not working/creating the directory.
  18. An easier fix is to use HEREDOC syntax. function showForm () { echo <<<SHOWFORM <form id="form1" name="form1" method="post" action=""> <table width="699" border="0" align="center" cellspacing="5" class="style1"> <tr> <td colspan="3"><div align="center"><span class="style4">Your Passion Test</span></div></td> </tr> <tr> <td width="24"> </td> <td width="429"> </td> <td width="220"><div align="right">Saturday, 03/28/09</div></td> </tr> <tr> <td> </td> <td> </td> <td><div align="right">{$_SESSION['MM_firstname']}</div></td> </tr> <tr> <td> </td> <td> </td> <td><div align="right"></div></td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>1</td> <td><strong>I like talking to people. </strong><br /> </b></td> <td><div align="left"> <input name="po1" type="radio" value="0" /> 0 <input name="po1" type="radio" value="1" /> 1 <input name="po1" type="radio" value="2" /> 2 <input name="po1" type="radio" value="3" /> 3 <input name="po1" type="radio" value="4" /> 4 <input name="po1" type="radio" value="5" /> 5</div></td> </tr> <tr> <td>2</td> <td>It is important for me what other people think. </td> <td><p> <label></label> <label></label> <input name="mo2" type="radio" value="0" /> 0 <input name="mo2" type="radio" value="1" /> 1 <input name="mo2" type="radio" value="2" /> 2 <input name="mo2" type="radio" value="3" /> 3 <input name="mo2" type="radio" value="4" /> 4 <input name="mo2" type="radio" value="5" /> 5<br /> <br /> </p></td> </tr> <tr> <td>3</td> <td class="style1">My level of excitement is high right now. </td> <td><p> <label></label> <input name="mo3" type="radio" value="0" /> 0 <input name="mo3" type="radio" value="1" /> 1 <input name="mo3" type="radio" value="2" /> 2 <input name="mo3" type="radio" value="3" /> 3 <input name="mo3" type="radio" value="4" /> 4 <input name="mo3" type="radio" value="5" /> 5<br /> </p></td> </tr> <tr> <td>4</td> <td>I like solving mathematical tasks. </td> <td><input name="po4" type="radio" value="0" /> 0 <input name="po4" type="radio" value="1" /> 1 <input name="po4" type="radio" value="2" /> 2 <input name="po4" type="radio" value="3" /> 3 <input name="po4" type="radio" value="4" /> 4 <input name="po4" type="radio" value="5" /> 5</td> </tr> </table> <p align="center"> <input name="Submit" type="submit" class="style1" value="go on" /> </p> </form> SHOWFORM; }//Close showForm() Should solve the quotes issue without having to escape each one. If you do not understand why the double quotes inside of a double quote need to be escaped or you need to use an alternative method of quoting. Please read the PHP Manual on Strings and syntax. That will give you the basic syntax and how to properly use it.
  19. lol, reminds me of a saying my first aid adviser said in boy scouts... "A turnicate around the neck will solve all your problems" He was a weird dude...
  20. For localhost, unless you plan on setting up a full on webserver locally, that should suffice for development. Most servers provide you access to their mail server so this would not arise on an actual server. I would suggest, for ease of use on a local "Development" box, if that is what it is, to use that script with a gmail account (as you can send up to 100 emails a day) and test your settings. If you do not, you can attempt to see if your ISP offers you access to an SMTP server and get that information then add it to the php.ini. If they do that would be the best route to go, or find your own free smtp service. Windows boxes do not come with a mail server installed, and on linux you have to install one yourself. But access to port 25 is required for most web servers. As stated before, ISP's tend to block this port due to spam. And as for that only sending to your "gmail" account, that would use your gmail account as the SMTP server. (as mike pointed out above).
  21. For a local wamp server chances are the mail function will not work. Due to the simple fact that you have to have a mail server installed on your box for it to work. Not to mention that most ISP's block Port 25, which is what most mail is sent on. Do a google for a script called "phpGMailer" this script will allow you to input your gmail account information and send email using that as the median. See the script description etc for usage.
  22. Just use nl2br the str_replace portion is not needed, and does not make any sense, honestly. $input=htmlentities(nl2br($_POST['field'])); Not sure if you want it before the entities function or after, but that is the gist.
  23. Suppresses error message and should be avoided. Instead, on a production server you should turn display_errors to off in the php.ini to avoid showing the errors. But more importantly, you should find out why an error is being thrown and correct it at the source.
  24. Bottom left hand corner, above the quick reply. I marked it for you, but that is where it is for future reference. (It should show up as Mark Unsolved or something similar now).
×
×
  • 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.