syntax error for mysql
Moderator: General Moderators
They had a bunch of spaces to line 61 so I removed that, and now its saying 43 so here are lines from 26-43
Here is the entire code
Code: Select all
If ($error > 0) {
header("location: authenticated.php");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
</body>
</html>Code: Select all
<?php
include($_SERVER['DOCUMENT_ROOT']."/classes/access_user/access_user_class.php");
$page_protect = new Access_user;
// $page_protect->login_page = "login.php"; // change this only if your login is on another page
$page_protect->access_page(); // only set this this method to protect your page
if (isset($_GET['action']) && $_GET['action'] == "log_out") {
$page_protect->log_out(); // the method to log off
}
//NEW smurf
//Error Checker
$error = 0;
$rnquery = mysql_query("SELECT * FROM tbl_USERS WHERE real_name = '".$realname."'");
//Foreach row check to make sure the fields are filled in
while ($row = mysql_fetch_assoc($rnquery)) {
If ($row['real_name'] = "") {//change $value to $row['field_name_you_are_checking_here']
$error = $error + 1;
}
}
If ($error > 0) {
header("location: authenticated.php");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
</body>
</html>- shiznatix
- DevNet Master
- Posts: 2745
- Joined: Tue Dec 28, 2004 5:57 pm
- Location: Tallinn, Estonia
- Contact:
Code: Select all
If ($error > 0) {
header("location: authenticated.php");
?>That seemed to clear up all the errors, Now i get "No Database Selected".
So I went in and put the connection info in manually. Then it said that USERS was not a table, so I changed it to lowercase and I guess it works fine, because all I get now is a blank page. It hasnt gone over the aunthenticated.php as assigned.
So I went in and put the connection info in manually. Then it said that USERS was not a table, so I changed it to lowercase and I guess it works fine, because all I get now is a blank page. It hasnt gone over the aunthenticated.php as assigned.
- shiznatix
- DevNet Master
- Posts: 2745
- Joined: Tue Dec 28, 2004 5:57 pm
- Location: Tallinn, Estonia
- Contact:
try this
change:
If ($error < 0) {
header("location: authenticated.php");
}
to:
change:
If ($error < 0) {
header("location: authenticated.php");
}
to:
Code: Select all
If ($error == 0)
header("location: authenticated.php");
else
echo 'There Was A Error';- shiznatix
- DevNet Master
- Posts: 2745
- Joined: Tue Dec 28, 2004 5:57 pm
- Location: Tallinn, Estonia
- Contact:
try this
Code: Select all
<?php
include($_SERVER['DOCUMENT_ROOT']."/classes/access_user/access_user_class.php");
$page_protect = new Access_user;
// $page_protect->login_page = "login.php"; // change this only if your login is on another page
$page_protect->access_page(); // only set this this method to protect your page
if (isset($_GET['action']) && $_GET['action'] == "log_out") {
$page_protect->log_out(); // the method to log off
}
//NEW smurf
//Error Checker
$rnquery = mysql_query("SELECT * FROM tbl_USERS WHERE real_name = '".$realname."' LIMIT 1");
if (mysql_num_rows($rnquery) == 1)
header("location: authenticated.php");
else
header("location: update_user_profile.php");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
</body>
</html>What you just explained is exactly what I want. However, the problem is that this page is being accessed after a successful login. So this is how it works..
You have login.php
checks login from access_user.php
from login.php it goes to example.php (the one we been working on)
Then if the real_name is populated for the current user then it needs to goto authenticated.php.
if not then it should goto update_user_profile.php .
Im trying to make this stuff work with little php knowledge. I really appreciate your help.
The code we are working with is not working, so I figured that it might have something to do with my class file and user sessions.
You have login.php
checks login from access_user.php
from login.php it goes to example.php (the one we been working on)
Then if the real_name is populated for the current user then it needs to goto authenticated.php.
if not then it should goto update_user_profile.php .
Im trying to make this stuff work with little php knowledge. I really appreciate your help.
The code we are working with is not working, so I figured that it might have something to do with my class file and user sessions.
This worked for me. I really really appreciate your help on this. Thanks ..you deffinitely pointed me in the right direction, and code most of it.
Code: Select all
$rnquery = mysql_query("SELECT real_name FROM users WHERE login = '".$_SESSION['user']."'") or die(mysql_error());
$row = mysql_fetch_assoc($rnquery);
if (empty($row['real_name']))
{
header("location: update_user.php");
}
else
{
header("location: authenticated.php");
}
?>