Inserting $_GET data from URL to database ...
Posted: Mon Dec 27, 2010 11:09 am
Hi, all! I wanna ask something. Well, here's a code:
HTML:
<a href="something.php?pid=somevalue">Link</a>
something.php:
where: column1 is of type longtext and column2 is of type int.
(Database connection assumed)
After running something.php, I checked the table using SELECT on MySQL, and somevar becomes zero. Why is it so?
Thanks in advance.
HTML:
<a href="something.php?pid=somevalue">Link</a>
something.php:
Code: Select all
<?php
$somevar = $_GET['pid'];
$insert = mysql_query("INSERT INTO table (column1, column2) VALUES ('sometext', '{$somevar}')");
?>
(Database connection assumed)
After running something.php, I checked the table using SELECT on MySQL, and somevar becomes zero. Why is it so?
Thanks in advance.