How to solve this problem with PHP

vaneetagoswami

Well-known member
Registered
Joined
Mar 6, 2014
Messages
140
Points
0
Looking for the logic from you guys...


if(isset($_POST['submit']))
{

$ssql = mysqli_query($con, "SELECT * FROM `register`");
// $nrows= mysqli_num_rows($ssql);
echo "<table border=5 table style=margin-top: 252px; font-size: larger; font-style: oblique; bgcolor=#05fa8c>
<tr>
<td width=10% height= 10%><b>User Name:</b></td>
<td width=10% height= 10%><b>First Name:</b></td>
<td width=10% height= 10%><b>Last Name:</b></td>
<td width=10% height= 10%><b>Password:</b></td>
<td width=10% height= 10%><b>Email:</b></td>
<td width=10% height= 10%><b>Role Type:</b></td>
<td width=10% height= 10%><b>About:</b></td>
<td width=10% height= 10%><b>Edit<b></td>
<td width=10% height= 10%><b>Delete</b></td>
</tr>";

while($row = mysqli_fetch_array($ssql)){


$uname = $row['username'];
$fname = $row['firstname'];
$lname = $row['lastname'];
$pwd = $row['password'];
$emal = $row['email'];
$rol = $row['role'];
$abt = $row['profession'];

echo "<tr>
<td width=10% height= 10%>$uname</td>
<td width=10% height= 10%>$fname</td>
<td width=10% height= 10%>$lname</td>
<td width=10% height= 10%>$pwd</td>
<td width=10% height= 10%>$emal</td>
<td width=10% height= 10%>$rol</td>
<td width=10% height= 10%>$abt</td>
<td width=10% height= 10%><a href=edit_records.html>Edit</a></td>
<td width=10% height= 10%><a href=edit_records.html>Delete</a></td>
</tr>";
}
echo "</table>";
I did this for table view. Now I want that when I click on edit option than that particular record is open and I edit that and after that fire the update query to save the data into database. I did this through id easily but I didn't maintain it for this table this is why I'm worried. Can you guys help me in this.. I am learning php by profession I'm se optimizer. Looking forward for your help..
 

webdesign

Well-known member
Joined
Jul 5, 2012
Messages
120
Points
0
Using this code

Code:
$('#yourTextBoxId').keypress(function(e){ 
   var myValue = $(this).val();
   $.ajax({
      url:'resultfile.php',
      type: 'POST',
      data:{myValue:myValue}
   });
});
In your resultfile.php you wil get the data ( input value ) from Ajax sent to your file, using MySQL update command to do it in this file. After done, it will returned new value (by Ajax) to your form without refresh web page.

You will need to use Ajax/PHP/MySQL in this case.

I only show you ways to do, I can write complete script for you here.

:)
 
Newer Threads
Replies
6
Views
4,705
Replies
5
Views
8,225
Replies
4
Views
3,590
Latest Threads
Replies
1
Views
26
Replies
0
Views
189
Replies
1
Views
40
Replies
2
Views
83

Latest postsNew threads

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top