Web Hosting Forums

Results 1 to 4 of 4

This is a discussion on Simple Question in the Hosting Talk & Chit-chat forum
Hi i was wondering In perl you can use something like a Subruitin where you pass the perl script in the URL a something like ...

  1. #1
    Histerical, absolute
    Join Date
    Aug 2002
    Posts
    1,233

    Simple Question

    Hi i was wondering
    In perl you can use something like a Subruitin where you pass the perl script in the URL a something like a location
    Like

    http://www.domainname.com/cgi-bin/sc...thing=gallery1

    and what it will do is look at the perl script and then look for da gallery1 part in the script.. i was just wondering how do you do that in PHP??

    i would like to have just one script for the intire gallery
    not for viewing the pictures but for viewing the pages with the thumb nails..

    do ya get me?
    All opinions are the result of being uninformed, unintelligent and uninterested!

  2. #2
    Histerical, absolute
    Join Date
    Aug 2002
    Posts
    1,233
    never mind i answerd me own Question!
    All opinions are the result of being uninformed, unintelligent and uninterested!

  3. #3
    Histerical, absolute
    Join Date
    Aug 2002
    Posts
    1,233
    K now i got a question that i cant answer my self
    k this is what i want to do
    i put in the URL to a perl script with a veriable
    like
    http://rick.zacrifice.com/test/urltest.php?image=1 (Opps i got da URL wrong) now that gets the text out of the database which i want.. but now i need to do another thing
    i want to take that 1 from the veriable and use that to call an image called 1.jpg so how would i do that?? i dont want to hard code it becouse i want it to be dynamic so when someone called image=2 they get the text from the database with ID 2 and the image called 2.jpg. . get what i mean??
    anywho heres the PHP script i made ..

    PHP Code:
    <?php 
         $hostname 
    "localhost";
         
    $user "********";
         
    $password "********";
         
    $db "********";
         
    $image "select imagedata from imagedata where id = $image";
         
    $count 0;

    mysql_connect($hostname$user$password);
    mysql_select_db($db);
    $result mysql_query($image);
    while(list(
    $imagedata) = mysql_fetch_row($result))
    {
      print(
    "$imagedata");
      exit;
    }

    ?>
    Oh kewl i just found that PHP syntax button.. how kewl!
    All opinions are the result of being uninformed, unintelligent and uninterested!

  4. #4
    Histerical, absolute
    Join Date
    Aug 2002
    Posts
    1,233
    Gawd i just got it and it was SOOOOOOO easy..
    all i had to do was add a id to da script and it worked!!!

    so insted of looking like this

    PHP Code:
    <?php 
         $hostname 
    "localhost";
         
    $user "********";
         
    $password "********";
         
    $db "********";
         
    $image "select imagedata from imagedata where id = $image";
         
    $count 0;

    mysql_connect($hostname$user$password);
    mysql_select_db($db);
    $result mysql_query($image);
    while(list(
    $imagedata) = mysql_fetch_row($result))
    {
      print(
    "$imagedata");
      exit;
    }

    ?>
    and changing it thusly

    PHP Code:
    <?php 
         $hostname 
    "localhost";
         
    $user "********";
         
    $password "********";
         
    $db "********";
         
    $image "select imagedata, id from imagedata where id = $image";
         
    $count 0;

    mysql_connect($hostname$user$password);
    mysql_select_db($db);
    $result mysql_query($image);
    while(list(
    $imagedata$id) = mysql_fetch_row($result))
    {
      print(
    "$imagedata <img src=\"$id.jpg\"> ");
      exit;
    }

    ?>
    and the number you pass the script will look at the ID number in the batabase and will call the image the ID number..

    Damn that was Easy.. i been frustraded all day couse of that and no one answer.. ah well.. i got it now
    All opinions are the result of being uninformed, unintelligent and uninterested!

Bookmarks

Posting Permissions

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