Output Validation?

    Date: 03/09/06 (SQL Server)    Keywords: php, mysql, sql

    Hi guys,

    I'm wondering if it's possible to validate the output of an sql query?

    I have the following query/code (using PHP5, and MSSQL):

    $sql = "SELECT TOP 100 PERCENT Mem_Number, Title_1, Name_1, Surname_1, Email, Date_Sent_Renewal, EmailList, Renewal_Date FROM BTCMembers WHERE (DATEDIFF(d, Renewal_Date, GETDATE()) > ".$cutoff.") AND (DATEDIFF(d, Renewal_Date, Date_Sent_Renewal) < 0) AND (Email <> '') AND (Date_Sent_Renewal <> '') AND (EmailList = 1) ORDER BY Mem_Number ASC";

    $result = odbc_exec($contact, $sql); // Run the query


    Now this query works exactly as I expect it to, but some of the data which is pulled could cause minor problems later.

    Specifically, there are a few records which have an "Email" field value of "N/A" -- the fault of dodgy input validation, I know, but I didn't make the input interface. *shrug*

    So, is there a way to write the query so that data pulled from the Email column must make a regular expression valid for email addresses?

    Posted to '[info]'php, '[info]'sqlserver, and '[info]'mysql

    Source: http://community.livejournal.com/sqlserver/45440.html

« SQL Server 2005 setup || Query help... »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home