hello,
i am currently having challenges in passing form parameters into an mssql database query from within php.
I'm running running php 5 on apache 2 connecting to mssql server 2008 on windows 7.
the code below is a link from a login page where the form parameter is gotten:
<?php
$server = 'myserver1';
// Connect to MSSQL
$link = mssql_connect($server, 'user1', 'passwrd1');
if (!$link) {
die('Something went wrong while connecting to MSSQL');
}
mssql_select_db('bizinfo_db', $link);
$pnlusername = $_POST['pnlusername'];
$pnlpassword = $_POST['pnlpassword'];
$query = mssql_query('SELECT Title, Surname, FirstName FROM PeoplesRec where Username = '$pnlusername' ');
if (!$result) {
die('Query failed.');
}
// Select every 4th student in the results
for ($i = mssql_num_rows($result) - 1; $i % 4; $i++) {
if (!mssql_data_seek($result, $i)) {
continue;
}
// Fetch the row ...
}
if (!$result) {
die("Database");
}
// Free the query result
mssql_free_result($result);
// Close the link to MSSQL
mssql_close($link);
?>
what could be wrong in the parameter assignment as highlighted in red.
Regards.