Can't pass a string in the GET function
Posted: Mon Dec 22, 2008 11:33 pm
Hi,
I am linking a search page to and Add page. The attributes would be copied from the selected record to another table. I have created my search page using the primary key id - this id is in varchar. I could get my code working ( the code below shows the GET function used. However, the code is only working when the id is INT, how do I get it to accept strings..
include ('connect.php');
$id = $_GET['id'];
$result = mysql_query("SELECT * FROM administrator WHERE Admin_ID=$id");
$row = mysql_fetch_array($result);
I am linking a search page to and Add page. The attributes would be copied from the selected record to another table. I have created my search page using the primary key id - this id is in varchar. I could get my code working ( the code below shows the GET function used. However, the code is only working when the id is INT, how do I get it to accept strings..
include ('connect.php');
$id = $_GET['id'];
$result = mysql_query("SELECT * FROM administrator WHERE Admin_ID=$id");
$row = mysql_fetch_array($result);