User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 391,803 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,419 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 914 | Replies: 2
Reply
Join Date: Jun 2006
Posts: 29
Reputation: Woobag is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
Woobag Woobag is offline Offline
Light Poster

Unknown error and ')' Problem

  #1  
Aug 19th, 2006
Hey guys, im just starting out in php and im attempting to build a login script that works takes info from my table userinfo. The values in userinfo are created from createuser.php.

Here is the error i am getting in my code:
Parse error:  parse error, unexpected T_INC, expecting ')' in c:\link\to\file\backend\login.php on line 37

And here is my actual code of login.php:

[php]<?php

// login.php
// by Ryan Wood

// TODO: Allow user to login and see his information about his project.

require ($_SERVER["DOCUMENT_ROOT"]."/backend/config.php");
$connection = @mysql_connect($server, $db_user, $db_password) or die("Error: Could not connect to MySQL server");
mysql_select_db($database, $connection);

$name = $_POST["txt_username"];
$password = $_POST["txt_password"];

?>

<html>
<head>
<title>Login</title>
</head>
<body>
<font face="Verdana, Arial, Helvetica, sans-serif" size="2">
<form action="<?php echo $_SESSION[PHP_SELF]; ?>" method="post">
Username : <input name="txt_username" type="text" maxlength="64"><br><br>
Password : <input name="txt_password" type="text" maxlength="64"><br><br>
<input value="Submit" type="submit">
</form><br>
</font>
</body>
</html>

<?php

$query = "SELECT * FROM userinfo";
$result = mysql_query($query, $connection);

for ($i = 0; $i < mysql_num_rows($result); i++)
{
$name_ck = mysql_result($result, $i, "user_name");
$pass_ck = mysql_result($result, $i, "user_password");

if ($name == $name_ck)
{
if (md5($pass) == $pass_ck)
{
echo $name_ck.'<br>';
echo $pass_ch;
}
}
}

?>[/php]

The error occurs on line 37, where the for loop is.

Any help is appreciated. Ive searched for T_INC and my other problem with not having a ")" much to my dismay.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2006
Posts: 29
Reputation: Woobag is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
Woobag Woobag is offline Offline
Light Poster

Re: Unknown error and ')' Problem

  #2  
Aug 19th, 2006
Sorry for the double post, i meant to hit edit.
Reply With Quote  
Join Date: Jun 2006
Posts: 29
Reputation: Woobag is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
Woobag Woobag is offline Offline
Light Poster

Re: Unknown error and ')' Problem

  #3  
Aug 19th, 2006
Dang, quite obvious what the error was after i stopped staring at it for an hour. I was missing the '$' sign in front of the i++. Damn C++, damn it.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb PHP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 5:26 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC