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

gracias paquetetrueke, que de verdad que si que funcionaba!!!!jajaja

mogurbon, con las comillas ya me han desaparecido los "notice"
ahora sólo me sale lo de la base de datos:

Warning: mysql_query() expects parameter 2 to be resource, string given in C:\Users\eduardo\Desktop\EDU\INFORMATICA\PROYECTO\ xampp-win32-1.7.4-VC6\xampp\htdocs\pagina_16_12\mysql_func.php on line 51

el código es este y no se muy bien que quiere decir con lo de que espera el parametro 2.. :



// 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($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>";
} // 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;
}


/* Added by Natalia Costas */

function get_last_id(){
return mysql_insert_id();
}

function num_affected_rows(){
return mysql_affected_rows();
}

?>