Jump to content

sKunKbad

Members
  • Posts

    1,832
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by sKunKbad

  1. I inherited some code which contains this button: <a href="checkout.php"><button type="button" name="checkout" value="Checkout">Checkout</button></a> which is inside a form, and the form has a regular submit button too, which is used to update the quantities of products in the shopping cart. This second button/hyperlink does not validate, but in order to make the page look good it has to stay where it is. Normally I'd just place it inside its own form tags, but I don't think it will validate to have a form inside a form. Any ideas?
  2. Well... I don't see any reason why it must be in the script, so I just commented it out.
  3. I have a php4 script that uses date_default_timezone_set('GMT'); and I need the php4 equivalent because I'm converting the script to php4. Here is the script: // Set the time zone: date_default_timezone_set('GMT'); // Check for form submission. if (isset($_POST['submitted'])) { // Validate the credit card... // Check the expiration date: $year = (int) $_POST['cc_exp_year']; $month = (int) $_POST['cc_exp_month']; // Get the current date: $today = getdate(); // Validate the expiration date: if ( ($year > $today['year']) OR ( ($year == $today['year']) AND ($month >= $today['mon']) ) ) { // Include the class definition: require ('Validate/Finance/CreditCard.php'); // Create the object: $cc = new Validate_Finance_CreditCard(); // Validate the card number and type: if ($cc->number($_POST['cc_number'], $_POST['cc_type'])) { // Use XXX to process the order!!! // If payment goes through, complete the order! echo '<p>Your order is complete (but not really).</p>'; include_once ('./includes/footer.html'); exit(); } else { // Invalid card number or type. echo '<p class="error">Please enter a valid credit card number and type.</p>'; } } else { // Invalid date. echo '<p class="error">Please enter a valid expiration date.</p>'; } }
  4. I solved it. For reference in case anybody else has a similar problem, here is the converted SELECT statement: SELECT name, category, scent, size FROM general_widgets LEFT JOIN specific_widgets ON ( general_widgets.gw_id = specific_widgets.gw_id ) LEFT JOIN scents ON ( specific_widgets.scent_id = scents.scent_id ) LEFT JOIN sizes ON ( specific_widgets.size_id = sizes.size_id ) LEFT JOIN categories ON ( general_widgets.category_id = categories.category_id ) WHERE specific_widgets.sw_id = 1
  5. I have a newer WAMP5 install on my computer, and the script I'm using works fine, but when I upload the script to the destination server, which has MySQL version 4.1.12, it doesn't work. It's hurting my head at this point, so I'm hoping for some help converting it to a select statement that will work. Here it is: SELECT name, category, scent, size FROM general_widgets LEFT JOIN specific_widgets USING (gw_id) LEFT JOIN scents USING (scent_id) LEFT JOIN sizes USING (size_id) LEFT JOIN categories USING (category_id) WHERE sw_id=1
  6. I've made (with some help from a good book) a nice shopping cart, but I need a way to check the customers out. I've never done this before, and hoping for some advice, tutorials, helpful words of encouragement... because I know nothing and can prove it.
  7. You will still need some pics, but this is code I made a while back that does what you want: style.css #rotater { border-right: #b9b8b2 1px solid; border-top: #b9b8b2 1px solid; font-size: 12px; border-left: #b9b8b2 1px solid; width: 443px; border-bottom: #b9b8b2 1px solid; font-family: Arial, sans-serif; position: relative; height: 200px;} #rotater a img { border-right: #b9b8b2 1px solid; left: 0px; border-top-style: none; border-left-style: none; position: absolute; TOP: 0px; border-bottom-style: none;} #rotater div { left: 161px; overflow: hidden; width: 282px; position: absolute; top: 0px; height: 200px;} #rotater div a { color: #2967c3;} #rotater ul { padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px; list-style-type: none;} #rotater ul li { border-right: #b9b8b2 1px solid; border-top: #b9b8b2 1px solid; display: block; margin: -1px 0px 0px -1px; overflow: hidden; border-left: #b9b8b2 1px solid; width: 282px; border-bottom: #b9b8b2 1px solid;} * > html #rotater ul li { margin-bottom: -2px; height: 22px;} #rotater ul li a { display: block; padding-left: 22px; font-weight: bold; background: url(img/headline-bg.gif) no-repeat left 50%; width: 100%; padding-top: 4px; height: 18px; text-decoration: none;} * html #rotater ul li a { margin-top: 0px; overflow: hidden; width: 284px;} #rotater ul li a:hover { background: url(img/headline-bg-hover.gif) no-repeat left 50%; color: white;} #rotater p { padding-right: 2px; padding-left: 4px; left: 0px; padding-bottom: 2px; margin: 0px; width: 276px; padding-top: 2px; position: absolute; top: 138px; height: 100%; background-color: #fefefe;} * html #rotater p { width: 280px;} #rotater p a { font-size: 11px; width: 100%; color: black; height: 100%; text-decoration: none;} rotation.js <!-- window.onload = startRotation; function focusLink (n) { for (i = 0; i < numPics; i++) { if (i == n) { rotaterPics[i].style.zIndex = '1'; rotaterDescriptions[i].style.zIndex = '1'; rotaterListLinks[i].style.background = 'url(img/headline-bg-hover.gif) left no-repeat'; rotaterListLinks[i].style.color = 'white'; } else { rotaterPics[i].style.zIndex = '0'; rotaterDescriptions[i].style.zIndex = '0'; rotaterListLinks[i].style.background = 'url(img/headline-bg.gif) left no-repeat'; rotaterListLinks[i].style.color = '#2967c2'; } } } function rotateLink () { focusLink(currentLink); currentLink = (currentLink + 1) % numPics; rotaterTimer = setTimeout("rotateLink()", 3000); } function mouseoverRotater (n) { clearTimeout(rotaterTimer); focusLink(n - 1); } function mouseoutRotater (n) { currentLink = n - 1; clearTimeout(rotaterTimer); rotaterTimer = setTimeout("rotateLink()", 3000) } function startRotation () { var completeRotater = document.getElementById('rotater'); var rotaterList = completeRotater.getElementsByTagName('ul'); rotaterPics = completeRotater.getElementsByTagName('img'); rotaterDescriptions = completeRotater.getElementsByTagName('p'); rotaterListLinks = rotaterList[0].getElementsByTagName('a'); numPics = rotaterPics.length; currentLink = 0; rotateLink(); } --> rotation.htm <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>news rotation test</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" type="text/css" href="style.css" /> <script type="text/javascript" src="rotation.js"></script> </head> <body> <div class="leftColtopstories"> <div id="rotater"> <a href="http://www.whateverlink001.com"><img style="z-index: 1" height="200" alt="alt text for 001 pic" src="img/picone.jpg" width="160" /></a> <a href="http://www.whateverlink002.com"><img height="200" alt="alt text for 002 pic" src="img/pictwo.jpg" width="160" /></a> <a href="http://www.whateverlink003.com"><img height="200" alt="alt text for 003 pic" src="img/picthree.jpg" width="160" /></a> <a href="http://www.whateverlink004.com"><img height="200" alt="alt text for 004 pic" src="img/picfour.jpg" width="160" /></a> <a href="http://www.whateverlink005.com"><img height="200" alt="alt text for 005 pic" src="img/picfive.jpg" width="160" /></a> <a href="http://www.whateverlink006.com"><img height="200" alt="alt text for 006 pic" src="img/picsix.jpg" width="160" /></a> <div> <ul> <li><a onmouseover="mouseoverRotater(1)" onmouseout="mouseoutRotater(1)" href="http://www.whateverlink001.com">Headline number 1</a></li> <li><a onmouseover="mouseoverRotater(2)" onmouseout="mouseoutRotater(2)" href="http://www.whateverlink002.com">Headline number 2</a></li> <li><a onmouseover="mouseoverRotater(3)" onmouseout="mouseoutRotater(3)" href="http://www.whateverlink003.com">Headline number 3</a></li> <li><a onmouseover="mouseoverRotater(4)" onmouseout="mouseoutRotater(4)" href="http://www.whateverlink004.com">Headline number 4</a></li> <li><a onmouseover="mouseoverRotater(5)" onmouseout="mouseoutRotater(5)" href="http://www.whateverlink005.com">Headline number 5</a></li> <li><a onmouseover="mouseoverRotater(6)" onmouseout="mouseoutRotater(6)" href="http://www.whateverlink006.com">Headline number 6</a></li> </ul> <p style="z-index: 1"><a onmouseover="mouseoverRotater(1)" onmouseout="mouseoutRotater(1)" href="http://www.whateverlink001.com">This is the descriptive paragraph / link for headline 1.</a></p> <p><a onmouseover="mouseoverRotater(2)" onmouseout="mouseoutRotater(2)" href="http://www.whateverlink002.com">This is the descriptive paragraph / link for headline 2.</a></p> <p><a onmouseover="mouseoverRotater(3)" onmouseout="mouseoutRotater(3)" href="http://www.whateverlink003.com">This is the descriptive paragraph / link for headline 3.</a></p> <p><a onmouseover="mouseoverRotater(4)" onmouseout="mouseoutRotater(4)" href="http://www.whateverlink004.com">This is the descriptive paragraph / link for headline 4.</a></p> <p><a onmouseover="mouseoverRotater(5)" onmouseout="mouseoutRotater(5)" href="http://www.whateverlink005.com">This is the descriptive paragraph / link for headline 5.</a></p> <p><a onmouseover="mouseoverRotater(6)" onmouseout="mouseoutRotater(6)" href="http://www.whateverlink006.com">This is the descriptive paragraph / link for headline 6.</a></p> </div> </div> </div> </body> </html>
  8. where is your semi-colon after display:block ?
  9. I just use link. Not all browsers support CSS, and I think that is why some people use @import, but I think if somebody is using an old browser they get what they deserve.
  10. border-left border-right border-top border-bottom those are your choices... you can't just do it with border by itself.
  11. try giving each th a class and then apply your style through the stylesheet <th class="myTableHeader">
  12. try #quickCalendar tr th { text-align:center; } by the way, where are your table tags?
  13. also, #columnMiddle has no float declared.
  14. #columnMiddle{width:30%; height:auto; margin:0 35% 0 35%;} do you mean 5% for the margin on the left and right?
  15. display:inline fixes an IE6 bug that occurs when floated divs have margins or padding. IE6 can double the padding or margin in some cases, which obviously breaks the layout. I think the rule is, if the div is floated left, and the padding or margin is on the left, then it will be doubled. Remembering this is one of the keys to making cross browser designs work.
  16. I've got a while loop that outputs the last 3 tips in a tipsntricks table, and I'd like to do something only for the first row. You can see there is a image in this while loop called anew.gif, and I only want it to be there for the first row(first pass through the loop). I only want to have to query the database one time, so I'm not interested in a solution with multiple queries (I already have one). I'm just doing this to learn MySQL better, but I'm stuck on this. Here's the code: <?php $thisBlurb = mysql_query("SELECT tipTitle, tipCode, tipNum FROM tipsntricks ORDER BY tipNum DESC LIMIT 3"); $color1 = "#f0e8fe"; $color2 = "#E9F3FB"; while($i = mysql_fetch_row($thisBlurb)) { $row_color = ($i['2'] % 2) ? $color1 : $color2; echo "<div style='width:420px; background-color:$row_color; border-top:dotted #567ACE 4px; padding:10px;'>"; echo "<h3 class='h2like'>"; echo "<img src='/img/wnew/anew.gif' alt='NEW! NEW! NEW!'/> "; //this is the image that I only want output once. echo "<a style='text-decoration:none;' href='/tips/".$i['2'].".php5'>".$i['0']."</a></h3>"; $blurb = preg_split('/<!--blurb split here-->/',$i['1'],-1); echo " {$blurb['0']} <p><a style='text-decoration:none;' /tips/".$i['2'].".php5'><span style='font-weight:bold'>Show me more...</span></a></p></div>"; } ?>
  17. I have posted (multiple times) how to do this using cURL. Browse through my posts and find it.
  18. Google determines, I think based on popularity of your site and possibly other factors, if they include this list of pages. They specifically state that you have no control over this. There is no setting, meta tag, or prepaid service that will do this for you. see this article http://www.eioba.com/a69763/what_are_google_sitelinks_a_delux_listing_in_googles_search_results
  19. add display:inline; to #main
  20. Cookies Sessions (which include special session cookies)
  21. if the number of html validation errors and warnings on your home page (299errors/4warnings) is any indication of how clean your php is, then you might have a bug or two in there. I picked up four cookies on your site. You might double check that any cookies or sessions are started before any HTML or even a closing ?> tag.
  22. Ya know, not showing everyone what you did to fix this doesn't help people in the future who may have the same question. In my case, when using PDO with multiple queries, I always had to make sure that at the end of each query the object was deleted. For instance: $pdo1 = $pdo->query("SELECT * FROM tipsntricks WHERE tipNum = '$tipPage'"); $picRow = $pdo1->fetch(PDO::FETCH_ASSOC); extract($picRow); echo " <title>Tips & Tricks - Tip # {$_GET['tip']} - $tipTitle</title> <meta name='description' content='$tipBlurb' />"; $pdo1 = null; //HERE $pdo5 = $pdo->prepare("SELECT * FROM tipsntricks WHERE tipType = '$tipCat' ORDER BY tipNum DESC"); $pdo5->execute(); $num_rows = count($pdo5->fetchAll()); if ($num_rows != 0){ echo " <li class='prodcat'><h3>" . ucfirst($tipCat) . "</h3> <ul>"; foreach ($pdo->query("SELECT * FROM tipsntricks WHERE tipType = '$tipCat' ORDER BY tipNum DESC") as $row) { echo "<li><a href='http://www.whatever.tv/tips/". $row['tipNum'] . ".php5'>" . $row['tipTitle'] . " </a></li>"; } echo " </ul> </li>"; } $pdo5 = null; //HERE
  23. Why not just use php's built in PDO class?
  24. all of his/her code uses short tags, so it must be set that way.
×
×
  • 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.