unique situation, fopen, mysql can't be called

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default unique situation, fopen, mysql can't be called

    Hi

    I've run some tests and I have to conclude that
    mysql and fopen doesn't work when you call it in this way.

    I don't understand why, it's got to be either one of 2 things:
    a) this just can't be done, and I'm ignorant of why
    b) there is a workaround and/or i'm doing this the wrong way

    Hopefully someone can enlighten me?

    Here's the situation:

    HTML PAGE
    img src=script1.php

    SCRIPT1.PHP
    //redirects to script2.php
    header(Location: $urltoscript2)

    SCRIPT2.PHP
    //writing to a file doesn't work
    //writing to a table in mysql doesn't work
    header(Location: $urltoimage)

    Information can be passed via query string from the
    html page to script1, to script 2, and the image
    does get displayed, but mysql and writing
    to a file just won't work unless you call script2 directly.

    I have tested this in the following way:

    1) I tried accessing the html page which displays img src,
    script2.php didn't write to mysql as intended

    2) I tried accessing script1.php directly,
    script2.php didn't write to mysql as intended

    3) I tried accessing script2.php directly,
    script2.php DID write to mysql successfully

    Same goes for writing to a file.

    How can I make this work?
    Any ideas?

    Thanks for your time.




    Jonah Guest

  2. Similar Questions and Discussions

    1. Unique Form inserting into many tables using unique id
      I have a Registration Form that have 3 steps. The data could be inserted into many (4) tables. Some data corresponding to a one table (the main or...
    2. #39868 [NEW]: Destructor is called allthought constructor is never called
      From: jb at ez dot no Operating system: Kubuntu 6.10 PHP version: 5.2.0 PHP Bug Type: *General Issues Bug description: ...
    3. #39678 [Opn->Bgs]: __set and __get not called where a class attribute is called statically
      ID: 39678 Updated by: tony2001@php.net Reported By: denis at edistar dot com -Status: Open +Status: ...
    4. #39678 [NEW]: __set and __get not called where a class attribute is called statically
      From: denis at edistar dot com Operating system: Linux PHP version: 5.2.0 PHP Bug Type: Scripting Engine problem Bug...
    5. In a desparate situation
      :confused;I am a Volunteer with The Safe Animal Shelter of Orange Park Florida - a non profit "No Kill" shelter for Cats and Dogs. We have a...
  3. #2

    Default Re: unique situation, fopen, mysql can't be called

    "Jonah" <nomail@nomail.com> wrote in message
    news:BFQjc.716$k%.21186@news20.bellglobal.com...
    > Hi
    >
    > I've run some tests and I have to conclude that
    > mysql and fopen doesn't work when you call it in this way.
    >
    > I don't understand why, it's got to be either one of 2 things:
    > a) this just can't be done, and I'm ignorant of why
    > b) there is a workaround and/or i'm doing this the wrong way
    >
    > Hopefully someone can enlighten me?
    >
    > Here's the situation:
    >
    > HTML PAGE
    > img src=script1.php
    >
    > SCRIPT1.PHP
    > file://redirects to script2.php
    > header(Location: $urltoscript2)
    >
    > SCRIPT2.PHP
    > file://writing to a file doesn't work
    > file://writing to a table in mysql doesn't work
    > header(Location: $urltoimage)
    >
    > Information can be passed via query string from the
    > html page to script1, to script 2, and the image
    > does get displayed, but mysql and writing
    > to a file just won't work unless you call script2 directly.
    >
    > I have tested this in the following way:
    >
    > 1) I tried accessing the html page which displays img src,
    > script2.php didn't write to mysql as intended
    >
    > 2) I tried accessing script1.php directly,
    > script2.php didn't write to mysql as intended
    >
    > 3) I tried accessing script2.php directly,
    > script2.php DID write to mysql successfully
    >
    > Same goes for writing to a file.
    >
    > How can I make this work?
    > Any ideas?
    >
    > Thanks for your time.
    Post actual code demonstrating the problem. There is nothing in this message
    that could be used to provide an answer. It would have to be based solely
    upon speculation and assumption.

    - virgil


    Virgil Green Guest

  4. #3

    Default Re: unique situation, fopen, mysql can't be called

    >
    > Post actual code demonstrating the problem. There is nothing in this
    > message that could be used to provide an answer. It would have to be
    > based solely upon speculation and assumption.
    >
    > - virgil
    >

    Hi Virgil

    Thanks for your help.

    Ok here's the code.
    This works when I call the script directly, it doesn't
    when I call it from another script.

    I just realized, is it perhaps because of require?

    SCRIPT2.PHP - RELEVANT CODE

    require "config.php";

    extract($_REQUEST);

    if ($afftrack)
    {
    $campaignID = mysql_fetch_row(mysql_query("select ID from campaigns where
    adcode='$c'"));
    mysql_query("insert into sales
    values('','$campaignID[0]','$s',now(),'$value','$id','$name','$description' )
    ");
    }



    Jonah Guest

  5. #4

    Default Re: unique situation, fopen, mysql can't be called

    "Jonah" <nomail@nomail.com> wrote in message
    news:ggZjc.37222$OU.857644@news20.bellglobal.com.. .
    > >
    > > Post actual code demonstrating the problem. There is nothing in this
    > > message that could be used to provide an answer. It would have to be
    > > based solely upon speculation and assumption.
    > >
    > > - virgil
    > >
    >
    >
    > Hi Virgil
    >
    > Thanks for your help.
    >
    > Ok here's the code.
    > This works when I call the script directly, it doesn't
    > when I call it from another script.
    >
    > I just realized, is it perhaps because of require?
    >
    > SCRIPT2.PHP - RELEVANT CODE
    >
    > require "config.php";
    >
    > extract($_REQUEST);
    >
    > if ($afftrack)
    > {
    > $campaignID = mysql_fetch_row(mysql_query("select ID from campaigns where
    > adcode='$c'"));
    > mysql_query("insert into sales
    >
    values('','$campaignID[0]','$s',now(),'$value','$id','$name','$description' )
    > ");
    > }
    There is nothing there that I can put on a server and test. We have
    absolutely no idea what you mean by "calling" one script from the other. You
    need to post the actual code of an html page, a first script and a second
    script that are complete and executable in a new environment. Even though we
    might not take the step to run it in a test environment, having the complete
    code along with an explanation of expected results and of the reasons why it
    is believed to have failed will allow us to help you.

    - Virgil


    Virgil Green Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139