#native_company# #native_desc#
#native_cta#

MySQL sample

By Victor
on June 25, 2001

Version: 1.1.2 php

Type: Sample Code (HOWTO)

Category: Databases

License: Other

Description: Conect to database MySQL

<?
//Iniciando Base de Datos
function Conect()
{
if (!($link=mysql_connect("localhost","user","pass")))
{
echo "<body bgcolor=#000000>";
echo "<font size=2 color=#ffffff face=Verdana>";
echo "Error conectando a la base de datos.";
echo "<br>Posiblemente ocurrio un error interno";
echo "</font></body>";
exit();
}
if (!mysql_select_db("table",$link))
{
echo "<body bgcolor=#000000>";
echo "<font size=2 color=#ffffff face=Verdana>";
echo "Error seleccionando la tabla <b>MySQL</b> de la base de datos.";
echo "<br>Posiblemente ocurrio un error interno";
echo "</font></body>";
exit();
}
return $link;
} $link=Conect();
$result=mysql_query("select * from -table- order by id desc",$link);
?>
<?php
// Easy mode
$d1=mysql_result($result,0,"camp1");
mysql_close()
?>
Name: <b><? echo "$d1"; ?>
with this we showed the name, within the data base

By Dark Zero