PDA

View Full Version : setting a variable from several $_GET's in the url



Xiwl
02-05-2007, 09:45 PM
i have this

$pin = " . $_GET['first']; . " . $_GET['second']; . " . $_GET['third']; . " . $_GET['final']; . "

but it doesnt work, how do i set a variable from more than one $_GET part of the url or from several pieces of post data, so i can easily insert them into a db.

Dentafrice1
02-05-2007, 09:47 PM
Remove ; after every get

Xiwl
02-05-2007, 09:49 PM
still dont work :P

Heinous
03-05-2007, 06:04 AM
Change it to..

$pin = $_GET['first'] . $_GET['second'] . $_GET['third'] . $_GET['final'];

Xiwl
03-05-2007, 03:58 PM
dont work this is what im trying to do

$query = mysql_query("INSERT INTO entrys (pin) VALUES('$_GET['first'] . $_GET['second'] . $_GET['third'] . $_GET['final'];')");

Drompo
03-05-2007, 04:04 PM
$first = "$_GET['first']";
$second = "$_GET['second']";
$third = "$_GET['third']";
$final = "$_GET['final]";
$pin = "$first $second $third $final";
mysql_query("INSERT INTO `entrys` (`pin`) VALUES ('$pin')") or die ("mysql_error()");
Try that

Xiwl
03-05-2007, 07:38 PM
still need help -.-

Drompo
03-05-2007, 07:48 PM
Tryed Mine?

Xiwl
03-05-2007, 08:10 PM
yep didnt work

Mentor
03-05-2007, 09:27 PM
Ok so on the assumption by the end of it the GET string after the file name is

?first=1&second=2&third=3&final=4
(the 1234 can be subsituted for any pin. Then in full


$pin = http_vars_get['first'].http_vars_get['second'].http_vars_get['third'].http_vars_get['final'] ;
mysql_query("INSERT INTO `entrys` (`pin`) VALUES ('$pin')") or die ("mysql_error()");

Tomm
04-05-2007, 11:46 AM
http_vars_get should not be used. Its totally outdated. You should use $_GET.

Ok so on the assumption by the end of it the GET string after the file name is

?first=1&second=2&third=3&final=4
(the 1234 can be subsituted for any pin. Then in full


$pin = http_vars_get['first'].http_vars_get['second'].http_vars_get['third'].http_vars_get['final'] ;
mysql_query("INSERT INTO `entrys` (`pin`) VALUES ('$pin')") or die ("mysql_error()");

Mentor
04-05-2007, 05:46 PM
http_vars_get should not be used. Its totally outdated. You should use $_GET.

Get doesnt seem to be working, hence its possible that his server could just be running an outdated php version, if thats the case http_vars_get will get the data wanted. And if its not, will work on modern installations (dispite being deprecated anyway)

Heinous
06-05-2007, 06:47 AM
dont work this is what im trying to do

$query = mysql_query("INSERT INTO entrys (pin) VALUES('$_GET['first'] . $_GET['second'] . $_GET['third'] . $_GET['final'];')");
It should be..

$query = mysql_query("INSERT INTO entrys (pin) VALUES('" . $_GET['first'] . $_GET['second'] . $_GET['third'] . $_GET['final'] . "')");

You had it wronggg.

Want to hide these adverts? Register an account for free!