Artys Posted October 9, 2006 Report Share Posted October 9, 2006 (edited) Tātad - ir webs, ar DB, db stāv uz MSSQL, bet ir kāds error no kura nekādīgi netieku vaļā... Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: te būtu mans hosts, kuru aizstāju, jo te negribu likt, reklāma in un te ir paths kā arī ---- Fatal error: Call to a member function fetchrow() on a non-object in paths on line 187. 187.līnija : while ($row = $result->fetchrow()) { . Kad palaižu Test DB scriptu, izmet Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: 127.0.0.1 in paths on line 6 Please, check your server connection. Serveris strādā, ar DB itkā viss ok, nesaprotu kur ir probla, iekš php.ini Mssql.secure.connection = On, extention. extension=php_mssql.dll nav ķekša priekšā - ; . Nokonfigurēts Itkā ok, bet maybe kādam bijusi saskarsme ar šo, un var palīdzēt? Ar cieņu, Artis. Edited October 9, 2006 by Artys Link to comment Share on other sites More sharing options...
v3rb0 Posted October 9, 2006 Report Share Posted October 9, 2006 (edited) vispirms piedabū lai šis strādā.. define('MSSQL_HOST_OR_SMTH', ''); define('MSSQL_USER', ''); define('MSSQL_PASS', ''); define('MSSQL_DB', ''); $mssql_link=@mssql_connect(MSSQL_HOST_OR_SMTH, MSSQL_USER, MSSQL_PASS); if(!$mssql_link) { die ('<font color="red">Can not connect to mssql server:'. mssql_get_last_message(). '</font>'); } if(!@mssql_select_db(MSSQL_DB, $mssql_link)) { die ('<font color="red">Could not select db:'. mssql_get_last_message(). '</font>'); } tad tālāk domā par fetchrows.. uz kādas OS php sēž un kāda mssql versija? ja win, un express, tad vajadzēja php nomainīt vienu dll. no linux nav bijis tas gods un vajadzība pie mssql konektēties. Edited October 9, 2006 by v3rb0 Link to comment Share on other sites More sharing options...
Artys Posted October 9, 2006 Author Report Share Posted October 9, 2006 (edited) Seezh uz win xp pagaidaam :) MSSQL 2000 express jaa, kursh *.dll jaanomaina? Edited October 9, 2006 by Artys Link to comment Share on other sites More sharing options...
v3rb0 Posted October 10, 2006 Report Share Posted October 10, 2006 (edited) jāpamēģina nomainīt ntwdblib.dll, gari aprakstīts useru komentāros http://lv.php.net/manual/en/function.mssql-connect.php ņēmu laikam šito http://webzila.com/dll/1/ntwdblib.zip Edited October 10, 2006 by v3rb0 Link to comment Share on other sites More sharing options...
Orion7 Posted October 11, 2006 Report Share Posted October 11, 2006 Pamēģini vai ADODB strādā. Piemērs: <?php function ms_adoconn() { $con = new COM("ADODB.Connection"); $dsn = "DRIVER={SQL Server};SERVER={127.0.0.1};UID={sa};PWD={};DATABASE={DB_NAME}"; $con->Open($dsn); return $con; } function ms_adoquery($con, $que) { $cr = $con->Execute($que); $nc = $cr->Fields->Count(); $table = Array(); $r=0; while(!$cr->EOF) { for($c=0; $c < $nc; $c++) { $table[$r][$c] = $cr->Fields($c)->Value; } $cr->MoveNext(); $r++; } $cr->Close(); return $table; } $qu = "SELECT * FROM TableName"; $db = ms_adoconn(); $stable = ms_adoquery($db, $qu); for($i=0;$i<count($stable);$i++) { $j=0; $out='|'; while(isset($stable[$i][$j])) { $out.=$stable[$i][$j].'|'; $j++; } $out.="\n"; echo $out; } ?> Link to comment Share on other sites More sharing options...
Artys Posted October 11, 2006 Author Report Share Posted October 11, 2006 Izmet error : Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> Microsoft OLE DB Provider for ODBC Drivers<br/><b>Description:</b> [Microsoft][ODBC SQL Server Driver] Invalid object name 'TableName'.' in D:\serveris\xampp\htdocs\tst.php:11 Stack trace: #0 D:\serveris\xampp\htdocs\tst.php(11): com->Execute('SELECT * FROM T...') #1 D:\serveris\xampp\htdocs\tst.php(28): ms_adoquery(Object(com), 'SELECT * FROM T...') #2 {main} thrown in D:\serveris\xampp\htdocs\tst.php on line 11 Varbuut ODBC Probleema? Link to comment Share on other sites More sharing options...
Roze Posted October 11, 2006 Report Share Posted October 11, 2006 Nē normāls paziņojums: Invalid object name 'TableName' Tev tādā TableName tabula eksistē? Link to comment Share on other sites More sharing options...
Artys Posted October 11, 2006 Author Report Share Posted October 11, 2006 amm, nee.. [Microsoft][ODBC SQL Server Driver]Syntax error or access violation Link to comment Share on other sites More sharing options...
bubu Posted October 11, 2006 Report Share Posted October 11, 2006 Syntax error = sintaktiska kļūda. Link to comment Share on other sites More sharing options...
Artys Posted October 11, 2006 Author Report Share Posted October 11, 2006 Nu to iztulkot jebkurš māk, vajag jau risinājumu problēmai :/ Link to comment Share on other sites More sharing options...
Roze Posted October 11, 2006 Report Share Posted October 11, 2006 Risinājums ir pareizi SQL kverijus rakstīt.. bet tā kā domāju ka neviens no foruma useriem nav apvelīti ar telepātiskām spējam lai uzzinātu tava MS SQL servera datubāzu struktūru / laukus tad kā tu stādies priekšā lai tev kāds kaut ko uzraksta priekšā? Ja tu piešķir remote pieeju cita lieta :) Un starp citu kļūdu paziņojumos viss ir skaidri pateikts .. Link to comment Share on other sites More sharing options...
Recommended Posts