something wrong w/ this code?
Date: 04/25/06
(PHP Community) Keywords: database, sql
I have a function/wrapper for basic SQL functionality, that looks like so:
function NRE_Insert( $strSQL )
{
$db = mssql_connect( $db_host, $db_user, $db_pass ) or die ( "couldnt connect to server" );
mssql_select_db( $db_name, $db ) or die ("couldnt connect to database." );
$sql_result = mssql_query( $strSQL ) or die ("couldnt execute query" );
}
I'm calling it like so:
$strSQL = "Insert Into AMGvenues(venueName, venueLink) Values('$venueName', '$venueLink')";
NRE_Insert( $strSQL );
Everything looks fine to me, but I'm constantly getting the "couldn't execute query" message. As far as I can tell, I do have the correct DB permissions (this is MS SQL Server, btw).
does anything look blatantly wrong to you guys? It's 1am, and I'm just not seeing the problem clearly anymore.
thanks.
Source: http://community.livejournal.com/php/444381.html