hello, i need some help with my source code. can anyone explain how to create a button to view next record from my database in php? sorry for my bad english

<?php
session_start();

if(isset($_SESSION['id']))
    echo "Selamat Datang,".$_SESSION['id']."!";

else
    die('Tiada maklumat yang dicapai. Sila <a href="../index.php">login</a></h1> semula!');

$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect to database: ' . mysql_error());
  }

mysql_select_db("db_ikerja",$con);


$result = mysql_query("SELECT * FROM profile");
$row = mysql_fetch_array($result)

?>

<html>                 
<td><?php echo['name']; ?></td>
<td><?php echo['age']; ?></td>
<td><?php echo['gender']; ?></td>

<input type=button onClick="" value='Next'>
</html>
Member Avatar for diafol
<button id="next">next</button>

You have a few options:
1. you can place all records into a php array and then place the data into a js array - so that button clicks just navigate through the js data - no need for ajax/server intervention
2. you can submit the form via ajax, so that there is a server and db server call every time, but the page doesn't refresh
3. you can submit the form to the server

which do you want to do?

i thing 2 is ok. since i dont need to refresh the page.

Member Avatar for diafol

OK so do you want to do this via vanilla js or a framework like jQuery?

what is different between vanilla js or a framework like jQuery ?

Member Avatar for diafol

Jquery makes it easier

so how to use Jquery ? any tutorial that i can learn ?

Member Avatar for diafol

Have you googled jQuery? If so, you will have found the website and the tutorials that go with it. Bye.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.