Jump to content

[SOLVED] Newbie query - GET Command


marco839

Recommended Posts

Hiya,

 

I'm trying to use the idea of file.php?id=1 to grab a row and display it on the page. below is my script..

 

<?php
  $id = $_GET['id'];

  mysql_connect("LOCALHOST", "USERNAME", "PASSWORD");
  mysql_select_db("DATABASE") or die( "Unable to connect to database");
  $result = mysql_query("SELECT * FROM linkcount WHERE id='$id'");
  $row = mysql_fetch_array($result);
echo "Name: ".$row["name"];
echo "<br>Addres: ".$row["address"];
echo "<br>Postcode: ".$row["postcode"];
echo "<br>Telephone: ".$row["telephone"];
echo "<br>Website: ".$row["website"];
?>

 

I'm trying to have the system load from id1 the details (e.g. file.php?id=2 will load row #2.. 3 #3... etc)

But, it won't display and information - any ideas?

 

Thanks very much for any help,

 

Marco

Link to comment
https://forums.phpfreaks.com/topic/65471-solved-newbie-query-get-command/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.