Jump to content

l0gic

Members
  • Posts

    110
  • Joined

  • Last visited

Posts posted by l0gic

  1. Welcome to the world of PHP.

     

    The mysql -extension is outdated perhaps consider using Mysqli or PDO.

     

    Other than that, one of your problems will be here:

    $select_posts = "select * from posts order by rand() LIMIT 0,2";
    $run_posts = mysql_query($select_post);
    
    Where you use $select_posts and then $select_post, probably a typo but it'll stop the SQL from being run.. Same thing applies to $run_posts and then $run_post. So double check all your variable names to make sure you have them right.
     
    As a tip, when you're constructing your SQL try to capitalise keywords for better readability, i.e.
    $select_posts = "SELECT * FROM posts ORDER BY RAND() LIMIT 0,2";
    

    Edit: Try this:

    <?
    include("includes/connect.php");
    $select_posts = "SELECT * FROM posts ORDER BY RAND() LIMIT 0,2";
    $run_posts = mysql_query($select_posts);
    
    while($row=mysql_fetch_array($run_posts)) {
        $title = $row['post_title'];
        $date = $row['post_date'];
        $author = $row['post_author'];
        $image = $row['post_image'];
        $content = substr($row['post_content'],0,200);
    }
    ?>
    
    <h2><?php echo $title; ?></h2>
    
  2. Not to be pedantic, but the point of a donation is that it's not compulsory. If you require someone to give you money in exchange for something (be it product, service, access or anything else) then it's no longer a donation, but a fee.

     

    I only mention this because that's how the tax people are going to look at it, and they will be expecting a cut, or else proof of exemption.

     

    I would agree to with this, though maybe it's simply allowing donating users/members to see a "Thank you for donating." or "Your donation history." type of page.

     

    The link posted by DenRomano should make for a good starting point.

  3. My plan was to frame expandable pictures in the navigation bar, but I simply do not have any. Suggestions? Maybe make a few sites for free?

    Make some templates, or mock-ups and fill them out with lorem ipsum and 'your company name/logo here' graphics, use them until you have something to replace them with. Even then simple templates could be kept and re-used for many basic websites.

     

    Just work on your design skills. When transitioning from tables to div and CSS, I spent many (freaken many) hours replicating magazine covers as websites. Sounds easy, eh? Give it a go, learn by doing and practice, practice, practice.

     

    Edit: Some spelling, typed up on iPad. Go me.

  4. echo "alert('Product successfully added')";
    ..or..

    echo "alert('Product successfully added')";
    Bit of spot the difference, might not be your current problem though.

     

     

    Eh, it took script tags out..

     

    echo "<script>alert('Product successfully added'</script>)";

     

    echo "<script>alert('Product successfully added')</script>";

  5. Then you're in the wrong place. This is not 1-on-1 tutoring, this is a help forum. We're not teachers. We are other programmers. If you want teaching, go to school. If you have a specific bug and you've already tried to fix it, this is the place.

     

    Perhaps slightly off-topic. But I love it when you unleash your sass on these people... It honestly warms my heart.

     

     

    @ShivaGupta; I'm sorry but if you followed KevinM1s link and have become no closer to understanding how to achieve what it is that your're after (which about 90% of the first page of results covers quite well) I have trouble believing that any of our comments will ever be of any use to you.. But if you seriously want to make an effort to learn things, may I suggest starting with this book.

  6. Unless you have set your session.auto_start directive to 1, then you'll need to start/resume the session at the top of each desired page using the session_start() function.

     

    You don't seem to be using that function on your page.

     

    Also, on closer inspection: (line 22)

    if(!isset($_SESSION['assignment_id'])) ($id = $_SESSION['assignment_id']){
    

    Doesn't look right? Try something like:

    if(!isset($_SESSION['assignment_id']) && $id = $_SESSION['assignment_id']){
  7. What.. The..?

     

    Do you mean you have two PCs ( PC-A and PC-B ) neither of them are the Server ( hosting the PHP ) but both are connecting to the Server where the run Whatever.PHP and PC-A shows different results to PC-B?

     

    If so, due to PHP being a server-side programming language ( meaning it runs all code and logic on the Server ) neither PC-A nor PC-B will have any effect on the PHP being run, so they cannot be playing havoc with loops, or anything else as that's all taken care of by the Server before either PC would see any results.

     

    So, if this is the case. And at-least one PC is showing as working correctly then you have an issue on any PC where it isn't showing the correct results.

     

    Which opens up millions of possibilities.

  8. $sql = 'SELECT * FROM table WHERE WEEK(birthdate) = WEEK(DATE_ADD(NOW(), INTERVAL 7 DAY)) AND WEEK(birthdate) = WEEK(DATE_ADD(NOW(), INTERVAL -7 DAY))';

     

    AND.... OR?

     

    This week can't be this week and next week, and even last week can it?

     

    I guess it could be this week or next week, or even last week.

  9. It's been awhile but I'm pretty sure you could also use .htaccess to only allow access to the directory from a certain referrer.

     

    For example, allow access from ..yoursite/viewpic.php where the viewpic.php checks login status, and if all conditions are met redirects you to the image passed via GET/Query which you will be able to see because your referrer is viewpic.php if conditions are not met in viewpic.php, redirect to a 'you need to be logged in to view images' page/error.

     

    So then if you had the image testpic01.jpg you would link to it such as ..href="path/to/viewpic.php?p=testpic01&f=jpg".. 'p' being the filename, 'f' being the format/extension.

     

    I'm pretty sure you could also display images on a page using something similar to this method, and of course it could be used to 'protect' any file-type.

     

    RewriteEngine On
    RewriteCond %{HTTP_REFERER} !(www.)?example.com/viewpic.php
    RewriteRule .* - [F]
    

     

    Something like ^that anyway.

     

    See Here: http://www.hongkiat.com/blog/smarter-way-to-prevent-image-hotlinking-with-htaccess/

  10. How did you manage to 'build'.. or rather manage to copy and paste things you found through Google and get them as working as the rest of your website is?

     

    I should imagine, that whoever adapted the technology used on that flash-eye-candy Home page should be able to at least make the design you're looking for on your Order page, that bit shouldn't bee to hard judging by what's been made so far. The behind the scenes I imagine you're stuck with, integrating PayPal, or a shopping cart of some sort. What have you tried so far?

     

    P.S.

    Oh man.. That is a huge 404!

    http://www.squarewithafro.com/errordocs/404.jpg

    Caution: Not Dial-up Friendly!

    (7441x3508 2.84MB JPG)

  11. I think I understand, and I'd try using (or loading the database results into) a multidimensional array.

     

    Thinking:

    array(
      array( Product => "Product 1", 
             Version => 1
      ),
      array( Product => "Product 2",
             Version => 2
      ),
      array( Product => "Product 3",
             Version => 1
      ),
      array( Product => "Product 4",
             Version => 1
      )
    );
    

     

     

    And looping through the array using conditionals to obtain desired results?

     

    This would allow you to pick out certain products, or certain versions.

     

    However I may not actually understand your post, as, if you had the the products and the versions listed in your database, then aren't you already set-up to do what you want?

  12. I have a feeling that's not the actual code you're using and trying to figure out. Which doesn't help us to help you.

     

    For what you've posted, your example. You'd be better off not even using PHP as I don't see any looping, any real data or value modification.

     

    Why don't you post the code that you're actually having an issue with? That way we can help you a lot more, believe it or not most of us understand poorly constructed code better than poorly written English round-a-bout or near-enough questions.

     

    As to 'can you do it with Javascript' well, I'm not entirely sure what you're trying to do.

     

    In closing:

    Post the code you're having an issue with.

    Post any errors, or describe what isn't working the way you want it to.

    Then we have a better chance of helping you.

  13. Two things..

     

    One: Don't be such an ass, Jessica doesn't have to help you at all. She's a very nice and helpful person on these forums.

     

    Two: Jessica is right. You're not supplying an ID at all.

     

    <form action = "update.php" method = "post">

     

    Nothing being passed through the URL/Action/method that $_GET is used with, with is what you're using to try to 'get' the non-passed therefore non-existent ID.

     

    You can either change that to:

     

    <form action = "update.php?id=$row['id']" method = "post">

     

    Or add a hidden input like this:

     

    <input type="hidden" name="id" id="id" value=<?php echo $row['id']?> />

     

     

    Which pretty much sums up what Jessica hinted at. And please remember this is a 'help' forum, not a 'do it for you or suffer your wrath' forum.

     

    Edit: Forgot this forum uses CODE not PHP for code-blocks.

×
×
  • 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.