Page 1 of 5 123 ... LastLast
Results 1 to 10 of 42

Thread: picture viewer

  1. #1
    Join Date
    Apr 2006
    Posts
    429
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool picture viewer

    Code:
    <?
    $query1 = "SELECT $uniquerow,  prev_path, filename FROM $tablename";
    $rs = mysql_query($query1);
    $randomId = array();
    while($row = mysql_fetch_array($rs))
      array_push($randomId, $row['id']);
    $randomId = $randomId[rand(0, count($randomId))]
    ?>
    <script>
    function populateSelect(selectobj){
    for (var i=0; i<randomId.length; i++)
    selectobj.options[selectobj.options.length]=new Option(randomId[i], randomID[i])
    if (selectobj.options.length>1){
    selectobj.selectedIndex=0
    showpicture(document.getElementById("picsform").picslist)}}</script>
    is the code possible? tnx.
    Last edited by jr_yeo; 07-31-2006 at 09:53 AM.
    Please don't mind me. I am just posting a lot of nonsense.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Er.... is WHAT possible?
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Apr 2006
    Posts
    429
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    the code that i just posted?
    Please don't mind me. I am just posting a lot of nonsense.

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Yes, you just posted code. Very possible.
    But, what, exactly, would you like to do with the code?
    If you've run it and there are problems, what are they? What would you like different? Etc.
    Or, is, perhaps, this simply an easier/smaller version of what is on the site?
    I didn't see the code there, so I'm not sure what specifically you are referring to.


    Note that:
    "Does this work?"
    and
    "How do you do this...?"
    are very different questions, though both do require more information.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. #5
    Join Date
    Apr 2006
    Posts
    429
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    on this link, the images are being read by using 'getpics.php'.
    now i have a database for images. i want to get images from the database and the resultset pass thru the script, something like:
    Code:
    <?
    $query1 = "SELECT $uniquerow,  prev_path, filename FROM $tablename";
    $rs = mysql_query($query1);
    $randomId = array();
    while($row = mysql_fetch_array($rs))
      array_push($randomId, $row['id']);
    $randomId = $randomId[rand(0, count($randomId))]
    ?>
    <script>
    function populateSelect(selectobj){
    for (var i=0; i<randomId.length; i++)
    selectobj.options[selectobj.options.length]=new Option(randomId[i], randomID[i])
    if (selectobj.options.length>1){
    selectobj.selectedIndex=0
    showpicture(document.getElementById("picsform").picslist)}}</script>
    the code betwen the <script></script> tags are just part of you will see in the link provided. how do i make this work?
    Please don't mind me. I am just posting a lot of nonsense.

  6. #6
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Ah, now we're getting somewhere.

    You've run it? What doesn't work?

    First... this is php, I think, right? Looks like it from the code, and the link... you don't have an open php tag; you need to start it <?php, not <?.
    Maybe that's the whole issue?

    Too tired right now to analyze the wholet thing.


    You will also need to output the values to the javascript, not just keep them in PHP.
    For exaple:
    <script>
    <?php echo "var = 'value';"; ?>
    </script>
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  7. #7
    Join Date
    Apr 2006
    Posts
    429
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    from what read somewhere in this forum, PHP and javascript dont mix very well. like oil and water
    Quote Originally Posted by djr33
    You've run it?,
    not yet. coz logically speaking, its correct. but script wise, i know m missing something. i just dunno what.
    Quote Originally Posted by djr33
    Too tired right now to analyze the wholet thing.
    sure np anytime ur batteries are recharged
    Last edited by jr_yeo; 07-31-2006 at 10:27 AM.
    Please don't mind me. I am just posting a lot of nonsense.

  8. #8
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    I am not a JS or a php guy, I am still trying to learn them myself... but if you are trying to access and pull images from the database, don't you need the host/user/password, etc to connect?
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  9. #9
    Join Date
    Apr 2006
    Posts
    429
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    don't you need the host/user/password, etc to connect?
    yupz but do i have to post that info here?
    Please don't mind me. I am just posting a lot of nonsense.

  10. #10
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    No, not expecting you too, LMAO... just making sure it was there is all. I usually XXXXX my info like that when I post. I just didn't see the spots for it, so I was just checking
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

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
  •