Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2003
    Location
    New Zealand
    Posts
    9

    Question Unanswered: Import Data from SQL Help!!!

    view.php?cat=12&id=123
    where cat is the table name and id is the column

    I need view.php to show the contents of the column stated in the ID string.
    so cat = 12, the table named 12
    and if = 123, the column named 123

    I need it to take all the data in that column and print it on the page in the area where I put the code. Help appreciated

  2. #2
    Join Date
    Jul 2003
    Location
    New Zealand
    Posts
    9
    Man, this forum is useless. I posted this on www.OxyScripts.com/Forums
    and got a reply straight away.

  3. #3
    Join Date
    Oct 2003
    Posts
    16

    Re: Import Data from SQL Help!!!

    Originally posted by Scrowler
    view.php?cat=12&id=123
    where cat is the table name and id is the column

    I need view.php to show the contents of the column stated in the ID string.
    so cat = 12, the table named 12
    and if = 123, the column named 123

    I need it to take all the data in that column and print it on the page in the area where I put the code. Help appreciated
    PHP Code:
    <ol>
    <?
     $connect_string
    ="username:userpass@server";
     
    $query="select $HTTP_POST_VARS[column] from $HTTP_POST_VARS[cat] where id=$HTTP_POST_VARS[id]";

    $db=mysql_connect($connect_string,"database")
    if (
    $res=$mysql_query($db,$query))

     while (
    $row=$mysql_fetch_row($res))
     {
       echo 
    "<LI>".$row[0]; 
     }
     
    mysql_free_results($res);
    }
    mysql_close($db);
    ?>
    </ol>
    Hope that helps.

    Chris
    PS, that Oxyclean site was taken down. Bite Site, Inc provides a A SQL Tutorial though.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •