Forums

PHP

This topic is locked

Unknown column 'access' in 'field list'

Posted 22 May 2002 19:58:04
1
has voted
22 May 2002 19:58:04 william dimotta posted:
I was wondering if anyone has incountered this error message when trying to set up the Database with access levels.

Here my setup:

I'm using a Mac G4 with OS9.1
I'm set up to a mySQL database through
my ISP.
My connection works, all the proper drivers installed.
I'm using PHAkt 1.2, with Ultra Dev to set this all up.
My database has 3 fields,
User, Password, and Access Levels
which are # 1-7.
Each user Gets there own level.
So that when each user logs in they view there own private page.

First when i use the server behavior and create the user log in which is provided.
When i check the User and Password button in the Restrict access based on. My database works, why i try to use the User, Password, and accesslevel.
I get the message

Unknown column 'access' in 'field list'

It only happens when the access level button is checked. Does any one know why this is happening.

Then i also added the code in order to have user authentication.
I was wondering if someone can take a look at the code to see if the error shows itself.

Thanks, William

<?php


// Copyright (c) Interakt Online 2001
// www.interakt.ro/

require("./../adodb/adodb.inc.php";
require("./../Connections/conndatabase.php";
?><?php
// *** Start the session
session_start();
// *** Validate request to log in to this site.
$KT_LoginAction = $PHP_SELF;
if ($QUERY_STRING!="" $KT_LoginAction .= "?".$QUERY_STRING;
if (isset($name)) {
$KT_valUsername=$name;
$KT_fldUserAuthorization="access level";
$KT_redirectLoginSuccess="undefined";
$KT_redirectLoginFailed="unable.php";
$KT_rsUser_Source="SELECT users, password ";
if ($KT_fldUserAuthorization != "" $KT_rsUser_Source .= "," . $KT_fldUserAuthorization;
$KT_rsUser_Source .= " FROM users WHERE users='" . $KT_valUsername . "' AND password='" . $password . "'";
$KT_rsUser=$conndatabase->Execute($KT_rsUser_Source) or DIE($conndatabase->ErrorMsg());
if (!$KT_rsUser->EOF) {
// username and password match - this is a valid user
$KT_Username=$KT_valUsername;
session_register("KT_Username";
if ($KT_fldUserAuthorization != "" {
$KT_UserAuthorization=$KT_rsUser->Fields($KT_fldUserAuthorization);
} else {
$KT_UserAuthorization="";
}
session_register("KT_UserAuthorization";
if (isset($accessdenied) && false) {
$KT_redirectLoginSuccess = $accessdenied;
}
$KT_rsUser->Close();
session_register("KT_login_failed";
$KT_login_failed = false;
switch($KT_rsUser->Fields($KT_fldUserAuthorization)){
case "1":
$KT_redirectLoginSuccess="ajc_md.php";
break;
case "2":
$KT_redirectLoginSuccess="cbs_md.php";
break;
case "3":
$KT_redirectLoginSuccess="fri_md.php";
break;
case "4":
$KT_redirectLoginSuccess="gue_md.php";
break;
case "5":
$KT_redirectLoginSuccess="new_md.php";
break;
case "6":
$KT_redirectLoginSuccess="tm_md.php";
break;
case "7":
$KT_redirectLoginSuccess="univ_md.php";
break;
}
header ("Location: $KT_redirectLoginSuccess";
exit;
}
$KT_rsUser->Close();
session_register("KT_login_failed";
$KT_login_failed = true;
header ("Location: $KT_redirectLoginFailed";
exit;
}
?><?php
$BIG=$conndatabase->Execute("SELECT * FROM users" or DIE($conndatabase->ErrorMsg());
$BIG_numRows=0;
$BIG__totalRows=$BIG->RecordCount();
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#"!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?")>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_nbGroup(event, grpName) { //v3.0
var i,img,nbArr,args=MM_nbGroup.arguments;
if (event == "init" && args.length > 2) {
if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
nbArr[nbArr.length] = img;
for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = args[i+1];
nbArr[nbArr.length] = img;
} }
} else if (event == "over" {
document.MM_nbOver = nbArr = new Array();
for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = (img.MM_dn && args[i+2]) ? args[i+2] : args[i+1];
nbArr[nbArr.length] = img;
}
} else if (event == "out" ) {
for (i=0; i < document.MM_nbOver.length; i++) {
img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
} else if (event == "down" {
if ((nbArr = document[grpName]) != null)
for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
document[grpName] = nbArr = new Array();
for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = args[i+1];
nbArr[nbArr.length] = img;
} }
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" onLoad="MM_preloadImages('../gif/nb_c1_r1_lg.gif','../gif/nb_c1_r2_hmh.gif','../gif/nb_c1_r3_cth.gif','../gif/nb_c1_r5_ws.gif','../gif/nb_c1_r6_ws.gif','../gif/nb_c1_r4_auh.gif')">
<table border="0" cellpadding="0" cellspacing="0" width="120" height="480" align="left">
<tr>
<td width="120" height="140"><a href="#" onClick="MM_nbGroup('down','group1','Logo','../gif/nb_c1_r1_lg.gif',1)" onMouseOver="MM_nbGroup('over','Logo','../gif/nb_c1_r1_lg.gif','',1)" onMouseOut="MM_nbGroup('out')"><img name="Logo" src="../gif/nb_c1_r1_lg.gif" border="0" onLoad="" width="120" height="140"></a></td>
</tr>
<tr>
<td width="120"><a href="home.php" onClick="MM_nbGroup('down','group1','Home','../gif/nb_c1_r2_hmh.gif',1)" onMouseOver="MM_nbGroup('over','Home','../gif/nb_c1_r2_hmh.gif','',1)" onMouseOut="MM_nbGroup('out')" target="content"><img name="Home" src="../gif/nb_c1_r2_hm.gif" border="0" onLoad="" width="120" height="20"></a></td>
</tr>
<tr>
<td width="120"><a href="contact.php" onClick="MM_nbGroup('down','group1','Contact','../gif/nb_c1_r3_cth.gif',1)" onMouseOver="MM_nbGroup('over','Contact','../gif/nb_c1_r3_cth.gif','',1)" onMouseOut="MM_nbGroup('out')" target="content"><img name="Contact" src="../gif/nb_c1_r3_ct.gif" border="0" onLoad="" width="120" height="20"></a></td>
</tr>
<tr>
<td width="120"><a href="about_us.php" onClick="MM_nbGroup('down','group1','About','../gif/nb_c1_r4_auh.gif',1)" onMouseOver="MM_nbGroup('over','About','../gif/nb_c1_r4_auh.gif','',1)" onMouseOut="MM_nbGroup('out')" target="content"><img name="About" src="../gif/nb_c1_r4_au.gif" border="0" onLoad="" height="20" width="120"></a></td>
</tr>
<tr>
<td><a href="#" onClick="MM_nbGroup('down','group1','White2','../gif/nb_c1_r6_ws.gif',1)" onMouseOver="MM_nbGroup('over','White2','../gif/nb_c1_r6_ws.gif','',1)" onMouseOut="MM_nbGroup('out')"><img name="White2" src="../gif/nb_c1_r6_ws.gif" border="0" onLoad="" width="120" height="20"></a></td>
</tr>
<tr>
<td width="120"><a href="#" onClick="MM_nbGroup('down','group1','White1','../gif/nb_c1_r5_ws.gif',1)" onMouseOver="MM_nbGroup('over','White1','../gif/nb_c1_r5_ws.gif','',1)" onMouseOut="MM_nbGroup('out')"><img name="White1" src="../gif/nb_c1_r5_ws.gif" border="0" onLoad="" width="120" height="20"></a></td>
</tr>
<tr>
<td>
<table width="120" border="0" height="240" background="../gif/nb_c1_r7_gr.jpg" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3" height="60"> </td>
</tr>
<tr>
<td width="18" height="160"> </td>
<td height="160" width="84">
<form action="<?php echo $KT_LoginAction?>" name="form1" method="post" target="content">
<p> <img src="../gif/nb_c2_r8_nm1.gif" width="80" height="20">
<input type="text" name="name" size="12">
<img src="../gif/nb_c2_r10_pw1.gif" width="80" height="20">
<input type="password" name="password" size="12">
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
</td>
<td width="18"> </td>
</tr>
<tr>
<td height="21" width="18"> </td>
<td height="21" width="84"> </td>
<td height="21" width="18"> </td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

<?php
$BIG->Close();
?>


Replies

Replied 23 May 2002 03:34:07
23 May 2002 03:34:07 Tim Green replied:
This is happening basically because it is looking for a column in your DB called 'access' and isn't finding it.

If the column in your DB is indeed called "access level" then there is your problem.... spaces in column names are not allowed.

You need to rename the column without the space.

Please, in the future, wait for me to read the post, and reply. There is no need to email me privately, asking me to read the post.... kind of defeats the object, and I <b>do</b> stop by hear regularly.

Hope this helps

Tim Green

Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>

Reply to this topic