Jump to content

Kerblam

Members
  • Posts

    18
  • Joined

  • Last visited

    Never

Everything posted by Kerblam

  1. Thanks a lot paul! I had to edit it slightly to integrate it into my script, but it's working great now. Cheers.
  2. The date format: date("H:i d/m/Y");
  3. paul2463 - Thanks for your reply. However, your code doesnt return the end date in the d/m/Y format. I tried manipulating it like this: $updateDate = date('d/m/Y',strtotime("+$length day", $startdate)); However it comes out with 06/01/1970. It appears to be ignoring the timestamp value completely, and adding $length days to January 1 1970 00:00:00 GMT by default!
  4. Hey guys, I've never had to use date() or strtotime() before and I find the help pages on php.net really confusing. I need to take the input of start day, start month, and start year, then add a number of days onto that to output a future date. $startday = '01'; $startmonth = 'July'; $startyear = '2007'; $startdate = $startday.' '.$startmonth.' '.$startyear; # So $startdate = 01 July 2007 $length = 5; $startdate = date('d/m/Y',strtotime($startdate)); # So now $startdate = 01/07/2007 (the format I want) How do I go about adding $length number of days onto $startdate, to output the end date in the d/m/Y format?
  5. Read my post above that one. I suggested that being part of the problem, and using a hidden field to store action=do instead.
  6. if ($_GET['category'] == 'actiongame'){ $con = mysql_connect("localhost","warp_gm","Forest77"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("Forest77", $con); $result = mysql_query("SELECT * FROM accepted_uploads WHERE uploadgenre='Action Game' ORDER BY uploadid"); $num = mysql_affected_rows($result); if ($num > 0) { echo "<tr> <th>Name</th> <th>Author</th> <th>Genre</th> <th>Style</th> </tr>"; while($row = mysql_fetch_array($result)) // THIS IS LINE 456 { echo "<tr>"; echo "<td><a href=\"?cmd=viewflash&id=" . $row['uploadid'] . ">" . $row['uploadname'] . "</td>"; echo "<td>" . $row['uploadauthor'] . "</td>"; echo "<td>" . $row['uploadgenre'] . "</td>"; echo "<td>" . $row['uploadstyle'] . "</td>"; echo "</tr>"; } } else { echo "Query found no results."; } mysql_close($con); } Run this code in it's place. I've added in a check to see if the query is actually finding results. If there are no results and you try to fetch them in an array, it will return an error. Let me know what happens.
  7. Replace: elseif ($_GET['action'] == "do"){ with: if ($_POST['action'] == do) {
  8. Perhaps its not the php itself then? Instead of this: <form action='insertspam.php?action=do' name='insert' method='post'> Do this: <form action=insertspam.php name=insert method=post> <input type=hidden name=action value=do /> And then change the PHP to reflect this: if ($_POST['action'] == do) { etc.
  9. You mistyped $affected in the query, it says $affexted.
  10. To any visitor, robot, spider or genuine user, the data they receive from a page is the same. If you include it or echo it or if it's just html, the browser doesnt know any different. So dont worry, search engines will still see your keywords and descriptions.
  11. You were close. <select size="1" name="sq"> <option>Select One</option> <option <?php if (condition) { echo "selected";}?> >Who is your best childhood friend?</option> <option <?php if (condition) { echo "selected";}?> >What is your favorite meal?</option> <option <?php if (condition) { echo "selected";}?> >What is your favorite hobby?</option> <option <?php if (condition) { echo "selected";}?> >Who is your favorite teacher?</option> <option <?php if (condition) { echo "selected";}?> >What is your favorite movie?</option> </select> Is this what you meant?
  12. Well the best logical way to do this is by storing the query as a variable, and choosing which one to use based on the input. For example: if (isset($_POST['submit'])) { $query = "INSERT blah blah blah"; } else { $query = "UPDATE blah blah blah"; } $result = @mysql_query($query);
  13. Of course, this is an easy thing to do. You just need to use a select query beforehand to find any match where a username is equal to the input username variable, like so: require_once ('connect.php'); # Connect to the database $query = "SELECT * FROM users WHERE username='".$username."'"; $result = @mysql_query ($query); $num = mysql_num_rows ($result); # How many results have that username if ($num > 0) { # The username is in use, so...send an error } } else { # The username isnt in use, carry on } You'll probably need to change around the variable and field names, but that should work.
  14. Yes, just use this code before you execute the mail(). $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  15. As far as I know, the only way you could get the id is querying the database straight after. If possible, just use the information you just entered to find an exact match in the same table.
  16. So in summary, the page displays differently when executed directly to through a script? That seems very strange. Is any of your css based on variables at all? Post d.php for us?
  17. I'd do this: <?php $stats = file("all_stat.htm"); foreach ($stats as $line){ if (!empty($line) { $newStats[] = strip_tags($line); } } echo "<pre>"; print_r($newStats); echo "</pre>"; ?>
  18. The email is sending twice because this: mail($email, "Newsletter", $email_temp, "From: [email protected]" ); sends the mail, and then your if clause: if(mail($email, "Newsletter", $email_temp, "From: [email protected]" )){ sends it again. The solution is this: $result = mail($email, "Newsletter", $email_temp, "From: [email protected]" ); if ($result) {
×
×
  • 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.