Ver Mensaje Individual
  #17 (permalink)  
Antiguo 10/02/2011, 16:52
edugilc
 
Fecha de Ingreso: octubre-2009
Mensajes: 154
Antigüedad: 14 años, 6 meses
Puntos: 0
Respuesta: Errores varios en script

Muchas gracias de nuevo!!

Ya lo he probado poniendolo así:
mysql_query($sql)
y sale el mismo error.

el script es esta:




// mysql_func.php

// Always you Include this Library you must include so the Library
// connection_data.php (or any other) to give valids
// Data Base Name, Host Name, User Name and Password


// Into the file connection_data.php
// is definited the setup global variable $MySQL
// if you don't include this Library you need specify
// the Data Base Name, Host Name, User Name and Password to use with.

/* Functions for a simple Database-Interface */
/* ----------------------------------------- */

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_query($sql, $db))
{
if (! $res=mysql_query($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>";
} // tab

// with the option MYSQL_ASSOC takes only the key names of every field

function fetch_array($qid) {
return mysql_fetch_array($qid, MYSQL_ASSOC);
}
function fetch_object($qid) {
return mysql_fetch_object($qid, MYSQL_ASSOC);
}
function fetch_row($qid) {
return mysql_fetch_row($qid);
}
function num_rows($qid){
return mysql_num_rows($qid);
}

function FFAK($queryID) {
// Fetch Full in Array with its Key names
// Return a Full array of Fetched arrays

while ($aux = fetch_array($queryID)) {$array[]=$aux;}
return $array;
}

function FFO($queryID) {
// Fetch Full in Object with its Key names
// Return a Full array of Fetched objects

while ($aux = fetch_object($queryID)){$array[]=$aux;}
return $array;
}

function get_last_id(){
return mysql_insert_id();
}

function num_affected_rows(){
return mysql_affected_rows();
}

?>