PHP help
- Started
- Last post
- 27 Responses
- fifty500
i've used PHP includes dozens of times before but never ran into a problem with them until today, mysteriously. I did things the way I always do but today I got the same error as Sherman and I'm not adept enough to fix it on my own. Any solutions?
- Anarchitect0
include() cannot 'understand' query strings.
make our variable accessible before your include statement.
- fifty500
i don't know what that means. i've used includes before, and I've even tried using the includes that have worked for me before but today it's just not working.
- Mimio0
You can use a GET in the include call? something seems wrong with that.
- Anarchitect0
//instead of
include('page.php?var=val');//use
$var = val;include('page.php');
also the problem you might have been experienced is the change in recent versions of php regarding global variables: for security reasons they're not accessible immediatelly after form posts and/or url query strings.
you should add this to the beggining of your script to retrieve all $_GET/$_POST vars:
foreach ($_REQUEST as $key => $value) $$key = $value;
- fifty500
well i fixed the parsing error but there's something wrong in my code:
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
}
it's giving me an error:
mysql_fetch_array(): supplied argument is not a valid MySQL result
- UndoUndo0
while ($row = mysql_fetch_array($result)) {
&myVar = $row['expectedVar'];}
is all you need
- fifty500
unfortunately not. it's still taking the piss.
- fifty500
everything's just a bit over my head. I just know how to do simple includes and that's about it. i appreciate your help but i think i'll leave it until the morning and get someone in my office to help me.
- determinedmoth0
unfortunately not. it's still taking the piss.
fifty50
(Nov 16 05, 01:30)I'm my experience PHP probably thinks you're giving it away.
- determinedmoth0
Undo...
Was it you asking about MS SQL? We've a rather large project that will require PHP + MSSQL. Have you experience of this?
- UndoUndo0
hi Moth,
yeah i was asking about a GUI for MS SQL but its with VB ASP and not my arena...we have another guy onto it.
why have you decided to go with MS SQL over MYSQL??
- UndoUndo0
fifty50 try this i made a mistake
while ($row = mysql_fetch_array($result)) {
$myVar = $row['expectedVar'];}
- determinedmoth0
why have you decided to go with MS SQL over MYSQL??
UndoUndo
(Nov 16 05, 01:46)Becuase it's an e-commerce site and the clients' stock systems run under Sage - which is SQL based, but MS SQL. So we've got to plug it into that.
- justjeff0
you should add this to the beggining of your script to retrieve all $_GET/$_POST vars:
foreach ($_REQUEST as $key => $value) $$key = $value;
Anarchitect
(Nov 15 05, 10:50)That's actually a bad idea, and it's as flawed as allowing register_globals to be on in the first place.
You should only use vars from $_REQUEST, $_POST, and $_GET as you need them - pulling them globally at the start of a script can lead to very common programming bugs where an initialized variable is meant to imply a known state, and a tainted REQUEST can override privilleges.
This was the most common security hole in PHP scripts for about 2 years from 2001-2003, and caused the PHP camp to finally disable register_globals by default.
- UndoUndo0
i had a look at php>MS SQL from what I saw it was data from linux> windows and back that was the hardest part.
unfit might be able to help
- determinedmoth0
ok. Well I hope it's a little while off at the moment, but there might be some work for someone who can handle it. It could very well be beyond me.
- Anarchitect0
I'm aware of that
but I avoid using names that can conflict with any existent super global.
- UndoUndo0
looks quite well documented
- fifty500
it's okay now I went back and rewrote most of it, taking out some useless shite and now it works fine. thanks for the help guys. you may now continue with your hijacked thread.