ok, first problem is the login:
ill tell you how my site is setup first so it all makes sence:
this is the folders:
cod4 (main - with index.php and viewuser.php so far)
-layout(sub folder with header.php and footer.php)
-blocks (sub folder with stuff like latest news)
--login (sub folder in blocks which is where login.php is)
ok, in index.php i have my login.php a included in the code and this is the only way i could think of doing it so it would work (please give me ideas if its not the only way) but i still cant get this to work (its the submit button (which is an image) which dosnt work):
<?php
if($_POST['submit']){
?>
<div id="login">
Incorrect information
<META HTTP-EQUIV="refresh" CONTENT="3;URL=index.php">
</div>
<?php
}
else{
?>
<div id="login">
<form action="login.php" method="post">
<input type="text" class="text-inp" name="username" value="USERNAME" />
<input type="password" class="text-inp" name="password" value="PASSWORD" />
<input type="image" src="./images/button_input_bg.gif" class="button" name="submit" value="" />
</form>
</div>
<?php
}
?>
thats the first problem which i cant get to work, when you click the submit button, it dosnt do anything and it still shows the login box :/
--
this is the second problem, in my database i have the user_id which is 1 and the user_nickname which is Administrator and for some reason, this code is giving this error message:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\cod4\viewuser.php on line 19
this is the whole script:
<?php
include('layout\header.php');
session_start();
?>
<!-- OP:MIDDLE COLUMN -->
<div id="middle">
<h2>User Profile</h2>
<div class="main">
<div class="inner">
<img src="images/main_cont_bg_top.gif" alt="" />
<!-- INSERT MAIN CONTENT HERE -->
<?php
$user_id = $_GET['id'];
$query = 'SELECT * FROM users WHERE user_id = $user_id ORDER BY user_id';
$result = mysql_query($query);
while($row=mysql_fetch_array($result))
{
$user_nickname = $row['user_nickname'];
}
?>
<h3><?php echo $user_nickname; ?></h3>
<!-- / INSERT MAIN CONTENT HERE -->
<img src="images/main_cont_bg_bottom.gif" alt="" />
</div>
</div>
<!-- OP:EDIT FLAG 2 -->
<!-- END OP:EDIT FLAG 2 -->
</div>
<!-- / OP:MIDDLE COLUMN -->
<?php
include('layout\footer.php');
?>
the url im using is http://localhost/cod4/viewuser.php?id=1 but i cant think why it wont work.
any help is really greatful.
thanks