VitoCorleone
Programmer
Hi,
I have the following script that inserts data into my SQL database. its a simple insert query to check if it works! but when i search my database, a new rowhasbeen added but it is blank.
I have looked at my code but cant find anything, can you?
<?php
global $strstaff;
// Database connection variables
$dbServer = "localhost";
$dbDatabase = "dreamhome";
$dbUser = "root";
$dbPass = "harry";
$sConn = mysql_connect($dbServer, $dbUser, $dbPass)
or die("Couldn't connect to database server");
$dConn = mysql_select_db($dbDatabase, $sConn)
or die("Couldn't connect to database $dbDatabase");
$dbQuery = "INSERT INTO staff2 (staff_no) VALUES ";
$dbQuery .= "('$strstaff')";
mysql_query($dbQuery) or die("Couldn't add file to database");
echo "<h1>File Uploaded</h1>"
?>
This is a 2 page insert method. the first page has a simple form which in the form header has
<form enctype="multipart/form-data" name="frmUploadFile" action="grabfile.php" method="post">
and the textbox is called strstaff, hence $strstaff in the PHP code above.
and my database only consists of one column staff_no.
I have the following script that inserts data into my SQL database. its a simple insert query to check if it works! but when i search my database, a new rowhasbeen added but it is blank.
I have looked at my code but cant find anything, can you?
<?php
global $strstaff;
// Database connection variables
$dbServer = "localhost";
$dbDatabase = "dreamhome";
$dbUser = "root";
$dbPass = "harry";
$sConn = mysql_connect($dbServer, $dbUser, $dbPass)
or die("Couldn't connect to database server");
$dConn = mysql_select_db($dbDatabase, $sConn)
or die("Couldn't connect to database $dbDatabase");
$dbQuery = "INSERT INTO staff2 (staff_no) VALUES ";
$dbQuery .= "('$strstaff')";
mysql_query($dbQuery) or die("Couldn't add file to database");
echo "<h1>File Uploaded</h1>"
?>
This is a 2 page insert method. the first page has a simple form which in the form header has
<form enctype="multipart/form-data" name="frmUploadFile" action="grabfile.php" method="post">
and the textbox is called strstaff, hence $strstaff in the PHP code above.
and my database only consists of one column staff_no.