my php admin// easier way to acces?

  • (3 Pages)
  • +
  • 1
  • 2
  • 3

30 Replies - 1759 Views - Last Post: 07 May 2009 - 04:22 AM Rate Topic: -----

#1 dangmnx  Icon User is offline

  • D.I.C Regular

Reputation: -1
  • View blog
  • Posts: 428
  • Joined: 10-April 09

my php admin// easier way to acces?

Posted 02 May 2009 - 08:15 PM

is there simple tutorials where you can make to access your admin page. like instead of logging to my hostserver and doing it from the actually phpadmin.
of can someone help me out with this?

Ex: i have a website where my user's upload games they played and etc.

Someould hatimes players report wrong games and i wve to open up my phpadmin and deleted them through there. its really a hassle. is there a way to create a page, where i can like deleted/add/edit. and so on?

Is This A Good Question/Topic? 0
  • +

Replies To: my php admin// easier way to acces?

#2 hadi_php  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 10
  • View blog
  • Posts: 382
  • Joined: 23-August 08

Re: my php admin// easier way to acces?

Posted 02 May 2009 - 09:12 PM

yes, u only need to connect ur database on that page and u need delete code simple......
Was This Post Helpful? 0
  • +
  • -

#3 noorahmad  Icon User is offline

  • Untitled
  • member icon

Reputation: 209
  • View blog
  • Posts: 2,290
  • Joined: 12-March 09

Re: my php admin// easier way to acces?

Posted 02 May 2009 - 10:34 PM

here is the code

test.php the first page
<?php
$con = mysql_connect("localhost","root","");
$db = mysql_select_db("dblogin",$con);
$Query = mysql_query("SELECT * FROM users");
?>
<head>
<title>Untitled Document</title>
</head>
<body>
<table width="500" border="1" cellpadding="2" cellspacing="0" bordercolor="#CCCCCC">
  <tr>
	<td>Edit</td>
	<td>Delete</td>
	<td>User ID</td>
	<td>Username </td>
	<td>Password</td>
	<td>Group</td>
	<td>Status</td>
  </tr>
<?php
while ($Result = mysql_fetch_assoc($Query))
{ 
?>   
  <tr>
	<td><a href="edit.php?uid=<?php echo $Result['UserID'];?>">Edit</a></td>
	<td><a href="delete.php?uid=<?php echo $Result['UserID']?>">Delete</a></td>
	<td><?php echo $Result['UserID']?></td>
	<td><?php echo $Result['Username']?></td>
	<td><?php echo $Result['Password']?></td>
	<td><?php echo $Result['Group']?></td>
	<td><?php echo $Result['Status']?></td>
  </tr>
<?php
}
?>
</table>
</body>
</html>



edit.php use editing page
<?php
$con = mysql_connect("localhost","root","");
$db = mysql_select_db("dblogin",$con);

if(isset($_GET['uid']))
{
$uid=$_GET['uid'];
$Query = mysql_query("SELECT * FROM users WHERE UserID=$uid")or die(mysql_error());
$Result=mysql_fetch_assoc($Query);
}
?>
<head>
<title>Untitled Document</title>
</head>

<body>
<form action="user_update.php" method="post" name="frmedit" id="frmedit">
  <table width="500" border="1" cellpadding="2" cellspacing="0" bordercolor="#CCCCCC">
	<tr>
	  <td>Username </td>
	  <td>Password</td>
	  <td>Group</td>
	  <td>Status</td>
	</tr>
<tr>
	  <td><label>
		<input name="Username" type="text" id="Username" value="<?php echo $Result['Username']?>" />
	  </label></td>
	  <td><label>
		<input name="Password" type="text" id="Password" value="<?php echo $Result['Username']?>" />
	  </label></td>
	  <td><label>
		<input name="Group" type="text" id="Group" value="<?php echo $Result['Group']?>" />
	  </label></td>
	  <td><label>
		<input name="Status" type="text" id="Status" value="<?php echo $Result['Status']?>" />
	  </label></td>
	</tr>
	<tr>
	  <td><input name="UserID" type="hidden" id="UserID" value="<?php echo $_GET['uid'];?>" /></td>
	  <td> </td>
	  <td> </td>
	  <td><label>
		<input type="submit" name="button" id="button" value="Submit" />
	  </label></td>
	</tr>
  </table>
</form>
</body>
</html>



user_update.php user updating code
<?php
$con = mysql_connect("localhost","root","");
$db = mysql_select_db("dblogin",$con);

$uid = $_POST['UserID'];
$un = $_POST['Username'];
$pass = $_POST['Password'];
$Group = $_POST['Group'];
$Status = $_POST['Status'];
$Query = mysql_query("UPDATE users SET `Username`='$un',`Password`='$pass',`Group`=$Group,`Status`=$Status WHERE UserID=$uid") or die(mysql_error());
header("Location: test.php");
?>



