Acabo de recibir otro problema con SQL y esta vez, mysql_error () es no tirar nada...de hecho,...no es que me da toda la información de por qué no su trabajo.
Bueno...el único error que veo es la que tengo mi clase db escribir en mi propio registro
[Vie Abr 01 de 07:22:15 PM] Error al establecer MySQL recursos. SQL utilizada: "INSERT INTO` cms_track `(` TrackID `,` ID de usuario "," user-agent `,` pageFrom `,` pageTo `,` timeVisited `,` userIP `) VALUES (" 0 "," 0 ", Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv: 1.9.2.16) Gecko/20110319 Firefox/3.6.16, "nulo", C: / wamp / www / CMS / index.php ", 1301685735 ", 127.0.0.1)"
Pero en cuanto a por qué, mysql_error () no es tirar cualquier cosa y yo no lo sé. Había 2000 + entradas en ella así que sé que trabajaba y entonces pensé que era posible que sólo había demasiadas entradas, por lo que trunca la tabla, pero todavía me da el mismo error.
Otra cosa extraña, que a pesar de su me da el error, el SQL se sigue realizando lo que me lleva a creer que el error viene de mi función de SQL en lugar del propio SQL.
A continuación se muestra la función que utilizo:
<?php
public function resource($sql = null, $return = false)
{
// Checking if we are connected to MySQL
if(!is_resource($this->mysql_link))
{
$this->connect();
}
// Checking if the SQL is empty
if(is_null($sql))
{
$sql = $this->get_last_sql();
}
// Getting the resource into a variable
$resource = mysql_query($sql);
// Setting the last result variable
$this->last_result = $resource;
// Checking if the resource was created properly
if(is_resource($resource))
{
// Checking if we are returning the result
if($return)
{
return $resource;
}
// Otherwise we are returning true
return true;
}
else
{
// Logging the error if need be
if($this->log_errors === true)
{
$this->log_error('Error setting MySQL Resource. SQL used: "' . $sql . '"');
}
// Checking if we need to kill the script
if($this->silent == false)
{
die(mysql_error());
}
// It was a failure... return false
return false;
}
}
?>
- <?php
- public function resource($sql = null, $return = false)
- {
- // Checking if we are connected to MySQL
- if(!is_resource($this->mysql_link))
- {
- $this->connect();
- }
-
- // Checking if the SQL is empty
- if(is_null($sql))
- {
- $sql = $this->get_last_sql();
- }
-
- // Getting the resource into a variable
- $resource = mysql_query($sql);
-
- // Setting the last result variable
- $this->last_result = $resource;
-
- // Checking if the resource was created properly
- if(is_resource($resource))
- {
- // Checking if we are returning the result
- if($return)
- {
- return $resource;
- }
-
- // Otherwise we are returning true
- return true;
- }
- else
- {
- // Logging the error if need be
- if($this->log_errors === true)
- {
- $this->log_error('Error setting MySQL Resource. SQL used: "' . $sql . '"');
- }
-
- // Checking if we need to kill the script
- if($this->silent == false)
- {
- die(mysql_error());
- }
-
- // It was a failure... return false
- return false;
- }
- }
- ?>
"Bring forth therefore fruits meet for repentance:" Matthew 3:8