You are here: Simple beginners question about inserting data via an URL « PHP Programming Language « IT news, forums, messages
Simple beginners question about inserting data via an URL

Posted by deja on 10/10/07 17:07

Hi all,

For a couple of nights I have been trying to figure something out..

I am trying insert a couple of fields into a database. My url looks
something like this;

www.site.com/addlog.php?var1=blah&var2=blah

The addlog.php script looks like this;

<?php
$dbhost = 'xx';
$dbuser = 'xx';
$dbpass = 'xx';

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or
die ('Error connecting to mysql');

$dbname = 'xx';

mysql_select_db($dbname);
$query = "INSERT INTO log values('$var1','$var2');";
print_r($_GET);
mysql_query($query) or die('Error, insert query failed');

mysql_close($conn);
?>

The var1 variable gets passed on just fine (I even see it echoed back
with the print command).. but var2 seems to dissapear.. It never gets
passed to anywhere..
What am I missing here? When I make the url www.site.com/addlog.php?var2=blah&var1=blah
I just see var2.. so it seems to only accept the 1st variable..?

Alex

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация