Jump to content

jeremywesselman

Members
  • Posts

    154
  • Joined

  • Last visited

    Never

Posts posted by jeremywesselman

  1. You need to drill down through the multi-dimensional array.

     

    echo $response['_raw_data'][3]

     

    Just use the array keys to get their values. I'll let you get the avg because I can't really tell the path to it.

     

    EDIT: I tried to review, but pressed the button too quickly :)

     

    Jeremy

  2. Pseudocode yes. But I wouldn't sit there and write down the whole program. Unless it was a simple script and I wasn't near a computer. But even then I don't think I'd write the whole thing out.

     

    And like you mentioned, double the work.

     

    Jeremy

  3. I read through all the posts and didn't see e so I'll throw it out there.

    [url=http://www.e-texteditor.com/]http://www.e-texteditor.com/[/url]

    It's very similar to Textmate, so if you use Windows you have an alternative. It will edit pretty much anything. I use it for Rails development mostly.

    Jeremy

  4. It happens everytime I start to help.  How do you think I got over 3000 posts.

     

     

    Wasn't it through asking about 100 questions per day? Might not have been that many but it seemed like it.

     

    I was thinking the same thing...

  5. id int NOT NULL AUTO_INCREMENT PRIMARY KEY
    user_id int NOT NULL
    image_name varchar(50) NOT NULL
    caption varchar(100)

     

    Ok. You'll have the normal 'id' field. The 'user_id' field is the id of the user to which the image belongs.

     

    Then the 'image_name' field. It depends on how you set up your directory. Some people throw them all in one directory and some others set up each member with their own folder under the 'images' directory to keep them kind of organized. However you set it up, when you are linking to the image in HTML, you'll be able to insert the path there and just pull the image name from the table. And if you want to give the user their own folder, you'll be able to throw their username in the path there as well.

     

    Then there is the optional 'caption' field for holding a little description of the pic.

     

    You'll need a separate table for the ratings.

     

    id int NOT NULL AUTO_INCREMENT PRIMARY KEY
    image_id int NOT NULL
    rating int NOT NULL

     

    The id field will keep track of the ratings. The image_id field is the id of the image that has been rated. And the rating of course will be the rating, however you set them up.

     

    There might be better ways to do it, but this is what I came up with in a few minutes.

     

    Jeremy

  6. <?php
    session_start();
          require("config.php");
          require("functions.php"); 
    ?>
    <table border="0">
      <tr>
        <td>Welcome, <?php echo $_SESSION['s_name']; ?></td>
      </tr>
      <tr>
        <td>You are logged in as <?php echo $_SESSION['s_username']; ?></td>
      </tr>
      <tr>
        <td> </td>
      </tr>
      <tr>
        <td><a href="members.php">Members</a></td>
      </tr>
      <tr>
        <td><a href="inbox.php">Inbox</a>
    
    <?php
    $message = mysql_query("SELECT COUNT(*) FROM myPMs WHERE opened != 'y' AND to_id = '{$_SESSION['s_id']}'") or die ("My SQL Error: <br />". mysql_error());
                    $msgs = mysql_fetch_array($message);
    
    if ($msgs['COUNT(*)'] > 0) {
      // News Msgs Found
      echo "<img src=\"images/envelope.gif\" />";
    	}
    ?>
    
     </td>
      </tr>
      <tr>
        <td><a href="edit_profile.php">My Profile</a></td>
      </tr>
      <tr>
        <td><a href="logout.php">Logout</a></td>
      </tr>
    </table>
    

     

    You're hopping in and out of php and html. Here is your script fixed like it should be. If you are going to use php to echo stuff, you have to echo ALL the HTML, not just the link.

     

    Jeremy

  7. You need to declare the $messageAry global inside your function to access it outside of your function.

     

    function showImg($filename) {
    global $messageAry;
    if($filename != "") {
    $jpg = $filename;
    $messageAry['title'] = "woohoo, we have an image";
    } else {
    $jpg = "default.jpg";
    $messageAry['title'] = "no image found";
    }
    
    return $jpg;
    } // end function

     

    Jeremy

  8. $pageviewquery = mysql_query("SELECT * FROM pageviews WHERE pageuserid='45'");
    
    $result = mysql_fetch_array($pageviewquery);
    echo $result;
    
    if ($result == FALSE) {
    echo "query is false";
    }
    else {
    echo "query is not false";
    }

     

    You need to use mysql_fetch_array() to get the results. Otherwise, it is returning a Resource Id.

     

    Jeremy

  9. <?php
    $week = date("W");
    
    if ($week<"14") {
    echo '[<a href="#" onclick="window.open(\'year3/1_10.php\', \'mywindow\', \'width=500,height=350,resizable=no\');"><font color=#808000>First Quarter</font></a>]';
    }
    
    else {
    
    echo '<a href="#" onclick="window.open(\'year3/1_10.php\', \'mywindow\', \'width=500,height=350,resizable=no\');"><font color=#808000>First Quarter</font></a>' ;
    }
    ?>

     

    That is one way you can do it.

     

    Another:

     

    <?php
    $week = date("W");
    
    if ($week<"14"): ?>
    
    [<a href="#" onclick="window.open('year3/1_10.php', 'mywindow', 'width=500,height=350,resizable=no');"><font color=#808000>First Quarter</font></a>]
    
    <?php else: ?>
    <a href="#" onclick="window.open('year3/1_10.php', 'mywindow', 'width=500,height=350,resizable=no');"><font color=#808000>First Quarter</font></a>
    <?php endif;
    ?>

  10. You could use mod_rewrite for Apache. You can take your URL, http://kilbad.com/index.php?id=photos&album=general, and turn it into something like: http://kilbad.com/photos/general/

    Here is a link to get you started with the basics.

    http://www.yourhtmlsource.com/sitemanagement/urlrewriting.html

    There are other resources on the right column of the page to get you further if needed.

    Jeremy
  11. [code]if (isset($HTTP_GET_VARS['delete'])){
    $sql = "DELETE FROM web_announcements WHERE id=$id";
    $result = mysql_query($sql);
            /*********************/
            if($result)
            {
                echo"The announcement has successfully been removed.<br><br>- <a href=./acp.php>Back</a>";
            }
            /********************/
    }
    if (isset($HTTP_GET_VARS['announce2'])){
    echo"You are now ready to either remove or edit an announcement, please select your options below.<hr color=#990000>";
    $query = "SELECT * FROM web_announcements";
    $result = mysql_query($query);
      while ($results = mysql_fetch_array($result)){
      extract($results);
      echo"- $title (<a href=>EDIT</a>)/(<a href=$PHP_SELF?delete&id=$id>DELETE</a>)<br>";
    }
    }[/code]

    You need to add another if statement to check if $result returns true or false. Then you can display the success message.

    [color=maroon]Jeremy[/color]
  12. Have you looked at the tutorial here at phpfreaks?

    [url=http://www.phpfreaks.com/tutorials/85/0.php]http://www.phpfreaks.com/tutorials/85/0.php[/url]

    It is tutorial on a file upload class with file extension validation, getting sizes and many other things.

    [color=maroon]Jeremy[/color]
  13. That is what the '*' does. If you only wanted to select 'id' and 'name', your query would look like this:

    [CODE]SELECT id, name FROM table WHERE status = 1[/CODE]

    So if you want to pull all columns, use *. The 'WHERE' clause lets you specify certain information about your results.
×
×
  • 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.