Link to home
Start Free TrialLog in
Avatar of tweddlewalker
tweddlewalker

asked on

PHP ERROR Unknown column in 'where clause'

The lines which produce the error are:

if(!isset($_POST['searchField_selap']))
{
 $_SESSION['sess_idap']=$_SESSION['sess_over'];
}

Doing something stupid; could somebody please help?
Avatar of Marco Gasi
Marco Gasi
Flag of Spain image

Sorry, but without knowing the rest of the code it's impossible trying to help you. There is nothing bad in those lines...
Avatar of tweddlewalker
tweddlewalker

ASKER

Sorry to have been over brief. Thank you for your quick reply.

On Page 1
$_SESSION['sess_over']= $_POST['sel_aport'];
sel_aport is three character text string
with an ahref, not form, link to Page 2

On Page 2
This page is normally reached through a form om Page  3
if(isset($_POST['searchField_selap']))
{
$_SESSION['sess_idap']= $_POST['searchField_selap'];
}

if(!isset($_POST['searchField_selap']))
{
 echo $_SESSION['sess_over'];
$_SESSION['sess_idap']=$_SESSION['sess_over'];

}

We put in the echo line to test with the resulting error:
ALGUnknown column 'ALG' in 'where clause'

I hope I have explained better.
Unknown column in 'where clause' is a database error message, not a PHP error message.
Thank you for your reply. Sorry to have been too brief.

On Page 1
$_SESSION['sess_over']= $_POST['sel_aport'];

On Page 2
linked with ahref not a form
if(isset($_POST['searchField_selap']))
{
$_SESSION['sess_idap']= $_POST['searchField_selap'];
}

if(!isset($_POST['searchField_selap']))
{
echo $_SESSION['sess_over'];
 $_SESSION['sess_idap']=$_SESSION['sess_over'];
}

The echo is in as a test. The error line is now:
ALGUnknown column 'ALG' in 'where clause'
The echo is right the session variable produces the error.

I do hope you may be able to advise.
Thank you for your reply. Sorry to have been too brief.

On Page 1
$_SESSION['sess_over']= $_POST['sel_aport'];

On Page 2
linked with ahref not a form
if(isset($_POST['searchField_selap']))
{
$_SESSION['sess_idap']= $_POST['searchField_selap'];
}

if(!isset($_POST['searchField_selap']))
{
echo $_SESSION['sess_over'];
 $_SESSION['sess_idap']=$_SESSION['sess_over'];
}

The echo is in as a test. The error line is now:
ALGUnknown column 'ALG' in 'where clause'
The echo is right the session variable produces the error.

I do hope you may be able to advise.
But where are you running the database query which produces the error message?
Thank you for your reply. Sorry to have been too brief.

On Page 1
$_SESSION['sess_over']= $_POST['sel_aport'];

On Page 2
linked with ahref not a form
if(isset($_POST['searchField_selap']))
{
$_SESSION['sess_idap']= $_POST['searchField_selap'];
}

if(!isset($_POST['searchField_selap']))
{
echo $_SESSION['sess_over'];
 $_SESSION['sess_idap']=$_SESSION['sess_over'];
}

The echo is in as a test. The error line is now:
ALGUnknown column 'ALG' in 'where clause'
The echo is right the session variable produces the error.

I do hope you may be able to advise.
The session variable simply  can't produce that error because it's a databes error. Can you post here the full page2?
Thanks again.

This page opens correctly when searchField_selap is set.

Page is attached
You forgot to attach page :) But please, copy the code and paste it here using

Open in new window

: it's easier for us to take a look without downloading it...
Hello again.  Full code attached
Sorry, now I have to go for a while but... where is the code?
Really struggling to upload it.  When we copy the text in, it won't accept it.  We have tried to upload twice.  Looks like there is a glitch in the upload part of the site.  Thanks for your patience.
We've found the error.  You were right.  It was in MySQL code.  Thanks for your help.
I've requested that this question be closed as follows:

Accepted answer: 0 points for tweddlewalker's comment #a39584561

for the following reason:

Saw our code error immediately.
ASKER CERTIFIED SOLUTION
Avatar of Marco Gasi
Marco Gasi
Flag of Spain image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Misunderstanding. I was so pleased that someone spotted the error. You can both have grade A.
Sorry, tweddlewalker, but there is still a misunderstanding. DaveBaldwin has been the first to notify you that the error was a database error in the comment ID: 39584400

I've been the second with my comment ID: 39584411

So, the right choice would be to award all points not to me but to Dave: I deserve only a little part of them since the real solution has been offered by Dave. Please, request attention to a moderator using the link in the question box above and change your decision.

You'll see the next time you'll feel more confortable with EE rules ;)