473,385 Members | 2,274 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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.


Jul 17 '05 #1
3 1559
"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
>
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: MrBoom | last post by:
Does using uniqid seem a reasonable way of generating a unique row identifyer in a db table? It's *highly* unlikely that two ids are going to be generated in the same microsecond, but if they are,...
5
by: Westcoast Sheri | last post by:
Which will be a faster lookup of an item by, "color" in the following mySQL tables: "unique key," "primary key," or just plain "key"?? CREATE TABLE myTable ( number int(11) NOT NULL default '0',...
0
by: Tanamon | last post by:
Hello All, I am a MySQL newbie trying to write a query that selects file_name records possessing the highest numbered version for that unique file_name. I show sample data and two trial queries...
0
by: Alec Smith | last post by:
I have two tables as below: CREATE TABLE domain_types ( type_id INT(4) NOT NULL AUTO_INCREMENT, name VARCHAR(10) UNIQUE NOT NULL, description VARCHAR(75), PRIMARY KEY(type_id) ) TYPE=INNODB...
0
by: Nils Valentin | last post by:
Hi Mysql fans ;-); I have a problem understanding why MySQL is deleting a unique key instead of a primary key. from Documentation: DROP PRIMARY KEY drops the primary index. If no such index...
5
by: Laphan | last post by:
Hi All I know you can set a row to be unique, but I want expand on this in that I want the DB schema to only disallow an entry if the row isn't unique across 3 fields. Is it possible? My DDL...
2
by: rootman | last post by:
Hi @all i try to create a ssh public key database on a mysql-5.0.16 DB the problem is the size of the varchar, i want a size 1024... mysql> create table sshkeys ( absid integer unsigned...
3
by: siyaverma | last post by:
i am trying to upload csv file from user's computer to main server the code i am using is if(((isset($_GET)) && ($_GET=="yes")) ) { $typefield = $_GET; echo...
2
by: srusskinyon | last post by:
I need some help getting unique records from our database! I work for a small non-profit homeless shelter. We keep track of guest information as well as what services we have offered for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.