delete.php and the user delete page
<?php
$con = mysql_connect("localhost","root","");
$db = mysql_select_db("dblogin",$con);

if(isset($_GET['uid'])){
$uid=$_GET['uid'];
$Query = mysql_query("DELETE FROM users WHERE UserID=$uid");
$_SESSION['Err']="User Deleted Successfully";
header("Location: test.php");
}


?>

Attached File(s)

  • Attached File  code.zip (2.47K)
    Number of downloads: 46

Was This Post Helpful? 0
  • +
  • -

#4 hadi_php  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 10
  • View blog
  • Posts: 382
  • Joined: 23-August 08

Re: my php admin// easier way to acces?

Posted 02 May 2009 - 11:44 PM

your given code is worked so well.....with ur attched sql file......after import.....

but when i try to connect it with another databse......then it doesnt work????? what s the reason may i know??
Was This Post Helpful? 0
  • +
  • -

#5 noorahmad  Icon User is offline

  • Untitled
  • member icon

Reputation: 209
  • View blog
  • Posts: 2,290
  • Joined: 12-March 09

Re: my php admin// easier way to acces?

Posted 02 May 2009 - 11:55 PM

many reasons first set you hostname and user and then change the all database name in all pages and don't forget to change the table name and table fields.
or past you error here i will solve it.
Was This Post Helpful? 0
  • +
  • -

#6 dangmnx  Icon User is offline

  • D.I.C Regular

Reputation: -1
  • View blog
  • Posts: 428
  • Joined: 10-April 09

Re: my php admin// easier way to acces?

Posted 03 May 2009 - 01:19 AM

i'm getting this error'

Quote

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1


http://www.starcraft...user_update.php

<?php
$con = mysql_connect("localhost","root","password");
$db = mysql_select_db("x",$con);

$id = $_POST['id'];
$un = $_POST['setname'];
$pass = $_POST['password'];
$wins = $_POST['wins'];
$loses = $_POST['loses'];
$Query = mysql_query("UPDATE users SET `username`='$un',`password`='$pass',`wins`=$wins,`loses`=$loses WHERE setname=$id") or die(mysql_error());
header("Location: test.php");
?>



This post has been edited by dangmnx: 03 May 2009 - 01:29 AM

Was This Post Helpful? 0
  • +
  • -

#7 noorahmad  Icon User is offline

  • Untitled
  • member icon

Reputation: 209
  • View blog
  • Posts: 2,290
  • Joined: 12-March 09

Re: my php admin// easier way to acces?

Posted 03 May 2009 - 02:12 AM

can you tell me the data type of fields in database
are they INT,VAR CHAR or etc...

This post has been edited by noorahmad: 03 May 2009 - 02:17 AM

Was This Post Helpful? 0
  • +
  • -

#8 hadi_php  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 10
  • View blog
  • Posts: 382
  • Joined: 23-August 08

Re: my php admin// easier way to acces?

Posted 03 May 2009 - 08:22 AM

Database name - donate
Under donate table name - info

This table "info " contains

name - varchar(255)
contact - varchar(255)
address - varchar(255)
amount - int(255)
donated_date - varchar(255)


here is the code -

test.php

<?php
$con = mysql_connect("localhost","root","");
$db = mysql_select_db("donate",$con);
$Query = mysql_query("SELECT * FROM info");
?>
<head>
<title>Untitled Document</title>
</head>
<body>
<table width="500" border="1" cellpadding="2" cellspacing="0" bordercolor="#CCCCCC">
  <tr>
	<td>Edit</td>
	<td>Delete</td>
	<td>Name</td>
	<td>Contact </td>
	<td>Address</td>
	<td>Amount</td>
	<td>Donated Date</td>
  </tr>
<?php
while ($Result = mysql_fetch_assoc($Query))
{ 
?>   
  <tr>
	<td><a href="edit.php?uid=<?php echo $Result['name'];?>">Edit</a></td>
	<td><a href="delete.php?uid=<?php echo $Result['name']?>">Delete</a></td>
	<td><?php echo $Result['name']?></td>
	<td><?php echo $Result['contact']?></td>
	<td><?php echo $Result['address']?></td>
	<td><?php echo $Result['amount']?></td>
	<td><?php echo $Result['donated_date']?></td>
  </tr>
<?php
}
?>
</table>
</body>
</html>



it displays well...

delete.php

<?php
$con = mysql_connect("localhost","root","");
$db = mysql_select_db("donate",$con);

if(isset($_GET['uid'])){
$uid=$_GET['uid'];
$Query = mysql_query("DELETE FROM info WHERE name=$uid");
$_SESSION['Err']="User Deleted Successfully";
header("Location: test.php");
}
?>



delete.php codes doesnt work........it dowsnt shows any errror....but doesnt delete.....what the reason
Was This Post Helpful? 0
  • +
  • -

#9 hadi_php  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 10
  • View blog
  • Posts: 382
  • Joined: 23-August 08

Re: my php admin// easier way to acces?

Posted 03 May 2009 - 08:28 AM

ohh @noorahmad your delete.php code works only when a set

uid with a value as INT it doesnt work with varchar.........isnt it?
Was This Post Helpful? 0
  • +
  • -

#10 hadi_php  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 10
  • View blog
  • Posts: 382
  • Joined: 23-August 08

Re: my php admin// easier way to acces?

Posted 03 May 2009 - 08:46 AM

@dangmnx make sure u change the table name..........

then

WHERE setname=$id

try this

WHERE id=$id

make sure ur this value must be in INT format in MYSQL database's table
Was This Post Helpful? 0
  • +
  • -

#11 dangmnx  Icon User is offline

  • D.I.C Regular

Reputation: -1
  • View blog
  • Posts: 428
  • Joined: 10-April 09

Re: my php admin// easier way to acces?

Posted 03 May 2009 - 03:15 PM

id = int(11) auto_increment // primary
setname = varchar (30)
password = varchar (30)
wins= varchar (200)
loses= varchar (30)

Here's my user_update.php

<?php
$con = mysql_connect("localhost","root","passw");
$db = mysql_select_db("_____",$con);

$id = $_POST['id'];
$setname = $_POST['setname'];
$password = $_POST['password'];
$wins = $_POST['wins'];
$loses = $_POST['loses'];
$Query = mysql_query("UPDATE users SET `setname`='$setname',`password`='$password',`wins`=$wins,`loses`=$loses WHERE id=$id") or die(mysql_error());
header("Location: test.php");
?>





error

Quote

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

This post has been edited by dangmnx: 03 May 2009 - 03:24 PM

Was This Post Helpful? 0
  • +
  • -

#12 hadi_php  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 10
  • View blog
  • Posts: 382
  • Joined: 23-August 08

Re: my php admin// easier way to acces?

Posted 03 May 2009 - 09:06 PM

$Query = mysql_query("UPDATE users SET `setname`='$setname',`password`='$password',`wins`='$wins',`loses`='$loses' WHERE id=$id") or die(mysql_error());


try this....
Was This Post Helpful? 0
  • +
  • -

#13 noorahmad  Icon User is offline

  • Untitled
  • member icon

Reputation: 209
  • View blog
  • Posts: 2,290
  • Joined: 12-March 09

Re: my php admin// easier way to acces?

Posted 03 May 2009 - 10:10 PM

View Posthadi_php, on 3 May, 2009 - 06:52 PM, said:

Database name - donate
Under donate table name - info

This table "info " contains

name - varchar(255)
contact - varchar(255)
address - varchar(255)
amount - int(255)
donated_date - varchar(255)


here is the code -

test.php

<?php
$con = mysql_connect("localhost","root","");
$db = mysql_select_db("donate",$con);
$Query = mysql_query("SELECT * FROM info");
?>
<head>
<title>Untitled Document</title>
</head>
<body>
<table width="500" border="1" cellpadding="2" cellspacing="0" bordercolor="#CCCCCC">
  <tr>
	<td>Edit</td>
	<td>Delete</td>
	<td>Name</td>
	<td>Contact </td>
	<td>Address</td>
	<td>Amount</td>
	<td>Donated Date</td>
  </tr>
<?php
while ($Result = mysql_fetch_assoc($Query))
{ 
?>   
  <tr>
	<td><a href="edit.php?uid=<?php echo $Result['name'];?>">Edit</a></td>
	<td><a href="delete.php?uid=<?php echo $Result['name']?>">Delete</a></td>
	<td><?php echo $Result['name']?></td>
	<td><?php echo $Result['contact']?></td>
	<td><?php echo $Result['address']?></td>
	<td><?php echo $Result['amount']?></td>
	<td><?php echo $Result['donated_date']?></td>
  </tr>
<?php
}
?>
</table>
</body>
</html>



it displays well...

delete.php

<?php
$con = mysql_connect("localhost","root","");
$db = mysql_select_db("donate",$con);

if(isset($_GET['uid'])){
$uid=$_GET['uid'];
$Query = mysql_query("DELETE FROM info WHERE name=$uid");
$_SESSION['Err']="User Deleted Successfully";
header("Location: test.php");
}
?>



delete.php codes doesnt work........it dowsnt shows any errror....but doesnt delete.....what the reason


first of all add an id column in your table and set as Auto Increment

then code for the deleting page
<?php
$con = mysql_connect("localhost","root","");
$db = mysql_select_db("donate",$con);

if(isset($_GET['uid'])){
$uid=$_GET['uid'];
$Query = mysql_query("DELETE FROM info WHERE id=$uid");
$_SESSION['Err']="User Deleted Successfully";
header("Location: index.php");
}
?>



and what was you problem that there is no id column in your database the Query was deleting the record by id and replace of id you put name of the user.

Quote

Database name - donate
Under donate table name - info

This table "info " contains

name - varchar(255)
contact - varchar(255)
address - varchar(255)
amount - int(255)
donated_date - varchar(255)


here is the code -

test.php

<?php
$con = mysql_connect("localhost","root","");
$db = mysql_select_db("donate",$con);
$Query = mysql_query("SELECT * FROM info");
?>
<head>
<title>Untitled Document</title>
</head>
<body>
<table width="500" border="1" cellpadding="2" cellspacing="0" bordercolor="#CCCCCC">
  <tr>
	<td>Edit</td>
	<td>Delete</td>
	<td>Name</td>
	<td>Contact </td>
	<td>Address</td>
	<td>Amount</td>
	<td>Donated Date</td>
  </tr>
<?php
while ($Result = mysql_fetch_assoc($Query))
{
?>  
  <tr>
	<td><a href="edit.php?uid=<?php echo $Result['name'];?>">Edit</a></td>
	<td><a href="delete.php?uid=<?php echo $Result['name']?>">Delete</a></td>
	<td><?php echo $Result['name']?></td>
	<td><?php echo $Result['contact']?></td>
	<td><?php echo $Result['address']?></td>
	<td><?php echo $Result['amount']?></td>
	<td><?php echo $Result['donated_date']?></td>
  </tr>
<?php
}
?>
</table>
</body>
</html>



it displays well...

delete.php

<?php
$con = mysql_connect("localhost","root","");
$db = mysql_select_db("donate",$con);

if(isset($_GET['uid'])){
$uid=$_GET['uid'];
$Query = mysql_query("DELETE FROM info WHERE name=$uid");
$_SESSION['Err']="User Deleted Successfully";
header("Location: test.php");
}
?>


delete.php codes doesnt work........it dowsnt shows any errror....but doesnt delete.....what the reason

Was This Post Helpful? 0
  • +
  • -

#14 dangmnx  Icon User is offline

  • D.I.C Regular

Reputation: -1
  • View blog
  • Posts: 428
  • Joined: 10-April 09

Re: my php admin// easier way to acces?

Posted 03 May 2009 - 10:21 PM

View Posthadi_php, on 3 May, 2009 - 08:06 PM, said:

$Query = mysql_query("UPDATE users SET `setname`='$setname',`password`='$password',`wins`='$wins',`loses`='$loses' WHERE id=$id") or die(mysql_error());


try this....


i get the same error;

Quote

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1


<?php
$con = mysql_connect("localhost","xx","xx");
$db = mysql_select_db("xx",$con);

$id = $_POST['id'];
$setname = $_POST['setname'];
$password = $_POST['password'];
$wins = $_POST['wins'];
$loses = $_POST['loses'];
$Query = mysql_query("UPDATE users SET `setname`='$setname',`password`='$password',`wins`=$wins,`loses`=$loses WHERE id=$id") or die(mysql_error());
header("Location: test.php");
?>



Was This Post Helpful? 0
  • +
  • -

#15 noorahmad  Icon User is offline

  • Untitled
  • member icon

Reputation: 209
  • View blog
  • Posts: 2,290
  • Joined: 12-March 09

Re: my php admin// easier way to acces?

Posted 03 May 2009 - 10:40 PM

View Postdangmnx, on 4 May, 2009 - 08:51 AM, said:

View Posthadi_php, on 3 May, 2009 - 08:06 PM, said:

$Query = mysql_query("UPDATE users SET `setname`='$setname',`password`='$password',`wins`='$wins',`loses`='$loses' WHERE id=$id") or die(mysql_error());


try this....


i get the same error;

Quote

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1


<?php
$con = mysql_connect("localhost","xx","xx");
$db = mysql_select_db("xx",$con);

$id = $_POST['id'];
$setname = $_POST['setname'];
$password = $_POST['password'];
$wins = $_POST['wins'];
$loses = $_POST['loses'];
$Query = mysql_query("UPDATE users SET `setname`='$setname',`password`='$password',`wins`=$wins,`loses`=$loses WHERE id=$id") or die(mysql_error());
header("Location: test.php");
?>





try this
$Query = mysql_query("UPDATE users SET `setname`='$setname',`password`='$password',`wins`='$wins',`loses`='$loses' WHERE id=$id") or die(mysql_error());


Was This Post Helpful? 0
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3