Forum Moderators: coopster
here is my code:
<?php
include "inc/dbcfg.inc";
$FirstName = $_REQUEST['FirstName'] ;
$LastName = $_REQUEST['LastName'] ;
$link = mysql_connect($SqlHost, $SqlUser, $SqlPass) or die('Login details incorrect');
if (! $link)
die("Couldn't connect to MySQL");
mysql_select_db($SqlDb , $link)
or die("Couldn't open $SqlDb: ".mysql_error());
mysql_query ("INSERT INTO pre-signups (FirstName, LastName) VALUES ('$FirstName','$LastName')");
mysql_close($link);
?>
I'm not getting any errors, it seems to connect to the db fine, and i can pull data ok. but something is wrong with my code for inserting data,
can anyone please tell me what i've done wrong here?
thanks in advance for your time!
-Ken
I just put everything into one file to make it simple, and made the values static to avoid another other problems like passing form data..
my code:
<?
$DBhost = "domain.ca";
$DBuser = "sql";
$DBpass = "sql";
$DBName = "work";
$table = "pre-signups";
mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database");
@mysql_select_db("$DBName") or die("Unable to select database $DBName");
$sqlquery = "INSERT INTO $table (FirstName, LastName) VALUES(test,test)";
$results = mysql_query($sqlquery);
mysql_close();
?>
and still nothing at all, no errors, and no data when i open the table in mysql?
any other ideas?
-Ken