| | |
PRoblem in Delete
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Sep 2009
Posts: 539
Reputation:
Solved Threads: 63
-1
#11 30 Days Ago
•
•
•
•
whenever i am working on local host it work fine but after uploading file on internet
this script not deleting any records
what do i do????
Again you including the login.html and using <?php echo $user; ?> in the script, $user gets set in the html file??
check with this or post your login.html too here
Last edited by network18; 30 Days Ago at 3:08 am.
"The discipline of writing something down is the first step towards making it happen."
follow me on twitter
follow me on twitter
•
•
Join Date: Nov 2009
Posts: 44
Reputation:
Solved Threads: 2
0
#14 30 Days Ago
Login.HTML
<html>
<head>
<script language="JavaScript" type="text/javascript">
function validate()
{
if (document.frm1.txtuser.value == '')
{
alert('Please fill a UserName!');
return false;
}
if (document.frm1.txtpass.value == '')
{
alert('Please fill in Password!');
return false;
}
return true;
}
</script>
<style>
body {
font-family:Arial, Helvetica, sans-serif;
background:#FFFFF0;
font-size:12px;
color:#000000;
}
.logout {
cursor:pointer;
background:#FFFF00;
border:#FF6600 1px solid;
width:100px;
height:30px;
font-size:14px;
font-weight:bold;
color:#FF6600;
float:right;
text-decoration:none;
font-family:Arial;
font-size:14px;
line-height:30px;
margin:50px 50px 0px 0px;
text-align:center;
}
h1 {
font-family:Arial, Helvetica, sans-serif;
font-size:20px;
color: #FF6600;
text-align:center;
margin:50px auto 0px auto;
font-weight:500;
}
.head {
font-family:Arial, Helvetica, sans-serif;
font-size:14px;
color: #000;
text-align:center;
font-weight:bold;
}
.form {
font-family:Arial, Helvetica, sans-serif;
font-size:12px;
color:#666666;
line-height:18px;
background:#FBFBFB;
width:100%;
padding:20px;
border:#FFCC00 2px solid;
font-weight:bold;
}
.lable {
margin-left:100px;
}
.btn {
cursor:pointer;
background:#E0E0E0;
border:#000 1px solid;
width:100px;
height:30px;
font-size:14px;
font-weight:bold;
color:#000;
float:left;
margin-left:20px;
}
</style>
<title>Admin Login</title><body>
<form name= "frm1" method= "post" action="login.php" >
<h1 align="center" class="style1">ADMIN PANEL </h1>
<br>
<br>
<table width="354" height="166" border="1" align="center" cellspacing="0" bordercolor="#FF9900" bgcolor="#FBFBFB" class="head">
<tr>
<th height="23" colspan="2" bgcolor="#FFCC00">LOG IN </th>
</tr>
<tr>
<td width="83" height="40"> User</td>
<td width="261" height="40"><input type="text" name="txtuser" /></td>
</tr>
<tr>
<td height="40">Password</td>
<td height="40"><input type="password" name="txtpass" /></td>
</tr>
<tr>
<td height="40"> </td>
<td height="40"><input type="submit" name="submit" value="login" class="btn"/></td>
</tr>
</table>
</form>
<center><a href="forget.php" target="_self">Foget Username or Password </a><br>
<a href="change.php" target="_self">Change Password</a>
</center>
</body>
</html>
NOW Login.php
<?php
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="hnit"; // Database name
$tbl_name="login"; // Table name
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// username and password sent from signup form
$myusername= $_POST['txtuser'];
$mypassword= $_POST['txtpass'];
$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
//echo"$count";
// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){
// Register $myusername, $mypassword and redirect to file "login_success.php"
session_start ();
$_SESSION['myusername'] = $_POST['txtuser'];
$_SESSION['myusername'];
$_SESSION['mypassword'] = $_POST['txtpass'];
//$_SESSION['id'] = $ror[id];
session_write_close ();
header ( 'location: task.php' );
exit ();
}
else {
echo'<center><b>Wrong Username or Password</b></center>';
}
?>
<style>
body {
font-family:Arial, Helvetica, sans-serif;
color:#ff0000;
font-size:16px;
font-weight:bold;
background:#FFFFF0;
padding:50px;
}
#holder {
width:502px;
height:164px;
margin:50px auto 0px auto;
background:#FFFFCC;
border:#FFCC00 1px solid;
}
#link {
width:500px;
position:relative;
float:left;
background: #FFFFCC;
text-align:center;
border:#FFCC00 1px solid;
}
#link a {
color:#000;
padding:10px;
text-decoration:none;
display:block
}
#link a:hover {
color:#ff0000;
text-decoration:none;
background:#FFCC00;
}
#link a:visited {
color:#000;
text-decoration:none;
}
#link a:active {
color:#000;
text-decoration:none;
}
h1 {
font:bold Arial, Helvetica, sans-serif 14px;
color: #FF6600;
text-align:center;
margin:50px auto 0px auto;
}
#logout {
cursor:pointer;
background:#FFFF00;
border:#FF6600 1px solid;
width:100px;
height:30px;
font-size:14px;
font-weight:bold;
color:#FF6600;
float:right;
margin-right:100px;
margin-top:20px;
position:relative;
}
</style>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Wrong Username or Password</title>
</head>
<body>
<?php echo $error_message; ?>
</body>
</html>
plz help me dude
<html>
<head>
<script language="JavaScript" type="text/javascript">
function validate()
{
if (document.frm1.txtuser.value == '')
{
alert('Please fill a UserName!');
return false;
}
if (document.frm1.txtpass.value == '')
{
alert('Please fill in Password!');
return false;
}
return true;
}
</script>
<style>
body {
font-family:Arial, Helvetica, sans-serif;
background:#FFFFF0;
font-size:12px;
color:#000000;
}
.logout {
cursor:pointer;
background:#FFFF00;
border:#FF6600 1px solid;
width:100px;
height:30px;
font-size:14px;
font-weight:bold;
color:#FF6600;
float:right;
text-decoration:none;
font-family:Arial;
font-size:14px;
line-height:30px;
margin:50px 50px 0px 0px;
text-align:center;
}
h1 {
font-family:Arial, Helvetica, sans-serif;
font-size:20px;
color: #FF6600;
text-align:center;
margin:50px auto 0px auto;
font-weight:500;
}
.head {
font-family:Arial, Helvetica, sans-serif;
font-size:14px;
color: #000;
text-align:center;
font-weight:bold;
}
.form {
font-family:Arial, Helvetica, sans-serif;
font-size:12px;
color:#666666;
line-height:18px;
background:#FBFBFB;
width:100%;
padding:20px;
border:#FFCC00 2px solid;
font-weight:bold;
}
.lable {
margin-left:100px;
}
.btn {
cursor:pointer;
background:#E0E0E0;
border:#000 1px solid;
width:100px;
height:30px;
font-size:14px;
font-weight:bold;
color:#000;
float:left;
margin-left:20px;
}
</style>
<title>Admin Login</title><body>
<form name= "frm1" method= "post" action="login.php" >
<h1 align="center" class="style1">ADMIN PANEL </h1>
<br>
<br>
<table width="354" height="166" border="1" align="center" cellspacing="0" bordercolor="#FF9900" bgcolor="#FBFBFB" class="head">
<tr>
<th height="23" colspan="2" bgcolor="#FFCC00">LOG IN </th>
</tr>
<tr>
<td width="83" height="40"> User</td>
<td width="261" height="40"><input type="text" name="txtuser" /></td>
</tr>
<tr>
<td height="40">Password</td>
<td height="40"><input type="password" name="txtpass" /></td>
</tr>
<tr>
<td height="40"> </td>
<td height="40"><input type="submit" name="submit" value="login" class="btn"/></td>
</tr>
</table>
</form>
<center><a href="forget.php" target="_self">Foget Username or Password </a><br>
<a href="change.php" target="_self">Change Password</a>
</center>
</body>
</html>
NOW Login.php
<?php
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="hnit"; // Database name
$tbl_name="login"; // Table name
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// username and password sent from signup form
$myusername= $_POST['txtuser'];
$mypassword= $_POST['txtpass'];
$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
//echo"$count";
// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){
// Register $myusername, $mypassword and redirect to file "login_success.php"
session_start ();
$_SESSION['myusername'] = $_POST['txtuser'];
$_SESSION['myusername'];
$_SESSION['mypassword'] = $_POST['txtpass'];
//$_SESSION['id'] = $ror[id];
session_write_close ();
header ( 'location: task.php' );
exit ();
}
else {
echo'<center><b>Wrong Username or Password</b></center>';
}
?>
<style>
body {
font-family:Arial, Helvetica, sans-serif;
color:#ff0000;
font-size:16px;
font-weight:bold;
background:#FFFFF0;
padding:50px;
}
#holder {
width:502px;
height:164px;
margin:50px auto 0px auto;
background:#FFFFCC;
border:#FFCC00 1px solid;
}
#link {
width:500px;
position:relative;
float:left;
background: #FFFFCC;
text-align:center;
border:#FFCC00 1px solid;
}
#link a {
color:#000;
padding:10px;
text-decoration:none;
display:block
}
#link a:hover {
color:#ff0000;
text-decoration:none;
background:#FFCC00;
}
#link a:visited {
color:#000;
text-decoration:none;
}
#link a:active {
color:#000;
text-decoration:none;
}
h1 {
font:bold Arial, Helvetica, sans-serif 14px;
color: #FF6600;
text-align:center;
margin:50px auto 0px auto;
}
#logout {
cursor:pointer;
background:#FFFF00;
border:#FF6600 1px solid;
width:100px;
height:30px;
font-size:14px;
font-weight:bold;
color:#FF6600;
float:right;
margin-right:100px;
margin-top:20px;
position:relative;
}
</style>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Wrong Username or Password</title>
</head>
<body>
<?php echo $error_message; ?>
</body>
</html>
plz help me dude
•
•
Join Date: Sep 2009
Posts: 539
Reputation:
Solved Threads: 63
0
#16 30 Days Ago
No,deleting the rows got nothing to do with php.ini settings. Now I will write how to start debugging step by step.
-first check if you can connect to the mysql on the server; echo the connection object like
-check you getting the delete query as echo after the delete
-try to execute it in the db,got any error in the mysql with the query syntax.
-first check if you can connect to the mysql on the server; echo the connection object like
PHP Syntax (Toggle Plain Text)
$con = mysql_connect(.....,....,..); echo "Connection=>".$con;
-try to execute it in the db,got any error in the mysql with the query syntax.
"The discipline of writing something down is the first step towards making it happen."
follow me on twitter
follow me on twitter
-1
#17 30 Days Ago
Please use code tags, it makes it easier to read your code.
Also, the code on the first page has a Delete statement, the code above does not. Which code are you using at the moment?
Also, the code on the first page has a Delete statement, the code above does not. Which code are you using at the moment?
Last edited by Will Gresham; 30 Days Ago at 8:51 am.
AJAX is not a programming language, scripting language or any other sort of language.
It is acheived by using JavaScript http functions.
So, AJAX = JavaScript.
It is acheived by using JavaScript http functions.
So, AJAX = JavaScript.
•
•
Join Date: Nov 2009
Posts: 44
Reputation:
Solved Threads: 2
0
#18 29 Days Ago
hello friends
1stly i am replying to network
my query works fine like there is a statements in my script like this
<?php if($_GET['delete'] && $_GET['delete'] =='Delete' ){
for($i=0;$i<count($_GET['checkbox']);$i++)
{
$del_id = $checkbox[$i];
$sql = "DELETE FROM $tbl_name WHERE id='$del_id' ";
$result = mysql_query($sql,$con);
if (mysql_query($sql,$con))
{
echo " records is sucessfully Deleted";
}
else{
die('Error: ' . mysql_error());
}
}
if($result){
echo "<meta http-equiv=\"refresh\" content=\"0;URL=del.php\">";
}
}
mysql_close();
?>
here i got proper execution of my script even no any kind of error occured
and message prints sucessfully
like
records is sucessfully Deleted
but results is no rows are deleting from the database
1stly i am replying to network
my query works fine like there is a statements in my script like this
<?php if($_GET['delete'] && $_GET['delete'] =='Delete' ){
for($i=0;$i<count($_GET['checkbox']);$i++)
{
$del_id = $checkbox[$i];
$sql = "DELETE FROM $tbl_name WHERE id='$del_id' ";
$result = mysql_query($sql,$con);
if (mysql_query($sql,$con))
{
echo " records is sucessfully Deleted";
}
else{
die('Error: ' . mysql_error());
}
}
if($result){
echo "<meta http-equiv=\"refresh\" content=\"0;URL=del.php\">";
}
}
mysql_close();
?>
here i got proper execution of my script even no any kind of error occured
and message prints sucessfully
like
records is sucessfully Deleted
but results is no rows are deleting from the database
•
•
Join Date: Nov 2009
Posts: 44
Reputation:
Solved Threads: 2
0
#19 29 Days Ago
and this is the same script that work fine on my local host but not on uploading files on internet
what to do??????????
plz help me out
and i need to tell you that my localhost sql version is
MySQL
Server: localhost via TCP/IP
Server version: 5.1.37
Protocol version: 10
User: root@localhost
MySQL charset: UTF-8 Unicode (utf8)
and on internet i am having
localhost
Server version: 5.0.18-nt
Protocol version: 10
Server: localhost via TCP/IP
User: DATABASE@127.0.0.1
MySQL charset: UTF-8 Unicode (utf8)
MySQL connection collation:
what to do??????????
plz help me out
and i need to tell you that my localhost sql version is
MySQL
Server: localhost via TCP/IP
Server version: 5.1.37
Protocol version: 10
User: root@localhost
MySQL charset: UTF-8 Unicode (utf8)
and on internet i am having
localhost
Server version: 5.0.18-nt
Protocol version: 10
Server: localhost via TCP/IP
User: DATABASE@127.0.0.1
MySQL charset: UTF-8 Unicode (utf8)
MySQL connection collation:
![]() |
Similar Threads
- mysql - problem using delete (PHP)
- memory leak problem... (C)
- can't delete text from table cells (Site Layout and Usability)
- Aim Problem Need Help (Windows NT / 2000 / XP)
- CDRW Problem (USB Devices and other Peripherals)
- problem with accessing sites (Web Browsers)
- hijacker.exe help, have no clue what's causing problem and don't want to delete good (Viruses, Spyware and other Nasties)
- Can't delete three .tmp files (Windows 95 / 98 / Me)
- CommonNames problem (Web Browsers)
Other Threads in the PHP Forum
- Previous Thread: connecting with mysqli
- Next Thread: calling different images from one php file
| Thread Tools | Search this Thread |
ajax apache api archive array autocomplete beginner binary broken cakephp checkbox class cms code cron curl database dataentry date display duplicates dynamic echo email emptydisplayvalue error errors execute explodefunction file files firstoptioninphpdroplist folder form forms function functions google href htaccess html image include insert integration ip java javasciptvalidation javascript joomla keywords limit link login mail matching menu mlm multiple mysql number oop paypal pdf php phpmyadmin problem query radio random recursion recursive regex remote script search server sessions shot sms soap source space sql subscription syntax system table tag tutorial tutorials update upload url validator variable video web xml youtube





