Jump to content

Philip

Staff Alumni
  • Posts

    4,665
  • Joined

  • Last visited

  • Days Won

    20

Everything posted by Philip

  1. Not a problem :D
  2. Try: [code] <style type="text/css"> .greentext { color: #2a8f3d; margin: 4px; font-family: Tahoma; font-size: 19px; } .blacktext { color: #000000; margin: 4px; font-family: Tahoma; font-size: 11px; } </style> <?php include 'db.php'; $getid = $_GET['id']; $sql = "SELECT * FROM gallery WHERE id = $getid"; $result = mysql_query($sql); $total_rows = mysql_num_rows(mysql_query("SELECT * FROM gallery")); // find out how many rows are in that table, see what the max number is while ($row = mysql_fetch_array($result)) { $picture = $row['picture']; $heading = $row['heading']; $description = $row['description']; } $sql2 = "SELECT id FROM gallery WHERE id > $id LIMIT 1"; $result2 = mysql_query($sql2); while ($row = mysql_fetch_array($result)) { $id = $row['id']; } if ($getid == $id) { echo "<div align='center'>   <div class=\"greentext\"><b>$heading</b></div>   <div class=\"blacktext\">$description</div><br />   <img src=\"images/$picture\" style=\"border: 2px solid #d4cccc;\"><br /><br />";   if(($getid-1) <= 0) { // if id in link is less than or equal to 0   echo "Previous Image"; // show just text   } else {   $id_prev = $getid-1; //otherwise, set variable   echo "<a href='/viewgallery.php?id=".$id_prev."'>Previous Image</a>"; // and show a link to previous image   }   echo " - "; // spacer between links   if(($getid+1) == $total_rows) { //if the id in link is more than total rows   echo "Next Image"; //show just normal text.. no link   } else {   $id_next = $getid+1; // otherwise, set variable   echo "<a href='/viewgallery.php?id=".$id_next."'>Next Image</a>"; //and provide a link to next image   }   echo "</div>"; // end center } else {   echo "No image verfied"; } ?>[/code] Also, I just noticed you're not always having a numerical order - like you start at 5, there isn't a 15, etc. Which, my code will work, but you're going to be cutting off a few images at the end and it will show the images that aren't there -- I recommend just making your table be numerical order. Or, if somebody else would like to post some code showing how to do it another way ;)
  3. Whoops, change those lines (19-21) to this: [code] <?php $sql = "SELECT * FROM gallery WHERE id = $getid"; $result = mysql_query($sql); $total_rows = mysql_num_rows($result); // find out how many rows are in that table, see what the max number is ?>[/code]
  4. [code]<?php echo "<object width='300' height='80'> <param name='movie' value='http://media.imeem.com/m/aDM9gnYGM_/aus=false/'></param> <param name='wmmode' value='transparent'></param> <embed src='http://media.imeem.com/m/aDM9gnYGM_/aus=false/' type='application/x-shockwave-flash' width='300' height='80' wmode='transparent'></embed> </object>"; ?>[/code]
  5. This should work (it has been a while since I've done some coding, so let me know if I made a mistake somewhere) [code] <style type="text/css"> .greentext { color: #2a8f3d; margin: 4px; font-family: Tahoma; font-size: 19px; } .blacktext { color: #000000; margin: 4px; font-family: Tahoma; font-size: 11px; } </style> <?php include 'db.php'; $getid = $_GET['id']; $sql = "SELECT * FROM gallery WHERE id = $getid"; $result = mysql_query($sql); $total_rows = mysql_num_rows($sql); // find out how many rows are in that table, see what the max number is while ($row = mysql_fetch_array($result)) { $picture = $row['picture']; $heading = $row['heading']; $description = $row['description']; } $sql2 = "SELECT id FROM gallery WHERE id > $id LIMIT 1"; $result2 = mysql_query($sql2); while ($row = mysql_fetch_array($result)) { $id = $row['id']; } if ($getid == "$id") { echo "<div align='center'>   <div class=\"greentext\"><b>$heading</b></div>   <div class=\"blacktext\">$description</div><br />   <img src=\"images/$picture\" style=\"border: 2px solid #d4cccc;\"><br /><br />";   if(($getid-1) <= 0) { // if id in link is less than or equal to 0   echo "Previous Image"; // show just text   } else {   $id_prev = $getid-1; //otherwise, set variable   echo "<a href='/viewgallery.php?id=".$id_prev."'>Previous Image</a>"; // and show a link to previous image   }   echo " - "; // spacer between links   if(($getid+1) > $total_rows) { //if the id in link is more than total rows   echo "Next Image"; //show just normal text.. no link   } else {   $id_next = $getid+1; // otherwise, set variable   echo "<a href='/viewgallery.php?id=".$id_next."'>Next Image</a>"; //and provide a link to next image   }   echo "</div>"; // end center } else {   echo "No image verfied"; } ?>[/code] [i]edited to make it easier to read the code - ACK I forgot a semicolon.. sorry![/i]
  6. However with the post above, you will want to have an if statement checking to see if there is that photo in the DB. Ex: click on it more than once and you could get  id=-1
  7. Use mod rewrite in the .htaccess file http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html
  8. In the contact form there sure is a big space between the text describing what the textbox is about, and the actual text box. (FF2)
  9. Look at the way fert did it in the post I linked to. It doesn't replace words.
  10. This seems to be a popular topic today - matching variables in an array. http://www.phpfreaks.com/forums/index.php/topic,116097.0.html might help ;)
  11. [code]<?php $url='http://www.mysite.com/activate.php?hash='.md5($_POST['password']).’&stamp=’.base64_encode($t); ?>[/code] Look at ’&stamp=’ (on line 27) - use normal single quotes Fixed: [code]<?php include("config.php"); mysql_select_db($dbname) or die ("Could not select database because ".mysql_error()); // check if the username is taken $check = "select id from users where username = '".$_POST['username']."';"; $qry = mysql_query($check) or die ("Could not match data because ".mysql_error()); $num_rows = mysql_num_rows($qry); if ($num_rows != 0) { echo "Sorry, that username $username is already taken.<br>"; echo "<a href=/signup.php>Try again</a>"; exit; } else { $t= time(); // insert the data $insert = mysql_query("insert into users values ('".$_POST['username']."', '".$_POST['password']."','','1', '".$_POST['avatar']."', '".$_POST['email']."', '0','$t', '".$_POST['age']."', '".$_POST['location']."', '".$_POST['clan']."', '".$_POST['website']."', '".$_POST['about']."')") or die("Could not insert data because ".mysql_error()); $url='http://www.mysite.com/activate.php?hash='.md5($_POST['password']).'&stamp='.base64_encode($t); $to = $_POST['email']; $subject = "Account Activation"; $message = "Hello! This is a simple email message."; $from = "webmaster@clan.com"; $headers = "From: $from"; mail($to,$subject,$message,$headers); echo "Your user account has been created!<br>"; echo "An activation email has been sent to " .$_POST['email']. "<BR>"; } ?>[/code]
  12. If you are wanting to format them into something else, why not use preg_replace? Ahh, I see what you're asking. See post below for a better answer - sorry.
  13. use [ code] CODE HERE (use <?php ?> tags) [ /code ] without the spaces in the [ ] tags
  14. [quote]Well the delete page works perfectly fine, but when I click edit I get the default Internal server error.[/quote] Please post the code where you have the link to the edit page.
  15. Here is a list of all (but 6 zipcodes) and their longitude and latitude: http://www.cfdynamics.com/cfdynamics/zipbase/index.cfm You could make a PHP script to insert it into the DB pretty easily. Or, if you are a little more lazy (like myself) there is a pre-made script here: http://www.micahcarrick.com/v2/content/view/4/3/ (click download zipcode-1.2.0.zip)
  16. Try using a Security Image.
  17. Eyesoute: -The hover over color could use a little tweaking... There is no blue anywhere else on the site, but that isn't a big thing. -Where you have "+ Home" I would make that a link and post it to a page that showed something from all of the links in that category (if that makes sense.)
  18. From what I understand: It will keep it an integer (number) until there is a letter. After the letter, it will not echo anything. If there are no numbers, it will show a 0 [code]<?php   $mystring = "1c2234234a3";   $myinteger = (integer)$mystring; echo $myinteger; ?>[/code] Will output: 1 [code]<?php   $mystring = "12234234a3";   $myinteger = (integer)$mystring; echo $myinteger; ?>[/code] Will output: 12234234 [code]<?php   $mystring = "abc";   $myinteger = (integer)$mystring; echo $myinteger; ?>[/code] Will output: 0
  19. `entry_date` datetime default NULL If you want it to be in 'Date: 2006-11-20 & Time: 05:17:52' format, with text and other numbers you need to make it a varchar(33) instead of datetime
  20. Taken from: http://www.phpfreaks.com/mysqlref/12.php [code]UPDATE $dbtable SET u-last-login='$s_datetime', u-logins='$u-logins' WHERE u-id='$u_id'[/code] [i]Edit: changed underscores to hyphens for viewing purposes[/i]
  21. $date = "Date: " . date('y-m-d'). " & Time: ". date('h:i:s');
  22. Thats what happens when you type a tad too fast ;)
  23. If that is your actual code... it's because you have 2 different variables: $newID $newId (notice the D's are different)
  24. Try: [code] $someInt = rand(10000, 90000); $stuff = "whatever blah blah blah " . $someInt . " more blah blah blahs"; echo($stuff);[/code] although it works fine with me as well.
  25. Not a problem :) I'm pretty familiar with SMF boards :D
×
×
  • 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.