Hello all
I have a php code that connects with odbc in mdb database and I want to change that and connect to an mysql database
the original code is :
Can someone change the command to connect with mysql?
I tried but I cant handel it. It gives error when I try to change the odbc_exec and odbc_fetch_row.
Connection string is ccdatabase,loca lhost,root,nopa ssword
Thanks in advance.
I have a php code that connects with odbc in mdb database and I want to change that and connect to an mysql database
the original code is :
Code:
<?php
# connect to a DSN "mydb"
$connect = odbc_connect("mydb", "", "");
# queries
$sql="SELECT * FROM Transactions";
#perform the querries
$rs=odbc_exec($connect, $sql) or die(" ".odbc_errormsg()); ;
if (!$rs)
{
exit("Error in SQL");
}
while (odbc_fetch_row($rs)){
$mid=odbc_result($rs,"MerchantID");
$mr=odbc_result($rs,"MerchantRef");
$am=odbc_result($rs,"Amount");
$cr=odbc_result($rs,"Currency");
echo "$mid";
echo "$mr";
echo "$am";
echo "$cr";
# close the connection
odbc_close($connect);
?>
I tried but I cant handel it. It gives error when I try to change the odbc_exec and odbc_fetch_row.
Connection string is ccdatabase,loca lhost,root,nopa ssword
Thanks in advance.
Comment