Jump to content

dfowler

Members
  • Posts

    223
  • Joined

  • Last visited

    Never

Everything posted by dfowler

  1. Thank you so much! I knew I was overlooking something. I always forget about the reserved words.
  2. Hey guys, I have a database of DVDs that I am building a CMS system to handle. I'm currently getting an error with an update statement that is built on the edit portion of the CMS. The table setup is as follow: Column Type Collation Attributes Null Default Extra id int(10) [/td] No None AUTO_INCREMENT title varchar(200) latin1_swedish_ci No year int(5) Yes NULL actors text latin1_swedish_ci Yes NULL genre text latin1_swedish_ci Yes NULL series varchar(200) latin1_swedish_ci Yes false order int(10) Yes 0 img_name varchar(200) latin1_swedish_ci Yes NULL img_location varchar(200) latin1_swedish_ci Yes NULL [td] Here is my statement: UPDATE dvds SET title='American Pie', year='1999', actors='Jason Biggs, Chris Klein, Thomas Ian Nicholas, Eddie Kaye Thomas, Seann William Scott, Alyson Hannigan, Tara Reid, Mena Suvri, Shannon Elizabeth, Natasha Lyonne, Eugene Levy, Molly Cheek, Chris Owen, Jennifer Coolidge, John Cho, James DeBello', genre='teen, comedy', series='American Pie', order='1' WHERE id='13' Here is the error I am seeing: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order='1' WHERE id='13'' at line 1 I have tried redoing the statement removing the quotes from the INT fields. However, still see the same error. I am 100% lost here as I can't see what is wrong at all. I'm sure I am just missing something. Thanks for any help!
  3. Here is what I ended up having to do: var theDate = new Date(); theDate.setTime(createdDate * 1000); var year = theDate.getUTCFullYear(); var month = theDate.getUTCMonth(); var day = theDate.getUTCDate(); var d = months[month] + " " + day + ", " + year; I created an array with the month names in it since getUTCMonth only returns a number. However, it works and gives me the output I need.
  4. That is pretty close, still has the day of the week in there and an abbreviated month. I will play around a bit though. Thanks for the starting point!
  5. Hey guys, I am needing to display the date of when an article was created on my site. I have a UTC string (and this is all I will ever have). So I added this to my page: var d = new Date(); d.setTime(createdDate *1000); Where createdDate is a UTC value like "1266870137". The problem is the out put from that looks somthing like this: Mon Feb 22 2010 15:22:17 GMT-0500 (Eastern Standard Time). I'm hoping to only end up with something like this: February 22, 2010 I would appreciate any help. I've spent quite a while googling and looking at w3schools. I'm just fried at this point. Thanks!
  6. No worries, I figured out a work around by just creating another cookie when the survey plays. Then check for that cookie on each page load. Thanks for all help guys!
  7. Well that was simple enough, but how do I get that to carry over across pages (if it is even possible)? Let me describe the showSurvey() function I have up there. The function hides the main content (display none) of the page, and creates a new div with the survey in it. Once a user clicks the 'submit' button the div with the survey goes away (using .remove) and the div with the main content comes back (display block). This is all done using javascript (jquery and such). Thanks to Crayon, I've tweaked the code so that when showSurvey() fires it places a hash tag in URL saying #survey. So if the user tries to refresh the code sees this hash tag and shows the survey. When they hit submit, I remove the tag from the url. Now, what if a user clicks a different link on the site? The page moves on and they can skip the survey. So my new question is (and I've been googling and can't find a way). How do I carry that #survey tag over whenever a link is clicked? Thanks for all the help so far guys!
  8. Thanks for the links! I was able to figure out the cookie logic I needed. Here are the functions I created/used: function getCookieData(cookieName) { var i,x,y,cookies=document.cookie.split(";"); for (i=0;i<cookies.length;i++) { x=cookies[i].substr(0,cookies[i].indexOf("=")); y=cookies[i].substr(cookies[i].indexOf("=")+1); x=x.replace(/^\s+|\s+$/g,""); if (x==cookieName){ return unescape(y); } } } function deleteCookie(cookieName) { document.cookie = cookieName + '=; expires=Thu, 01-Jan-70 00:00:01 GMT;'; } function checkCookies() { var metas = document.getElementsByTagName('meta'); var i; for (i = 0; i < metas.length; i++) { if (metas[i].getAttribute('name') == "pageTitle"){ break; } } var galleryTitle = metas[i].getAttribute('property'); if (document.cookie.indexOf('galleryName') != -1) { var gallery = getCookieData('galleryName'); if(gallery == galleryTitle) { var newValue = getCookieData('galleryViews') * 1 + 1; document.cookie = 'galleryViews=' + newValue; if(newValue/5 == 1) { showSurvey(); document.cookie = 'galleryViews=1'; } } else { showSurvey(); document.cookie = 'galleryName=' + galleryTitle; document.cookie = 'galleryViews=1'; } } else { showSurvey(); document.cookie = 'galleryName=' + galleryTitle; document.cookie = 'galleryViews=1'; } } My new question is this (which maybe I should create a new topic for). How would I temporarily change the document url to include a # pound sign and fictional anchor tag, so users can't refresh away from the survey readily? Thanks for any help!
  9. Hey guys, I have a website that I want to launch a survey popup after a user has cycled through a couple pages. My thought was to insert a cookie when they first hit the site, then increment the cookie by 1 on each page. Then when the cookie hits like 5 or something launch the javascript function I created to display the survey. Here is my problem, I have created the survey function and it works great. However, I don't know how to utilize cookies AT ALL (especially with how I want to use them with the incrementing and launching of function). I would love some help on this. Thanks!
  10. I ended up getting this to work, and the solution was fairly simple. <div id="navbar"> <ul id="nav"> <a href="#" class="hiddenNav">+/-</a> <a href="/" class="first">Home</a></li> <a href="/about">About</a></li> <a href="/archive">Archives</a></li> <a href="/contact">Contact</a></li> <a href="/feed/" class="rss">Subscribe to RSS</a> </ul> </div> <!-- GLOBAL NAV MENU --> <div class="hiddenNav"> <div class="globalNav" style="display:none;"> <script type="text/javascript"> writeTopGlobal_transition(); writeBotGlobal_transition(); </script> </div> </div> <script type="text/javascript"> $(function() { $('.hiddenNav').hover(function() { $('.globalNav').show(); }, function(){ $('.globalNav').delay(3000).hide(); }); }); </script>
  11. After some searching I found it myself; ended up using the waybackmachine. However, I found a couple of tutorials I was looking for.
  12. Hey guys, I am just starting to get into jQuery and I have run into a problem that is annoying the hell out of me. I have a menu with all the main options for the site. However, this site is part of a large network; so I need to include an option for the global nav for the network. The current menu for the site is so: <div id="navbar"> <ul id="nav"> <a href="/" class="first">Home</a></li> <a href="/about">About</a></li> <a href="/archive">Archives</a></li> <a href="/contact">Contact</a></li> <a href="/feed/" class="rss">Subscribe to RSS</a> </ul> </div> I didn't write this page, just going in to add the global nav. Anyway, I modified the menu as such and added the following under it: <div id="navbar"> <ul id="nav"> <a href="#" class="hiddenNav">+/-</a> <a href="/" class="first">Home</a></li> <a href="/about">About</a></li> <a href="/archive">Archives</a></li> <a href="/contact">Contact</a></li> <a href="/feed/" class="rss">Subscribe to RSS</a> </ul> </div> <!-- GLOBAL NAV MENU --> <div class="globalNav" style="display:none;"> <script type="text/javascript"> writeTopGlobal_transition(); writeBotGlobal_transition(); </script> </div> <script type="text/javascript"> $(function() { $('.hiddenNav').hover(function() { $('.globalNav').show(); }); $('.globalNav').hover(function() {}, function() { $('.globalNav').hide() }); }); </script> The two functions in hidden div basically do a document.write of the global nav (which is fairly extensive). Anyway, here is my issue. As you can probably guess with my code I want the global nav to appear when a user hovers over the "+/-" link in the main menu. Then I need it to stay active as long as they are over it. Currently, this works fine. The global nav goes away when they move their mouse off of it. However, during testing I noticed my issue. If you just hover over the "+/-" and never go to the global nav section it stays open. I need it to act much like a drop down in that if the user hovers over the "+/-" the nav shows up and if they move it goes away....unless they move to the nav where it should stay up until they move off of it. Thanks for any help here!
  13. I remember a few years ago there were some other tutorials listed on this site (ie. Creating a Membership system). Is there anyway to still view these tutorials? Or are they lost forever?
  14. I managed it correct this by switching the internal margin to padding. Still not sure why it was happening though. Thanks....
  15. Hey guys, I'm not a front end developer at all. However, I am trying to improve me ability with CSS. I am creating a simple nav menu that is showing up perfectly in IE, but not in FF. Here is the code for the page (nav is obvious I feel): <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <title>Welcome!</title> <link rel="stylesheet" href="css/style3.css" type="text/css" media="screen" charset="utf-8" /> </head> <body> <div id="main"> <div id="logo"> <img src="images/logo.png" style="float: left;" /> </div> <div class="clearer"></div> <div id="nav"> <div id="nav_links"> <a href="/">Home</a> | <a href="about.php">About</a> | <a href="contact.php">Contact</a> </div> </div> <div id="content"> <div id="title">Welcome!</div> <p> Content will go here... </p> </div> </div> </body> </html> Here is the style sheet: body { background: #AEAEAE url('/images/background.png'); color: #AEAEAE; font-family: Verdana, Tahoma, Helvetica, Arial; } p { margin: 1px 0px 1px 0px; } a { color: #00001f; text-decoration: none; } a:hover { color: #555555; text-decoration: underline; } #main { margin-left: auto; margin-right: auto; width: 600px; background-color: #ffffff; border: 10px solid #00001f; color: #000000; } #logo { margin: 0px 0px 0px 0px; width: 590px; background-color: #ffffff; } #nav { margin: 5px 0px 5px 0px; height: 50px; background: #ffffff url('/images/navbar.png') no-repeat right top; } #nav_links { margin: 15px 0px 0px 100px; } #content { margin-top: 5px; margin-left: auto; margin-right: auto; width: 590px; height: 300px; background-color: #ffffff; color: #000000; font-size: 14px; overflow: auto; } #title { margin: 1px 0px 1px 0px; color: #00001F; font-weight: bolder; font-size: 18px; } #pageTitle { float: left; } div.clearer { clear: both; } What I am really trying to do is get the "nav_links" to be centered vertically within the "nav" div. I tried margin-top and margin-bottom at both auto, what I have above, and nothing in FF works. It always look great in IE, however in FF is acts as if it is adding the margin to the main "nav" div and not the "nav_links" div. Thanks for any help!
  16. Good guess! I was putting ini_set('error_reporting', E_ALL); at the top of the pages. However, once I manually modified my dev system it showed an error I wasn't seeing before. Looks like everything is working now. Thanks for the help, sometimes it good to get a fresh approach!
  17. Just to clarify, I know that by going directly to that file it won't know the function. However, I have a separate page that utilizes a function on that page that won't load unless I comment out the reference. More details: step6.php includes system.php that I referenced on first post. step6.php calls sendServerEmail() which is defined in functions_mail.php sendServerEmail() is within an if statment if(isServer()) step6.php loaded a blank screen until I commented out the if in functions_mail.php
  18. What do you mean by recognising? Are you getting an undefined function error? Have you done a simple echo test i.e <?php if(!isServer()) { print "not my server"; exit(); } ?> On another note, remove the braces from return values! <?php function isServer() { if ($_SERVER['SERVER_NAME'] == 'myservername') { return true; } return false; } ?> Thanks for the recommendation. Yes, I have done a simple test and get the following: Fatal error: Call to undefined function isServer() in C:\server\wwwroot\includes\functions_mail.php on line 5
  19. Hey guys, I wrote a function called isServer() so I can quickly move files from my local machine to my server without modifying too much. The function is as follows: function isServer() { if ($_SERVER['SERVER_NAME'] == 'myservername') { return(true); } else { return(false); } } // isServer() I have placed this function in a system.php file I created that is used to simply to keep things in order. That files contents are: <?php session_start(); function isServer() { if ($_SERVER['SERVER_NAME'] == 'myservername') { return(true); } else { return(false); } } // isServer() include "configuration.php"; include "functions.php"; include "functions_sql.php"; include "functions_soap.php"; include "functions_mail.php"; if (isProductionServer()) { $dbhost = 'db'; $dbuser = 'db_user'; $dbpass = 'pass123'; } else { $dbhost = 'localhost'; $dbuser = 'user'; $dbpass = 'pass'; } $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'my_database'; mysql_select_db($dbname) or die ('Selected database does not exist'); ?> The problem I am having is for some reason none of the include files are recognizing the function. For example, the functions_mail.php file references the function to determine which emails to send (because the different environments have different modules and such installed). I know this is something easy, but I can't seem to figure it out. Thanks for any help!
  20. Oh, I know what solves the headers issue. It's the error message for the node issue. If that error wasn't being displayed the page would redirect with no problem. I'm just confused as to why it is displaying the error message for the 'node does not exist' when I am using an if(isset()). I could be wrong, but to me it seems the code is acting like this (on errors): [*]checks first if statement [*]throws and error because that node doesn't exists [*]because that node isn't set it goes to the else bracket [*]checks if statement for errorcode [*]the error code node isset so it sets the variable and tries to redirect [*]can't redirect because it shot out the error from the first if statement
  21. Hey guys, I'm having the most annoying time with a script I wrote. I am sending an XML call and then attempting to parse the results. In getting one of the variables I am using this: if(isset($response->CreateAccountResponse->Account->attributes()->ClientID)) { $ClientID = (string)$response->CreateAccountResponse->Account->attributes()->ClientID; } else { if (isset($response->CreateAccountResponse->Result->attributes()->ErrorCode)) { $error = (string)$response->CreateAccountResponse->Result->attributes()->ErrorCode; header("Location: error.php?id=".$error); } } This works 90% of the time. However, if there is an error during the process, I am getting this: Line 405 is the first if line (checking to see if the ID isset). Anybody understand why this is happening? Shouldn't it see that it doesn't exist and move to the else seamlessly? I don't understand why it is displaying an error before moving to the else block. I have no control of the error messaging on the server, so I can't turn that off. Thanks for any help!
  22. Hey guys, I need some help trying to get some debugging code setup. I have coded a set of soap calls that end up creating an account. It is taking a long time, and I was asked to include code to see how long each call is taking. I have no clue how to set this up. How do you determine how long each line of code is taking to load? Thanks for any help!
  23. The only problem I might see is on the page where I process the form. Here is the code for that: foreach($_POST['option'] as $k => $v) { if($v) { $_SESSION['option'][$k] = $_POST['option'][$k]; $_SESSION['desc'][$k] = $_POST['desc'][$k]; $query = "INSERT INTO customer_options ( firstName, lastName, customerID ) values ( '".addslashes($_POST['option'][$k])."', '".addslashes($_POST['desc'][$k])."', '".addslashes($_SESSION['customerID'])."' )"; $result = mysql_query($query) or die (mysql_error()); } } As you have pointed out, PHP is what I know. I pretty much do a lot of guessing with Javascript.
  24. I tried this, but it isn't working: for(i=1;i<11;i++) { if(option[i] != "") { if(document.form1.desc[i].value == "") { alert("Please fill out all required information."); document.form1.desc[i].focus(); return false; } } if(desc[i] != "") { if(document.form1.option[i].value == "") { alert("Please fill out all required information."); document.form1.option[i].focus(); return false; } } }
×
×
  • 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.