Jump to content

spiderwell

Members
  • Posts

    1,008
  • Joined

  • Last visited

Posts posted by spiderwell

  1. you could use a JOIN query in SQL but that would give you multiple entries for profile id,

     

    personally i would do it it with 2 loops

     

    so loop through all profiles, and inside that loop, loop through all interests against the profile id

    
    function get_profile($id) {
       $connection = mysql_open();
       $query = "SELECT * ";
       $query .= "FROM profiles";
      $result = @ mysql_query($query, $connection);
       // Transform the result set to an array (for Smarty)
       $entries = array();
       while ($row = mysql_fetch_array($result)) {
          $sql2 = "SELECT * FROM interests WHERE profile_id = " . $row['id'] . ";";
       }
       mysql_close($connection) or show_error();;
       return $entries;   
    }
    
    

     

    *DISCLAIMER* i havent checked this code but its just to show you what I meant :)

  2.  

     

    And I've been told I can set up a cron job to run the randomization script once a week to changg the order again. (not sure if this is sort of what you meant spiderwell)

     

     

    Once again, Cheers for the help

     

    maybe, I not sure i know what a cron job is, but event is created on the mysql database and is a bit of SQL that is trigger at times you specify it for example:

     

    CREATE EVENT `myevent`
    ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 DAY
      ON COMPLETION PRESERVE 
    DO 
    
    UPDATE `mytable` 
    SET `myfield` = NULL;
    
    

    this sets a column to null once a day.

     

    events usually drop after execution the on preserve bit means it doesnt drop the event once executed, so will run daily

     

    find out more here http://dev.mysql.com/doc/refman/5.1/en/create-event.html

     

  3. php self would work, but that wil stop working at some point if the querystring changes, why not do a substring check for the filename , thus avoiding the querystring.

     

    
    <li><a href="gallery.php?category=Wedding" id="wedding" <?php if (substr($currentPage ,'gallery.php')) {echo 'class="selected"';} ?>>Wedding Hair</a></li>   
    

  4. perhaps if you used activeX? im not sure really, but maybe also a link to where you expect windows explorere to be:

    <a href="c:/windows/explorer.exe">clicky</a>
    

     

    if it works in browser why not use that

  5. the variable is only defined if this statement is true, i think

     

    if($results = mysql_num_rows($sql_query) != 0)
    

     

    and im a bit confused by that statement in itself anyways, what are you trying to do here exactly?

  6. everytime you use the header file you are implicitly setting the Session userid to 0, i wouldnt bother to do this, its either going to be filled with the users ID or not exist (ie login has failed)

    in effect you are logging them out on every call of a page with the htmlheader.php included in it

    just do:

    <?php
    if(!isset($_SESSION)){
    session_start();
    }
    

    then put the whole login script into an if statement that only triggers if form is posted.

  7. mmmmm

    ok blobs are binary large object, essentially what an image is if its stored into a db, alternatively images can be just saved on the server in a folder.

     

    first off you should build a search form, that posts to a results page (or itself)

    then pull the information from the form, and take that to put into your mySQL search statement.

    then parse the results accordingly

    roughly something like this:

     

    $search = $_POST['searchinput']

     

    $sql = "SELECT * FROM Tbl_BLah WHERE `Something` LIKE '%$search';"

     

    //i skip now to results loop, assume $row is my dataset aray

    echo "<img src='" . $row['image'] . "'>";

    echo "<a href='details.php?id=" . $row['id'] . "'>Click for more info</a>";

    echo "<br>" . $row['smalldescription'] ;

  8. I not sure I folow what you are after, do you want a link that links via FTP instead of http?

    Not sure where a form would come into that.

    Do you want a link that goes to a website and then that website requires you to login to it?

  9. don't listen to your friend or anyone when it comes to how hard coding is, I find its different for everyone learning, and for me, PHP was VERY easy to learn, picked it up in about a week, but thats with a background of scripting in ASP for many years. For me, its all down to logic, and if you remember that its pretty easy really.

    THe problem I have I dont know half the commands available in PHP, and am probably missing some great little features.

    Also when i have 2 tables that share a unique ID, i tend to make the second table with an ordinary incrementing ID as the primary key and another column with the foreign key (although I am very bad at actually making it a foreign key, i just name it user_ID or something that indicates its an ID from another table)

     

    oh and everytihng I have ever learnt in code has pretty much come via google!! I bought the odd book years ago when I first started out, but the rest is just out there waiting to be discovered

  10. if the relationship between tables is 1 to 1, is there really any need to have a second table? thats what i am thinking now, that said maybe its more efficient to have a small table for logging in.......  :shrug:

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