473,326 Members | 2,111 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,326 software developers and data experts.

php scripts no longer working after upgrade

i recently upgraded from fedora core 5 to cent os 4.4 with php 4.3
mysql 4.1 and apache 2.0.52, and all of the php scripts i had which
called specific entries from mysql are no longer working

if i had a link display_story.php?id=334 it would know do display the
entry which matched id 334, my code to display the entry looks like
this

<?php
$Host="localhost";
$User="user";
$Password="password";
$DBName="database";

$Link=mysql_connect($Host, $User, $Password);
$Query="SELECT * from table WHERE sid=$id;
$Result=mysql_db_query($DBName,$Query, $Link);
while($Row=mysql_fetch_array($Result)){
print("<table width=\"500\">\n");
print("<tr>\n");
print("<td valign=\"bottom\">\n");
print("<p class=\"page_title\">$Row[title]\n");
print("<p>\n");
print("<i>$Row[hometext]</i>\n");
print("</td>\n");
print("<td>\n");
$Topimage=$Row[topic];
include 'top_image.php';
print("</td>\n");
print("</tr>\n");
print("</table>\n");
print("<p>\n");
print("$Row[bodytext]\n");
print("<div align=right><a href=\"javascript: history.go(-1)\">Back</
a></div></td>\n");
}
mysql_close($Link);
?>

the error message in my logs tell me that $Query="SELECT * from table
WHERE sid=$id; is the problem

[client 204.50.205.242] PHP Notice: Undefined variable: id in
**********
[client 204.50.205.242] PHP Warning: mysql_fetch_array(): supplied
argument is not a valid mysql result resource in
*************************** on line 10

i have tried turning on register_globals but the problem persists

any ideas on how i can fix this in php.ini without having to go and re-
write all of my scripts (i'm kind of lazy today)

thanks

Apr 2 '07 #1
11 1905
cw****@theatomicmoose.ca wrote:
i recently upgraded from fedora core 5 to cent os 4.4 with php 4.3
mysql 4.1 and apache 2.0.52, and all of the php scripts i had which
called specific entries from mysql are no longer working

if i had a link display_story.php?id=334 it would know do display the
entry which matched id 334, my code to display the entry looks like
this

<?php
$Host="localhost";
$User="user";
$Password="password";
$DBName="database";

$Link=mysql_connect($Host, $User, $Password);
$Query="SELECT * from table WHERE sid=$id;
$Result=mysql_db_query($DBName,$Query, $Link);
while($Row=mysql_fetch_array($Result)){
print("<table width=\"500\">\n");
print("<tr>\n");
print("<td valign=\"bottom\">\n");
print("<p class=\"page_title\">$Row[title]\n");
print("<p>\n");
print("<i>$Row[hometext]</i>\n");
print("</td>\n");
print("<td>\n");
$Topimage=$Row[topic];
include 'top_image.php';
print("</td>\n");
print("</tr>\n");
print("</table>\n");
print("<p>\n");
print("$Row[bodytext]\n");
print("<div align=right><a href=\"javascript: history.go(-1)\">Back</
a></div></td>\n");
}
mysql_close($Link);
?>

the error message in my logs tell me that $Query="SELECT * from table
WHERE sid=$id; is the problem

[client 204.50.205.242] PHP Notice: Undefined variable: id in
**********
[client 204.50.205.242] PHP Warning: mysql_fetch_array(): supplied
argument is not a valid mysql result resource in
*************************** on line 10

i have tried turning on register_globals but the problem persists

any ideas on how i can fix this in php.ini without having to go and re-
write all of my scripts (i'm kind of lazy today)

thanks
Hi,

Did you print out the POST and GET array?
Above your script:
echo "POST contains:<pre>";
print_r($_POST);
echo "</pre>";
echo "GET contains:<pre>";
print_r($_GET);
echo "</pre>";

If of them contain the id, then your script relies on registering globals.
If so, better fix that and get your data in the right way, with $_GET[] and
$_POST[] supergloabls.

If this is the case, I do NOT understand why enabling register_globals in
php.ini didn't fix it. Did you restart your IIS, or signal apache after
making changes into php.ini??

Regards,
Erwin Moller

Apr 3 '07 #2
cw****@theatomicmoose.ca wrote:
[snip]
>
i have tried turning on register_globals but the problem persists

any ideas on how i can fix this in php.ini without having to go and re-
write all of my scripts (i'm kind of lazy today)

thanks
Try popping a phpinfo() into the top of your script and checking
register_globals really is On, if not then something is not right in
configuration or its overridden somewhere (maybe a .htaccess)

OR

Do it properly and $id=$_GET["id"]; at the top of script

OR

Make your own function to create the vars and put this into an include
file to be included at top of your page, but a bit risky security
wise, something like (I write this straight into email so not tested):

autoreg.php

<?php
foreach($_GET AS $key=>$value) {
$$key=$value;
}
?>

test.php
<?php
require_once('autoreg.php');
if (isset($id)) echo "{$id}<br />";
if (isset($name)) echo "{$name}<br />";
?>

If you called this as myreg.php?id=1&name=Bob then it would print both
the $id value and $bob value, you'd need to amend autoreg.php to include
$_POST, $_SESSION etc. if you wanted and in the order you wanted as one
would override the other if the key existed in say $_GET and $_SESSION etc.

Personally, I'd write your code correctly for the newer PHP 5 standard
if you can ;-)
Apr 4 '07 #3
If you called this as myreg.php?id=1&name=Bob then it would print both
the $id value and $bob value, you'd need to amend autoreg.php to include
$_POST, $_SESSION etc. if you wanted and in the order you wanted as one
would override the other if the key existed in say $_GET and $_SESSION etc.
I meant test.php?id=1&name=Bob obviously. Oops.
Apr 4 '07 #4
off topic (or generally on topic throughout all groups):

Your client isn't properly configured. Please enter a real mail address to
enable people to contact you. If you are afraid of spam, you have the
possibility of creating an extra mail account just for your newsgroup
stuff. Also please give us your realname, so we know who we're talking to.

Thanks in advance.
Apr 4 '07 #5
Simon Stienen wrote:
off topic (or generally on topic throughout all groups):

Your client isn't properly configured. Please enter a real mail address to
enable people to contact you. If you are afraid of spam, you have the
possibility of creating an extra mail account just for your newsgroup
stuff. Also please give us your realname, so we know who we're talking to.

Thanks in advance.
Why?
Who cares what the real email of cwhite@atomicmoose... is?
If you have a response for him/her, you write it here like you did.

I know I won't publish my real emails here.

Regards,
Erwin Moller
Apr 4 '07 #6
Simon Stienen wrote:
off topic (or generally on topic throughout all groups):

Your client isn't properly configured. Please enter a real mail address to
enable people to contact you. If you are afraid of spam, you have the
possibility of creating an extra mail account just for your newsgroup
stuff. Also please give us your realname, so we know who we're talking to.

Thanks in advance.
I'm with Erwin. Although I have a munged email address here, I don't
check it often. Ask in a newsgroup, expect a response in a newsgroup.

If people want to contact me by email, fine. My normal hourly rates
apply, payable in advance.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Apr 4 '07 #7
On 2007-04-04 04-52-22, Erwin Moller wrote:
I know I won't publish my real emails here.
Instead, you're redirecting more spam to spamyourself.com since 2003. :P
Under this aspect, us**@example.com is better, since it's pointing to a
domain which is reserved by the DNS RFC. (Which I guess is not to his
credit, but to the one of the Thunderbird developers.)

Then again, you're at least giving us your name.

However - as every better Usenet netiquette should state - private answers
to the poster should not be posted as f'ups but as direct reply to the
poster. If there is no mail given, this is (obviously) not possible. If
someone doesn't want to be communicated with, he shouldn't post to NGs from
the beginning.

So *if* you're posting, you should make yourself contactable.

Besides: us**@example.com might just be new to this and need a shove into
the correct direction.
Apr 4 '07 #8
On 2007-04-04 05-16-18, Simon Stienen wrote:
So *if* you're posting, you should make yourself contactable.
Besides: If *you* were contactable by mail, we wouldn't need to have this
off topic discussion here. :]
Apr 4 '07 #9
X-noarchive: yes
Simon Stienen wrote:
off topic (or generally on topic throughout all groups):

Your client isn't properly configured. Please enter a real mail address to
enable people to contact you. If you are afraid of spam, you have the
possibility of creating an extra mail account just for your newsgroup
stuff. Also please give us your realname, so we know who we're talking to.

Thanks in advance.
I'm also with Erwin, and Jerry. For several reasons I don't even use my
real name here (none of them related to what I post on usenet). If that
is a problem, feel free to PLOINK me. I never (uhh, well once, right
Erwin, Jerry?) abused that relative anonimity on usenet, all my postings
are meant sincere, and mostly if not all on topic.

Personally I don't care a lot what name people post under. And I tried
using a real email address once, and still get a gazillion spam messages
a day related to that faux-pas.

My IP address has always been the same, and I don't mind. So with a
little handiwork you probably can find my real identity. Feel free.

You may even find my ip has once been abused by someone (I know his real
name and addy now), for a hate-posting addressed at himself hoping to be
able to pin it on me. My ISP, the police and myself still can only guess
how the perp managed to use their servers and my ip without having
access (to my knowledge) to my home or adsl line. He keeps denying btw.

If you ever feel the need to email me, just tell me and I'll gladly send
you a valid address.

Sh.
Apr 4 '07 #10
Simon Stienen wrote:
On 2007-04-04 04-52-22, Erwin Moller wrote:
>I know I won't publish my real emails here.

Instead, you're redirecting more spam to spamyourself.com since 2003. :P
Under this aspect, us**@example.com is better, since it's pointing to a
domain which is reserved by the DNS RFC. (Which I guess is not to his
credit, but to the one of the Thunderbird developers.)
Quite true.
Then again, you're at least giving us your name.

However - as every better Usenet netiquette should state - private answers
to the poster should not be posted as f'ups but as direct reply to the
poster. If there is no mail given, this is (obviously) not possible. If
someone doesn't want to be communicated with, he shouldn't post to NGs from
the beginning.
Netiquette says posts in a newsgroup should be answered in a newsgroup.
There is nothing which indicates you need to share your email address.

I do because I choose to. But even munged like it is, it still gets a
lot of spam. I don't check it often as it's only used for usenet stuff.

But I also know a lot of people in various newsgroups who don't share
their email addresses. No one else seems to have a problem with that.
And if you don't want to respond in a newsgroup, that's fine. But don't
criticize someone else for not having a valid email address.
So *if* you're posting, you should make yourself contactable.
So *if* you're responding, you should do it in the newsgroup.
Besides: us**@example.com might just be new to this and need a shove into
the correct direction.
Yes, he may be new. And it looks like he's doing perfectly fine like he is.

Besides - he wasn't the one with the problem. He was responding to
cwhite, who is the one with the problem.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Apr 4 '07 #11
Schraalhans Keukenmeester wrote:
If you ever feel the need to email me, just tell me and I'll gladly send
you a valid address.

Sh.
Hi there!

Agreed, for reason of Netiquette I will repost here with a name just so
you know who is posting in future ;-)

I will keep us**@example.com however as it is reserved for use in
development and will guard me from spam, no need for a real address,
just causes lots of unwanted spam traffic.
Apr 4 '07 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: STEPHEN GOODE | last post by:
I had a client upgrade his PHP from 4.? to 4.3.9. An important script stopped working. It seems to work fine, but it uses the mail() function and sendmail to send notifications. The email never...
8
by: Jan Danielsson | last post by:
Hello all, How do I make a python script actually a _python_ in unix:ish environments? I know about adding: #!/bin/sh ..as the first row in a shell script, but when I installed python on...
6
by: serge | last post by:
What is the fastest way to generate an SQL 2000 database out of SQL scripts. The SQL scripts contain the create tables, views, stored procedures, triggers, constraints, and the tables DATA...
45
by: Pat | last post by:
its seems asp.net validation doesn't fire when using FireFox? Tested a page and it doesn't fire. It seems the javascript doesn't fire Any ideas?
1
by: Kaloyan Iliev Iliev | last post by:
Hello, Could anyone explain why the following is no longer supported by default. Now I have to write a function upper(inet). I have a script which suddenly stop working after the upgrade:))) I...
8
by: Leszek | last post by:
Hi. Could you help solve the problem: i have a file that has two includes: //my script <?php include(.'/prog1.php'); include(.'/prog2.php'); ?>
6
by: Demetri | last post by:
For Menu, Treeview, etc. Where are the javascripts for these? -- -Demetri
2
by: TastyKarma | last post by:
Was hoping somebody might have experienced this before. I have client-side javascript in my aspx files. For some reason when I place the "debugger;" keyword in my javascript, Visual Studio no...
5
by: stefaan.himpe | last post by:
Hello list, Is anyone aware of a (light-weight, easy-to-use) auto-upgrade framework for python scripts? I find it hard to believe no one has wanted this before, yet google doesn't find too...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.