Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/06/2004, 05:02
br Alexius
 
Fecha de Ingreso: junio-2004
Ubicación: Puerto Rico
Mensajes: 9
Antigüedad: 19 años, 10 meses
Puntos: 0
Conectar a mysql

Saludos
Tengo una duda de como conectar este php script an mi servidor
Alguien tiene idea como hacerlo?
El mismo es uno para mostrar mis ultimos mensages del web en la pagina de inicio ( index.htm )

<?php
//*******DB-Connection*******
$db=mysql_connect("localhost","dbuser","dbpassword ") or die ("Cannot connect to server.");
mysql_select_db("dbName",$db) or die ("Could not select database.");

// forum id & limit numer
$newsitems = 5;
$forumspath = "/forums";

// create sql statement
$sql = "SELECT threadid, title, forumid, replycount, postusername, postuserid, lastposter, dateline, iconid FROM thread WHERE forumid = 9 or forumid = 10 ORDER BY threadid DESC LIMIT $newsitems";

//execute sql query
$sql_result = mysql_query($sql, $db) or die ("Could not execute query.");

if (!$sql_result) {
echo "<p>Could not get record.";
}

while ($row = mysql_fetch_array($sql_result)) {
$threadid = $row["threadid"];
$thetitle = $row["title"];
$forumid = $row["forumid"];
$postusername = $row["postusername"];
$postuserid = $row["postuserid"];
$iconid = $row["iconid"];

//******Print Headlines*******
?>
<link rel="stylesheet" href="default.css" type="text/css">
<body>
<a href="file:///C|/ALEXIS%20STUFF/HTML/<? echo $forumspath; ?>/showthread.php?t=<? echo $threadid; ?>">
<? echo $thetitle; ?>
</a> by: <i>
<? echo $postusername; ?>
</i>
<?
}
//disconnect
mysql_free_result($sql_result);
mysql_close($db);
?>


El script lo hiso un amigo
Soy nuevo en esto