
15/03/2010, 11:49
|
| | Fecha de Ingreso: octubre-2009
Mensajes: 154
Antigüedad: 15 años, 5 meses Puntos: 0 | |
Respuesta: expediente x te refieres a esto?
myconnect();
function myconnect() {
global $MySQL;
if (! $linkid=mysql_connect("$MySQL->Host","$MySQL->User","$MySQL->Passw")) {
echo "The connection to ",$MySQL->Host," could not be established <br>";
exit;
mysql_query( "SET NAMES utf8", $linkid );
mysql_query( "SET CHARACTER SET utf8", $linkid );
}
return $linkid;
}
function createdb($db, $lkid) {
if (! $res=mysql_create_db($db, $lkid)) {
echo mysql_error($lkid);
exit;
}
return $res;
}
function send_sql($db, $sql) {
if (! $res=mysql_db_query($db, $sql)) {
echo mysql_error();
exit;
}
return $res;
}
function tab_out($result) {
$anz=mysql_num_fields($result);
echo "<table width=68% border=0 cellpadding='2' cellspacing='2'>";
echo "<tr bgcolor=#D0D0D0>";
for ($i=0;$i<$anz;$i++){
echo "<th>";
echo mysql_field_name($result,$i);
echo "</th>";
}
echo "</tr>";
echo "<tr>";
while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
foreach ($row as $elem) {
echo "<td bgcolor='#E8E8E8'><font size='-1'>$elem</font></td>";
}
echo "</tr>";
}
echo "</table>"; |