944,150 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 2559
  • PHP RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Nov 4th, 2009
-1
Re: PRoblem in Delete
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????
so what error you getting on the server?
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; Nov 4th, 2009 at 3:08 am.
Reputation Points: 29
Solved Threads: 76
Practically a Master Poster
network18 is offline Offline
616 posts
since Sep 2009
Nov 4th, 2009
0
Re: PRoblem in Delete
thanks but my problem is not solve
Last edited by manishmannan; Nov 4th, 2009 at 8:29 am.
Reputation Points: 10
Solved Threads: 4
Junior Poster in Training
manishmannan is offline Offline
58 posts
since Nov 2009
Nov 4th, 2009
0
Re: PRoblem in Delete
is there any change needed in php.ini file to delete records from the database if it happen thn plz tell me
Reputation Points: 10
Solved Threads: 4
Junior Poster in Training
manishmannan is offline Offline
58 posts
since Nov 2009
Nov 4th, 2009
0
Re: PRoblem in Delete
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">&nbsp;</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
Reputation Points: 10
Solved Threads: 4
Junior Poster in Training
manishmannan is offline Offline
58 posts
since Nov 2009
Nov 4th, 2009
-1
Re: PRoblem in Delete
there is no any kind of error occuring in the server even it print the message that records have deleted but still reords is not deleted
My all the commands work properly but still the records are not deleted do somthing take it seriously plzzzzzz
Reputation Points: 10
Solved Threads: 4
Junior Poster in Training
manishmannan is offline Offline
58 posts
since Nov 2009
Nov 4th, 2009
0
Re: PRoblem in Delete
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
PHP Syntax (Toggle Plain Text)
  1. $con = mysql_connect(.....,....,..);
  2. echo "Connection=>".$con;
-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.
Reputation Points: 29
Solved Threads: 76
Practically a Master Poster
network18 is offline Offline
616 posts
since Sep 2009
Nov 4th, 2009
0
Re: PRoblem in Delete
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?
Last edited by Will Gresham; Nov 4th, 2009 at 8:51 am.
Reputation Points: 96
Solved Threads: 124
Master Poster
Will Gresham is offline Offline
728 posts
since May 2008
Nov 5th, 2009
0
Re: PRoblem in Delete
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
Reputation Points: 10
Solved Threads: 4
Junior Poster in Training
manishmannan is offline Offline
58 posts
since Nov 2009
Nov 5th, 2009
0
Re: PRoblem in Delete
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:
Reputation Points: 10
Solved Threads: 4
Junior Poster in Training
manishmannan is offline Offline
58 posts
since Nov 2009
Nov 5th, 2009
0
Re: PRoblem in Delete
is there any difference in any both the version of my sql??????
Reputation Points: 10
Solved Threads: 4
Junior Poster in Training
manishmannan is offline Offline
58 posts
since Nov 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: connecting with mysqli
Next Thread in PHP Forum Timeline: calling different images from one php file





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC