Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by khanahk

  1. If you want to do it in-line with the PHP, which isn't generally good practice, you can change $sDayMSG = "Happy Anniversary!"; to $sDayMSG = '<span style="color: #FF0000;">Happy Anniversary!</span>'; Otherwise do what these other folks are talking about
  2. Hello, I can make a browser window pop up in Firefox with my fancy web programming skills... ..but I can't make Firefox. This bothers me and I want to dominate the realm of offline programming (some would say 'real programming', no?). Where do I start? C++? This is what I believe I should do... Any resources/advise will be most helpful Thanks
  3. khanahk

    PHP Includes

    There was a typo in that PHP snippet: ')' was missing to close off the condition in the if statement; it should be <?php function create_nav($active) { $nav = ''; if ($active == 'home') { $nav .= '<li class="active">';} else $nav .= '<li>';} $nav .= '<a href="#">Home</a></li>'; if ($active == 'about') { $nav .= '<li class="active">'; } else { $nav .= '<li>'; } $nav .= '<a href="#">About</a></li>'; if ($active == 'contact') { $nav .= '<li class="active">'; } else { $nav .= '<li>'; } $nav .= '<a href="#">Contact</a></li>'; return $nav; } echo create_nav('home'); ?>
  4. The error there says your classid is 'obsolete', meaning whatever plugin that would normally play your video/other media likely will not now. You need a 'new' classid. You can search what the HTML5 classid is for the plugin you want to use; or If you upload your video (if it is a video), to youtube, they will provide you a code snippet to embed your video in a webpage, and it should work that way.
  5. khanahk

    PHP Includes

    It's hard to tell what you're actually going for without seeing your code. Can you post a snippet of all this in action? In any case, I have achieved what I believe you're going for using purely HTML and CSS before.. You can assign each page on your website associated with a nav link a <body class="page1"> and so on, and in the navigation PHP include file simply assign an identifying class to each of your links, like <ul class="nav"> <li><a class="page1" href="page1.php">page1</a></li> <li><a class="page2" href="page2.php">page2</a></li> <li><a class="page3" href="page3.php">page3</a></li> </ul> And then create the CSS rules in your stylesheet: a {color: black;} /* default link color */ /* change link to red if we're on that page */ body.page1 a.page1 { color: red; } body.page2 a.page2 { color: red; } body.page3 a.page3 { color: red; } ---- If you REALLY want to do it by dynamically assigning a class to the nav link, you'll need jQuery's .addClass() and .removeClass(). But you may want to keep it simple
  6. LSW - Freelance is all I do at this point; online applications and websites for family and friends, and people connected to me by that route. I'm not 'pro' enough for the big-shots. I checked out Eclipse and my general feeling is... I don't have any idea how to use this. It's made for Java and I haven't even touched that realm yet -- although I would like to and plan to. I guess getting the PHP plugin for Eclipse would help but I feel the interface is too advanced for me at this point. There are many terms I don't know and such. Dreamweaver seems a bit simpler altogether. All the same I am still kind of stuck in the decision making; I figure I'll just keep learning code and not waste time learning some software. The former is more valuable to me (and truly ought to be to the professionals). Meanwhile I finish a degree in Environmental Sciences...arg. Thanks for the comments
  7. I'm not sure about the nature of your error. Is $salt properly defined in the class? Also, is $Database properly defined? WAMP's 'PHP Strict' errors are unlikely to cause problems on a live site (I believe, anyways). You may find that there are no errors if you put this stuff online. WAMP server is pretty picky and will complain about an 'undefined index' for something like $_POST[stuff] instead of $_POST['stuff'] , which live web host servers are fine with (as they should be..)
  8. .Politics[value=""] { /*nuff said*/ }
  9. Very much appreciated, from you both. Agreed that it's better to 'preview' in the real browsers. I did not realize i could DL a trial of DW CS6, I think I'll try that. And take a look at Eclipse. Thanks again
  10. I like Coda but I use a PC, not a Mac. I currently have Dreamweaver 8, which is ancient. Questions: 1. Is Coda available for PC? 2. Does DW CS6 offer the same functionality as I see in Ben's videos (i.e. does the preview option WORK with php and other programming langugages, instead of previewing it in my browser all the time? I don't even use the DW8 preview) 3. Any other recommendations for a PC IDE? I've done some research but I want to hear the praise/disgust from people, not the companies selling them. Thanks
  11. Kill the height=, width=, border= properties of your images in HTML and use CSS for them a img {border: 0px; height: 41px; width: 42px;} If that doesn't work, it may be because your file path for image contains spaces. This is a general no-no and you should rename the folder that contains them to not have spaces, i.e. /social-media-icons/
  12. It's been a while but perhaps this will help you. http://www.generateit.net/mod-rewrite/ It will generate the mod-rewrite code for your .htaccess file if you specify the old URL and where you want it to go now
  13. I found that a simple <pre> tag along with the use of the htmlspecialchars() PHP function did the trick quite well.
  14. Thanks Ben, for the concept (simple enough!). I found that var myvar = <?php echo json_encode($_SESSION['name']); ?>; is 'safer' for the 'PHP to JS' transfer...
  15. I'm not yet a JSON/AJAX master so I don't know how to do this. I need a $_SESSION['name'] PHP variable to work with in my jQuery stuff and I don't know how to access it... consider: // the 'who is typing' shindig $.ajax( { url: "whos_typing.html", cache: false, success: function(whos) { // here I need to access $_SESSION['name'] and do stuff with it $("#soandso").html(whos); //Insert who's typing into the #soandso div } });
  16. Just keep learning, and commit yourself to be kind to those below you when you become utterly awesome, unlike this guy. You are your own limit, not them, no? So keep chugging if this is what you like to do and delete that guy's account/comment from your blog. Pride is foolishness I'm not a big fan of Wordpress although I am practically obliged to learn it.. What is 'professional' anyways? Who cares? If you can get the job done, and done well, that is all that matters, and everyone knows it. So learn to get the job done, and done well, and you will be valued for it.
  17. I am building a forum from scratch. I have a textarea, just like the one you're about to type in. I want to 'keep' the new lines from user input to be displayed later, as they are about to be kept when I submit this topic. I have tried $stuff = nl2br($_POST['user_input']);
  18. Found the fix: $myvalue = mysql_real_escape_string(A user's input. It contains one or more apostrophes or quote marks.); $query = "INSERT INTO mytable VALUES('', '$myvalue')";
  19. Greetings, I am trying to reconcile the following reality: $query = "INSERT INTO mytable VALUES('', 'A user's input. It contains one or more apostrophes or quote marks.')"; This, clearly, is a problem and I don't know how to reconcile it. This forum clearly has reconciled it. Consider my apostrophes and quote marks: ''' "" "' ' '"!! Thanks!
  20. Ben, You are most helpful...! the following now works to render every row within the specified SQL selection function renderTopics($cat) { global $Database; $query = "SELECT * FROM topics WHERE category = '$cat'"; $result = $Database->query($query); while ($row = $result->fetch_array(MYSQLI_BOTH)) { do { print $row['name']."-----".$row['poster']."------".$row['category']."---".$row['created_date']."<br />"; } while ($Database->next_result()); } $result->free(); $Database->close(); } Thanks
  21. This is currently not working but may help you understand what I'm going for: function renderTopics($cat) { global $Database; if ($stmt = $Database->prepare("SELECT * FROM topics WHERE category = ?")) { $stmt->bind_param("s", $cat); $stmt->execute(); $stmt->store_result(); $array = $stmt->store_result(); while ($row = $array->fetch_row()) { printf("%s\n", $row[0]); } } else { die("Could not prepare MySQLi statement."); } }
  22. I've got function renderTopics($cat) { global $Database; if ($stmt = $Database->prepare("SELECT * FROM topics WHERE category = ?"); { $stmt->bind_param("s", $cat); $stmt->execute(); $stmt->store_result(); } else { die("Could not prepare MySQLi statement."); } } The question is... how do I access the results?! How can I set it to an array or whathaveyou? Thanks
  23. Ah! No, looks like your problem is this: $page_set = mysql_query("SELECT * FROM pages WHERE subject_id= {$subject["id"]}", $connection); I could be wrong, but I believe $page_set = mysql_query("SELECT * FROM pages WHERE subject_id= {$subject['id']}", $connection); will fix it
  • Create New...