Jump to content

CyrusTh3VIrus

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Posts posted by CyrusTh3VIrus

  1. Okej, im sorry if i wasent so clear what i want. I want to make system that stores dynamic information in the database that isent table specific. So if i want to make lets say a guestbook with that system insted of creating a table i want to fetch the guestbook data from different tables. Like this:

    function postReply($name, $msg, $date) {
    $id = make some uniq id here...
    mysql_query("INSET INTO textVars(id,fieldname,value) values('".$id."','gb_name','".$name."')");
    mysql_query("INSET INTO textVars(id,fieldname,value) values('".$id."','gb_msg','".$msg."')");
    mysql_query("INSET INTO dateVars(id,fieldname,value) values('".$id."',''gb_date'','".$date."')");
    }

    What im trying to say is that i dont want to store data thats table specific.
    So if i want to fetch a gb reply ill use this function:

    function fetchReply($id) {
    $data = array();
    $data['id'] = $id;
    $data['name'] = fetch row from textVars WHERE id=$id AND fieldname='gb_name'
    $data['msg'] = fetch row from textVars WHERE id=$id AND fieldname='gb_msg'
    ... and so on
    return $data;
    }

    Im wondering if this would make a big performance hit or if it would not so big and im also wondering if ther any better way to fetch data from differnt tables. I hope you understand what im trying to ask.
  2. Lets say that i want to get a array of values from a database, like:
    $sql = mysql_query(SELECT id, c1, c2, c3 FROM table WHERE id=1);
    $result = mysql_fetch_assoc($sql);

    But how much performance hit would it be to get the values from different tables like this:
    $result['id'] = query and get ID
    $result['c1'] = query and get c1
    ... and so on

    Would that make a big performance hit, i know it would make a performance hit but would that a be a big performance hit? And also would it be faster to make sub querys in SQL rather than make a query for each value and is there any better way to acomplish this?

    Sorry for my bad english.
×
×
  • 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.