0

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>

Edited by Dani: Formatting fixed

2
Contributors
7
Replies
13
Views
5 Years
Discussion Span
Last Post by diafol
0
<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?

0

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

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.