Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,472
There are 1747 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

SQL Not working

Thread title: SQL Not working
     
    Thread tools Search this thread Display Modes  
Prev Previous Post   Next Post Next
10-21-2006, 09:34 PM
#1
localhost is offline localhost
localhost's Avatar
Status: Dediport Hosting
Join date: Jul 2006
Location: Berkshire
Expertise: programming, business
Software: Dreamweaver
 
Posts: 1,316
iTrader: 17 / 100%
 

localhost is on a distinguished road

  Old  SQL Not working

Hi,

I have the code below and it doesnt seem to be inserting anything into the db, Could anyone help and is tehre a way to make sure that it has entered correctly without selecting?

Steven

PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>New Admin</title>
<link type="text/css" rel="stylesheet" href="style.css" />
</head>

<body>
<?php
include_once('connect.php');

if (empty(
$_POST['submit'])) 
{
} else {
if (empty(
$_POST['name']) || empty($_POST['pass']))
{
echo 
"<div class=\"text\">Please fill in all fields.</div>";
} else {
$name stripcslashes($_POST['name']);
$pass stripcslashes($_POST['pass']);
$permission '1';
$fpass md5($pass);
$ip $_SERVER['REMOTE_ADDR'];
$query mysql_query("INSERT INTO users (`username` , `password` , `permissions` , `ip`) VALUES ('$name', '$fpass', '$permission', '$ip'");
if (isset(
$query)) {
echo 
"<div class=\"text\">User successfully added.</div>";
}
}
}
?><div class="text">
Enter the details for the new admin below. <br /><br  />
<form name="newuser" method="POST" action="newadmin.php">
Username: <input type="text" name="name" /><br /><br />
Password: <input type="password" name="pass" /><br /><br />
<input type="submit" name="submit" value="Add user" />
</form></div>
</body>
</html>

     


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

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed