Hi, Im using EasyPhp, and phpmyadmin. what i want to do is how can i manipulate the database in "phpmyadmin" using, ADD,DELETE,UPDATE,EDIT. what is the basic manipulation in MySQL ?
Printable View
Hi, Im using EasyPhp, and phpmyadmin. what i want to do is how can i manipulate the database in "phpmyadmin" using, ADD,DELETE,UPDATE,EDIT. what is the basic manipulation in MySQL ?
check out the link in my signature, "MySQL Help"
How am i put the mysql code in a button ?
How im going to put this sql method in the html ?Code:<html><head><title></title></head>
<body>
<form action="mail:[email protected]" method="POST">
User Id:
<input type="text" name="id" size="45" class="id"><br>
Password:
<input type="password" name="pass" size="45" class="pawd"><br>
First Name:
<input type="text" name="fname" size="45" class="first"><br>
Last Name:
<input type="text" name="lname" size="45" class="last"><br>
Group:
<input type="text" name="group" size="45" class="group"><br>
<input type="Button" name="Submit" value="Submit"><br>
</body>
</html>
dont know how to perform a mysql and put it in the html ? Cause i want to add, delete, edit a record in my phpmyadminCode:$sql = "INSERT INTO trend_users () VALUES ()";
$sql = "SELECT FROM trend_users ()";
$sql = "DELETE FROM trend_users";
let me clear some stuff first.
You want to be able to have people put information from that form into the database right?
And to use phpmyadmin, you dont need to know sql. It is all graphical. There is a SQL page where you can use your own sql if you would like.
But i need to make my own SQL in my php, but i dont know how to put it with the html code ?
Like the code that i post #3. I dont know how to put it in the button. Like this
But it dosen't workCode:<input type="Buton" name="<?php $sql="INSERT INTO trend_users (user_id, user_pass, user_fname, user_lname, user_group) VALUES ('$_POST[id]', '$_POST[pass]', '$_POST[fname]', '$_POST[lname]', '$_POST[group]'"; value="submit">
What happened why you tried it?
I dont know where should i place the mysql code such as INSERT,UPDATE,DELETE,SELECT. When the user press the button.
INSERT:
if the user press the button all the information he/she fill-ups will be saved to the database same with delete, update, sleect
Why i cant insert new data on my database
And how to edit, delete, update and show all the recordsPHP Code:<?php
if(!$_SESSION['user_id']){
redirect('login');
}else{
?>
<link href="../style.css" rel="stylesheet" type="text/css">
<table width="500" border="0" cellpadding="3" cellspacing="1" bgcolor="#ccecff">
<tr>
<td bgcolor="f1f1f1"><table width="500" border="0" cellspacing="0" cellpadding="5">
<tr bgcolor="#333399">
<td colspan="2"><span class="title">Control Panel</span></td>
<td><div align="right"><a href="?logout=true" class="logout">Logout</a></div></td>
</tr>
<tr bgcolor="#333399">
<td colspan="2" class="date">Current date and time:
<?=date('Y-d-m G:i:s.0 T');?></td>
<td><font color="#ffffff"> Welcome <?php echo $_SESSION['user'];?></font></td>
</tr>
<tr>
<td width="30%"><div align="left"><span class="header">Users</span> [ <a href="?disp=main&sub=useradd">add</a> | <a href="?disp=main&sub=userlist">list</a> ]</td>
<td width="30%"><div align="left"><span class="header">Groups</span> [ <a href="?disp=main&sub=groupadd">add</a> | <a href="?disp=main&sub=grouplist">list</a> ]</td>
<td width="30%"><div align="left"></div></td>
</tr>
</table></td>
</tr>
</table>
<?php if($_GET['sub']=='useradd'){?><br>
<form action="index.php?disp=main&sub=useradd" method="post">
<?php
$sql = "INSERT INTO 'trend_001_users' ('user_name','user_pass','user_email','user_fname','user_lname','user_role','user_group') VALUES ('$_POST[funame]', '$_POST[fpasswdA]', '$_POST[femail]' , '$_POST[ffname]', '$_POST[flname]', '$_POST[frole]', '$_POST[fgroup]')";
if ($_POST['save'])
{
mysql_query($sql) or die("Cant add new record");
}
else
{
?>
<table width="500" border="0" cellpadding="3" cellspacing="1" bgcolor="#ccecff">
<tr>
<td bgcolor="f1f1f1"><table width="500" border="0" cellspacing="0" cellpadding="5">
<tr>
<td bgcolor="#333399"><span class="title">Add User</span><div align="right"></div></td>
</tr>
<tr>
<td><div align="left">
<span class="sometext">Please enter some basic information about the user.</span>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td><div align="right" class="someboldtext">User Id <span class="red">*</span> </div></td>
<td width="350"><input name="funame" type="text" class="textfield03" maxlength="30">
(5-30 alphanumeric characters)</td>
</tr>
<tr>
<td><div align="right" class="someboldtext">Password <span class="red">*</span> </div></td>
<td width="350"><input name="fpasswdA" type="password" class="textfield03" maxlength="30">
(5-30 alphanumeric characters)</td>
</tr>
<tr>
<td><div align="right" class="someboldtext">Confirm Password <span class="red">*</span> </div></td>
<td width="350"><input name="fpasswdB" type="text" class="textfield03" maxlength="30" /></td>
</tr>
<tr>
<td><div align="right" class="someboldtext">Email <span class="red">*</span> </div></td>
<td width="350"><input type="femail" name="textfield4" class="textfield03">
(valid email address) </td>
</tr>
<tr>
<td><div align="right" class="someboldtext">First Name <span class="red">*</span> </div></td>
<td width="350"><input name="ffname" type="text" class="textfield03" maxlength="30"></td>
</tr>
<tr>
<td><div align="right" class="someboldtext">Last Name <span class="red">*</span> </div></td>
<td width="350"><input name="flname" type="text" class="textfield03" maxlength="30"></td>
</tr>
<tr>
<td><div align="right" class="someboldtext">Role <span class="red">*</span> </div></td>
<td width="350"><select name="frole" class="textfield03">
<option selected> Administrator </option>
<option> Manager </option>
<option> Secretary </option>
</select></td>
</tr>
<tr>
<td><div align="right" class="someboldtext">Group</div></td>
<td width="350"><select name="fgroup" class="textfield03">
<option selected> Top Level </option>
<option> Mid Level </option>
<option> Low Level </option>
</select></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="save" value="Register"> </td>
</tr>
</table>
</div></td>
</tr>
</table></td>
</tr>
</table>
</form>
<?php
}
?>
<?php } ?>
<?php if($_GET['sub']=='userlist'){?><br>
<form action="index.php?disp=main&sub=userlist" method="post">
<table width="500" border="0" cellpadding="3" cellspacing="1" bgcolor="#ccecff">
<tr>
<td bgcolor="f1f1f1"><table width="500" border="0" cellspacing="0" cellpadding="5">
<tr>
<td bgcolor="#333399"><span class="title">Search Users </span>
<div align="right"></div></td>
</tr>
<tr>
<td><div align="left"> Please enter a search keyword for last name, first name, login, etc.
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr align="left">
<td width="30" class="someboldtext">Keyword:</td>
<td><input name="textfield" type="text" class="textfield03" size="40" maxlength="40">
<input type="submit" name="Submit2" value="Search"></td>
</tr>
</table>
</div></td>
</tr>
</table></td>
</tr>
</table>
<br>
<table width="500" border="0" cellpadding="3" cellspacing="1" bgcolor="#ccecff">
<tr>
<td bgcolor="f1f1f1"><table width="500" border="0" cellpadding="5" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td bgcolor="#333399"><span class="title">User Listing </span>
<div align="right"></div></td>
</tr>
<tr>
<td><div align="left">
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr align="center" bgcolor="#ccecff">
<td class="table1">Login</td>
<td class="table2">First Name </td>
<td class="table2">Last Name </td>
<td class="table2">Email</td>
<td class="table2">Role</td>
<td class="table2">Group</td>
<td class="table1">Last Updated </td>
<td class="table2">Edit</td>
<td class="table2">Delete</td>
</tr>
<tr align="left" bgcolor="#F1F1F1">
<td><a href="#">Lorem</a></td>
<td>Lorem</td>
<td>Ipsum</td>
<td> </td>
<td>Dolor</td>
<td>Sit</td>
<td> 2007-07-07 6:11:22.0</td>
<td><a href="#">Edit</a></td>
<td><a href="#">Delete</a></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr align="left" bgcolor="#F1F1F1">
<td>X users found, displaying X users. </td>
</tr>
</table>
</div></td>
</tr>
</table></td>
</tr>
</table>
</form>
<?php } ?>
<?php if($_GET['sub']=='groupadd'){?><br>
<form action="index.php?disp=main&sub=groupadd" method="post">
<table width="500" border="0" cellpadding="3" cellspacing="1" bgcolor="#ccecff">
<tr>
<td bgcolor="f1f1f1"><table width="500" border="0" cellspacing="0" cellpadding="5">
<tr>
<td bgcolor="#333399"><span class="title">Add Group </span>
<div align="right"></div></td>
</tr>
<tr>
<td><div align="left">
<span class="sometext">Please enter some basic information about the user group.</span>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td><div align="right" class="someboldtext">Group Name</div></td>
<td width="350"><input name="textfield" type="text" class="textfield03" maxlength="30">
</td>
</tr>
<tr>
<td><div align="right" class="someboldtext">Group Description <span class="red"></span> </div></td>
<td width="350"><textarea name="textarea" cols="60" rows="6"></textarea></td>
</tr>
<tr>
<td><div align="right" class="someboldtext">Parent Group </div></td>
<td width="350"><select name="select3" class="textfield03">
<option value="top" selected>Top Level</option>
<option value="mid">Mid Level</option>
<option value="low">Low Level</option>
</select></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="Submit" value="Register"> </td>
</tr>
</table>
</div></td>
</tr>
</table></td>
</tr>
</table>
</form>
<?php } ?>
<?php } ?>