|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
displaying a query result
I have a search query result that is linked:
http://www.something.com/recording.php?recordid=2; I need to display the entire record from all the tables that the recordid is identifies. So can anyone please point me on the right track to getting this done. Thanks a lot. Edit: Chumy - i had to change the url because it actually sent you to a porn site. (i just clicked it in front of my boss whops!) |
|
#2
|
|||
|
|||
|
ok, now that ive finished explaining to my boss that devarticles isnt a porn site,
can you explain exactly what your trying to do, your question kinda loses me (messa not thinkin) just give us a small detailed example so i can help you with your query, Ben Rowe |
|
#3
|
|||
|
|||
|
I have a site that I am developing and I used a form submission query to get the recordid that match the keyword entered on the website and link it to a page. My problem is how I can pull the results on the page that is linked to the search result.
e.g. URL I want to display the record on all the tables that match the recordid=5 when the link is clicked. Thanks a million. |
|
#4
|
|||
|
|||
|
Hi. First up, you need to get the recordId variable from the query string:
$recId = $_GET["recordId"] Then you need to setup a MySQL query to grab the records from the database: $s = @mysql_connect("localhost", "user", "password") or die("Couldnt connect"); $d = @mysql_select_db("yourDB", $s) or die("Couldnt select DB"); $r = mysql_query("select * from yourTable where recordId=$recId"); while($r = mysql_fetch_array($r)) { // Print out records here } That's basically it. You would also wanna use is_numeric and some other checks to make sure recId is a valid integer.
__________________
i am cope. i drink coke. i am in hope.i am cope. i drink coke. i am in hope.i am cope. i drink coke. i am in hope. |
|
#5
|
|||
|
|||
|
instead of using
$recId = $_GET["recordId"] u can use the global command global $recordId; just another thing, you could also have a if, then while statement if($r = mysql_fetch_array($r)) { while($r = mysql_fetch_array($r)) { // Print out records here } } that way you can have else statement if they is no records in the database that match the recordId number else { echo 'o records found'; } hope this helps |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > displaying a query result |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|