Ask a Question related to PHP Development, Design and Development.
-
Jonah #1
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
-
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... -
#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: ... -
#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: ... -
#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... -
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... -
Virgil Green #2
Re: unique situation, fopen, mysql can't be called
"Jonah" <nomail@nomail.com> wrote in message
news:BFQjc.716$k%.21186@news20.bellglobal.com...Post actual code demonstrating the problem. There is nothing in this message> 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.
that could be used to provide an answer. It would have to be based solely
upon speculation and assumption.
- virgil
Virgil Green Guest
-
Jonah #3
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
-
Virgil Green #4
Re: unique situation, fopen, mysql can't be called
"Jonah" <nomail@nomail.com> wrote in message
news:ggZjc.37222$OU.857644@news20.bellglobal.com.. .values('','$campaignID[0]','$s',now(),'$value','$id','$name','$description' )>> >
> > 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
>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



Reply With Quote

