Rhawn Posted January 22, 2007 Share Posted January 22, 2007 I am creating an outlink .php file. Users are linked to my .php file, which sends them to another link.I am trying to pull some data into a database I made. The database is created, the table is name kw_track. It has 3 columns: Site, Timestamp, Keyword.Here is some code I copied and altered, but does not work. It is not inserting any data into the table.[code]<php>header("Location: http://www.outsidelink.com/");?>$now=time();$dbh=mysql_connect ("localhost", "username", "password") or die ('I cannot connect to the database because: ' . mysql_error());mysql_select_db ("database name");$res = mysql_query("INSERT INTO `kw_track` (`Website`, `Time_Stamp`, `Keyword`)VALUES ('$site', '$now', '$keywordvar')",$dbh);[/code]The values $site and $keywordvar are hopefully passed from the original link.Any help is appreciated Quote Link to comment Share on other sites More sharing options...
printf Posted January 22, 2007 Share Posted January 22, 2007 If there past by a query string, then they are $_GET type variables, so you need to assign them using $_GET[code]$now = time ();mysql_connect ( 'localhost', 'username', 'password' ) or die ( 'I cannot connect to the database because: ' . mysql_error () );mysql_select_db ( 'database' );mysql_query ( "INSERT INTO kw_track VALUES ( '" . mysql_real_escape_string ( $_GET['site'] ) . "', '" . $now . "', '" . mysql_real_escape_string ( $_GET['keywordvar'] ) . "' );" );[/code]printf Quote Link to comment Share on other sites More sharing options...
Rhawn Posted January 22, 2007 Author Share Posted January 22, 2007 No, its being passed in a link. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.