Reputation: 1
I have a PHP document where I get mysql info:
$db = mysql_select_db('opinaol', $connection) or die ("Couldn't select database.");
$search=$_POST['search'];
$data = 'SELECT * FROM `contratosnmx` WHERE `_rowid_` = 2 ';
$query = mysql_query($data) or die("Couldn't execute query. ". mysql_error());
$data2 = mysql_fetch_array($query);
So the form shows the info.
What I want is a way to change the _rowid_
on the page so I can select the row number and have the form change the info displayed.
Upvotes: 0
Views: 204
Reputation: 161
You can set _rowid_
using GET parameters.
$rowid = 1; // default value
if (isset($_GET['_rowid_'])) {
$rowid = intval($_GET['_rowid_']);
}
$data = 'SELECT * FROM `contratosnmx` WHERE `_rowid_` = '.$rowid; // no need to escape $rowid value because we used intval().
If your page has url http://domain.com/page.php
, then you can request information with rowid = 10 using next url:
http://domain.com/page.php?_rowid_=10
Upvotes: 1