A href link using new server-side script for PHP and MySQL
A href link using new server-side script for PHP and MySQL
Hi,
I'm having a few problems with the output line. I'm trying to link to a page to display the data from a particular ID. I think i'm not escaping $sIndexColumn properly.
[code]$sOutput .= '"'."".str_replace('"', '\"', $aRow[ $aColumns[$i] ]).''.'",';[/code]
I'm having a few problems with the output line. I'm trying to link to a page to display the data from a particular ID. I think i'm not escaping $sIndexColumn properly.
[code]$sOutput .= '"'."".str_replace('"', '\"', $aRow[ $aColumns[$i] ]).''.'",';[/code]
This discussion has been closed.
Replies
[code]
$sOutput .= '"'.str_replace( '"', '\"', ''.$aRow[$aColumns[$i]].'' ).'",';
[/code]
Allan
Thanks for the input. That sort of worked, but all it did was output the variable ID so now index.php?ID=ID.
This is my complete code:
[code]
$aColumns = array('id','reference','date','name','company');
$sTable = "report";
$sTable2 = "company";
$sTable3 = "users";
$gaSql['user'] = "";
$gaSql['password'] = "";
$gaSql['db'] = "";
$gaSql['server'] = "";
$gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
die( 'Could not open connection to server' );
mysql_select_db( $gaSql['db'], $gaSql['link'] ) or
die( 'Could not select database '. $gaSql['db'] );
$sLimit = "";
if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
{
$sLimit = "LIMIT ".mysql_real_escape_string( $_GET['iDisplayStart'] ).", ".
mysql_real_escape_string( $_GET['iDisplayLength'] );
}
if ( isset( $_GET['iSortCol_0'] ) )
{
$sOrder = "ORDER BY ";
for ( $i=0 ; $i
Allan