Jump to content
php.lv forumi

MYSQL + PHP = vajag paliidziibu


ray

Recommended Posts

lieta taad, ka esmu beidzot izdomaajis paariet no ASP uz PHP, jo neviens LV hostings man manu ASP nenjem pretii, bet runa nav par to.

ir taa, ka es gribu datu baazes tabulas aaraa dabuut datus, bet man kkaa nesanaak, varbuut kaads var paliidzeet.

 

<?

require($_SERVER["DOCUMENT_ROOT"]."/config/conn.php");

$connection = @mysql_connect($db_host, $db_user, $db_password) or die("error connecting");

mysql_select_db($db_name, $connection);

 

$query = "Select * from menu";

$result = @mysql_query($query, $connection) or die (mysql_error());

$izvade = @mysql_fetch_array($result);

 

echo "<a href=\"".$izvade["adrese"]."\">"$izvade["nosaukums"]."</a>";

 

?>

Link to comment
Share on other sites

kaadus kljudas pazinjojumus izmet?

testiem nonjem no f-jam nost @ tad redzeesi kur errors...

P.S.

var iisaak nemaz nezraadot to $connection..

$connection = mysql_connect($db_host, $db_user, $db_password) or die("error connecting");

mysql_select_db($db_name);

$query = "Select * from menu";

$result = mysql_query($query) or die (mysql_error());

$izvade = mysql_fetch_array($result);

-------

Link to comment
Share on other sites

ljoti iespeejams ka tev taa tabula ir tuksha :)

tas arii viss ...

"adrese" vai arii nav shaada lauka

P.S. sajaa gadijumaa gan praatiigaak buutu izmantot ' vienkarshaas pedinjas

Daudz parskataamaaks kods

echo '<a href=" '.$izvade['adrese'].'">'.$izvade['nosaukums'].'</a>';

 

piedevaam tiko pamaniju ">".$izvade

..... nebija .

Link to comment
Share on other sites

Palaizhot shito kodu izmet zemaak paraadiito kluudu.

 

<?

$db_host = "localhost";

$db_user = "root";

$db_password = "parole";

$db_name = "datubaze";

 

$connection = mysql_connect($db_host, $db_user, $db_password) or die("error connecting");

mysql_select_db($db_name);

$query = "Select * from menu";

$result = mysql_query($query) or die (mysql_error());

$izvade = mysql_fetch_array($result);

echo '<a href=" '.$izvade['adrese'].'">'.$izvade['nosaukums'].'</a>';

 

?>

Kļūda:

Call to undefined function mysql_connect() in E:\PHP\menu.php on line 3

 

 

bet ieraksta

connection = @mysql_connect($db_host, $db_user, $db_password) or die("error connecting");

tad ekraans balts un neko neizvada, kaut arii datubaazee ir ieraksts (viena kolonna, kur visi 5 lauki aizpildiiti)

Edited by ray
Link to comment
Share on other sites

Nu a tur rakstīts ir ka mysql_connect() funkcija neksistē, kas nozīmē ka php nav MySQL atbalsta, kas nozīmē ka uz windozes php.ini bija jāatkomentē mysql ekstensija (tas uz 5.x php)..

 

Izlasam http://lv.php.net/mysql PHP 5+ Installation on Windows Systems

 

1. atveram php.ini atkomentējam extension=php_mysql.dll

2. libmysql.dll jaiekopē windows/system direktorijā (vai jebkurā citā kas ir PATH encirounment variablī)

 

 

Tāds arī sakars ar lasīšanu..

Link to comment
Share on other sites

×
×
  • Create New...