By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,729 Members | 1,386 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,729 IT Pros & Developers. It's quick & easy.

unique situation, fopen, mysql can't be called

P: n/a
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.


Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Jonah" <no****@nomail.com> wrote in message
news:BF****************@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
Jul 17 '05 #2

P: n/a
>
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' )
");
}

Jul 17 '05 #3

P: n/a
"Jonah" <no****@nomail.com> wrote in message
news:gg*******************@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
Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.