Hi everyone,
I have been working PHP and MySQL and now I need to work with SQL 2005 Server also.
I am new to all the odbc functions within PHP needed to interface with SQL 2005.
Unfortunately, our ISP does not support ODBC connections, so I am doing my testing on my computer (I installed W.A.M.P. on it and I have php 5 installed with the odbc config and I setup the DSN also) and I have been able to query the server.
But I have not been able to find much info out there on the php commands like...
odbc_exec
odbc_fetch_into
odbc_do
odbc_result_all
I have found that I need to do work-arounds for some of these commands. For example, to get the total number of records in a query if I try this...
$db = odbc_connect("DSN","user","pass");
$sql = "SELECT * FROM Products";
$result = odbc_exec($db, $sql);
echo odbc_num_rows($result);
I get a result of -1 (error).
So to get the number of records, I needed to to this...
$result = odbc_exec($connectionstring, $Query);
$count=0;
while($temp = odbc_fetch_into($result,&$counter)){
$count++;
}
echo 'The total number of records is : ' . $count . '<br><br>';
I was wondering does anyone have some sites they found helpfull?
I will not be doing a lot of code for this database, but want to be more knowledgable than I currently am and have not found a lot of helpfull info out there (like a site similar to this forum).
I appreciate the guidance,
Don