Jump to content

[solved] Mysql Query Linked To New Page (php)


Savvi
 Share

Recommended Posts

Hello~I hope you guys can help me out here with this problem I am having.I don't know how to put in words, so I'll use pictures to show you too.linktophp.jpgHere, I have an php page that display's a list of personal data via mysql.Beside the table rows is a button generated along with the data which would allow the user to click it and display that specific data on a new php page (a page that will have an edit or delete button etc etc)So far, this is the code for the listed page (table).

<table id="dataTable" margin="0">	<tr>		<td id="emptyTableBar"></td><td id="tableBar" width="40">ID</td><td id="tableBar" width="150">First name</td> <td id="tableBar" width="150">Surname</td><td id="tableBar" width="100">D.O.B</td> <td id="tableBar" width="150">Nation</td><td id="tableBar" width="150">Sport</td> <td id="tableBar" width="140">Type</td>	</tr>		<?php	$d='</td><td>';	for ($k=0;$k<$n;$k++) {													$sql = mysql_fetch_assoc($c);							echo ('<tr><td id="emptyTableBar"><a href="individual.php"><img src="images/selectButton.jpg" border="0" margin="1"></a>'.$d.$sql["id"].$d.$sql["first"].$d.$sql["last"].$d.$sql["dob"].$d.$sql["nation"].$d.$sql["sport"].$d.$sql["type"].'</td></tr>'); }	?>	</table>

And this is the individual's

<table id="dataTable" margin=0;>	<tr>	<td id="tableBar" width="40">ID</td> <td id="tableBar" width="150">First name</td> <td id="tableBar" width="150">Surname</td> <td id="tableBar" width="100">D.O.B</td> <td id="tableBar" width="150">Nation</td> <td id="tableBar" width="150">Sport</td> <td id="tableBar" width="140">Type</td>	</tr>	<?php	$sql= "SELECT * FROM person WHERE 1 LIMIT 0, 30";	$d='</td><td>';	echo ('<tr><td>'.$sql["id"].$d.$sql["first"].$d.$sql["last"].$d.$sql["dob"].$d.$sql["nation"].$d.$sql["sport"].$d.$sql["type"].'</td></tr>');?></table>

sorry for the long codes >_>;- My button at the moment is only a link to the PHP page.- Second page don't have anything to grab the any data at the moment.And I've tried different methods which I don't know who to work through.like adding '?id={$k}' at the link and hoping to somehow grab it with $_GET but that's only with 'method' inputs?I hope you guys understand what I'm getting at and that you can help me :);Savvi

Edited by Savvi
Link to comment
Share on other sites

You could do this:...<a href="individual.php?id=' . $sql["id"] . '">...and then find that in $_GET['id'].
OK, that seems like a plan, thankyou!will try that.~Update~Thankyou!It worked like a charm. :)I can carry on working on updating, deleting etc untill I get to Date validation (Another problem I'm fearing)Well, this one is now solved. Edited by Savvi
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...