Problem with Add Recordsets
Friends, I am a client and subscribers to WebAssist, and I have a general problem with php in a page I'm doing. When I want to add more than one recordset, I get an error that never happened to me. Before I added several recordsets on a page and everything worked properly, now I can not get because I get the following error:
Fatal error: Cannot redeclare GetSQLValueString() (previously declared in
C:\wamp\www\delrecords\index.php:3) in C:\wamp\www\delrecords\index.php on line 63
Also, I send the page code for review based on the error. Thank you.
The Code:
<?php require_once('Connections/delrecords.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . date("Y-m-d",strtotime($theValue)) . "'" : "NULL";
break;
case "time":
$theValue = ($theValue != "") ? "'" . date("H:i:s",strtotime($theValue)) . "'" : "NULL";
break;
case "datetime":
$theValue = ($theValue != "") ? "'" . date("Y-m-d H:i:s",strtotime($theValue)) . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . date("Y-m-d",strtotime($theValue)) . "'" : "NULL";
break;
case "time":
$theValue = ($theValue != "") ? "'" . date("H:i:s",strtotime($theValue)) . "'" : "NULL";
break;
case "datetime":
$theValue = ($theValue != "") ? "'" . date("Y-m-d H:i:s",strtotime($theValue)) . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$maxRows_portadas = 5;
$pageNum_portadas = 0;
if (isset($_GET['pageNum_portadas'])) {
$pageNum_portadas = $_GET['pageNum_portadas'];
}
$startRow_portadas = $pageNum_portadas * $maxRows_portadas;
mysql_select_db($database_delrecords, $delrecords);
$query_portadas = "SELECT * FROM portadas ORDER BY portadasid DESC";
$query_limit_portadas = sprintf("%s LIMIT %d, %d", $query_portadas, $startRow_portadas, $maxRows_portadas);
$portadas = mysql_query($query_limit_portadas, $delrecords) or die(mysql_error());
$row_portadas = mysql_fetch_assoc($portadas);
if (isset($_GET['totalRows_portadas'])) {
$totalRows_portadas = $_GET['totalRows_portadas'];
} else {
$all_portadas = mysql_query($query_portadas);
$totalRows_portadas = mysql_num_rows($all_portadas);
}
$totalPages_portadas = ceil($totalRows_portadas/$maxRows_portadas)-1;
mysql_select_db($database_delrecords, $delrecords);
$query_text = "SELECT * FROM textofrontal";
$text = mysql_query($query_text, $delrecords) or die(mysql_error());
$row_text = mysql_fetch_assoc($text);
$totalRows_text = mysql_num_rows($text);
mysql_select_db($database_delrecords, $delrecords);
$query_imgs = "SELECT * FROM imagenesfront ORDER BY imagenfrontid DESC";
$imgs = mysql_query($query_imgs, $delrecords) or die(mysql_error());
$row_imgs = mysql_fetch_assoc($imgs);
$totalRows_imgs = mysql_num_rows($imgs);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Del Records - Toda la Música con los mejores talentos musicales.</title>
</head>
<body onload="MM_preloadImages('plugins/images/botones/home2.png','plugins/images/botones/artistas2.png','plugins/images/botones/giras2.png','plugins/images/botones/videos2.png','plugins/images/botones/downloads2.png','plugins/images/botones/contacto2.png')">
<div id="outerWrapper">
<div id="header">
<div id="logo"></div>
<div id="bannertop"><img src="images/todalamusica.png" alt="" width="600" height="165" /></div>
</div>
<div id="topNavigation">
<table width="100%">
<tr>
<td align="center"><a href="index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image1','','plugins/images/botones/home2.png',1)"><img src="images/botones/home.png" alt="Home" width="150" height="35" border="0" id="Image1" /></a></td>
<td align="center"><a href="artistas.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image2','','plugins/images/botones/artistas2.png',1)"><img src="images/botones/artistas.png" alt="Artistas" width="150" height="35" border="0" id="Image2" /></a></td>
<td align="center"><a href="giras.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image3','','plugins/images/botones/giras2.png',1)"><img src="images/botones/giras.png" alt="Giras" width="150" height="35" border="0" id="Image3" /></a></td>
<td align="center"><a href="videos.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image4','','plugins/images/botones/videos2.png',1)"><img src="images/botones/videos.png" alt="Videos" width="150" height="35" border="0" id="Image4" /></a></td>
<td align="center"><a href="downloads.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image5','','plugins/images/botones/downloads2.png',1)"><img src="images/botones/downloads.png" alt="Downloads" width="150" height="35" border="0" id="Image5" /></a></td>
<td align="center"><a href="contacto.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image6','','plugins/images/botones/contacto2.png',1)"><img src="images/botones/contacto.png" alt="Contacto" width="150" height="35" border="0" id="Image6" /></a></td>
</tr>
</table>
</div>
<div id="paneles">
<div id="flyers"><script type="text/javascript">
featuredcontentglider.init({
gliderid: "canadaprovinces", //ID of main glider container
contentclass: "glidecontent", //Shared CSS class name of each glider content
togglerid: "p-select", //ID of toggler container
remotecontent: "glidecontent.php", //Get gliding contents from external file on server? "filename" or "" to disable
selected: 0, //Default selected content index (0=1st)
persiststate: false, //Remember last content shown within browser session (true/false)?
speed: 1000, //Glide animation duration (in milliseconds)
direction: "leftright", //set direction of glide: "updown", "downup", "leftright", or "rightleft"
autorotate: true, //Auto rotate contents (true/false)?
autorotateconfig: [5000, 50] //if auto rotate enabled, set [milliseconds_btw_rotations, cycles_before_stopping]
})
</script>
<div id="video</div>
</div>
<div id="contentWrapper">
<div id="content">
<h1>Bienvenidos a Del Records - <hr />
<p><img src="images/present.jpg" alt="" width="805" height="322" /></p>
<h2><img src="images/alaventa.jpg" alt="" width="745" height="79" /></h2>
<hr />
<a href="sobredel.php"><img src="images/acercade.png" alt="" width="800" height="80" border="0" /></a>
<?php do { ?>
<table width="100%">
<?php
$cuantos=0;
do {
if($cuantos==0){
?>
<tr>
<?php
}
$cuantos ++;
?>
<td height="60" align="center"><img src="images/portadas/<?php echo $row_portadas['imagen_url']; ?>" alt="" border="0" /></td>
<?php
if($cuantos==5){
$cuantos=0;
?>
</tr>
<?php
}
?>
<?php } while ($row_portadas = mysql_fetch_assoc($portadas)); ?>
</table>
<?php } while ($row_portadas = mysql_fetch_assoc($portadas)); ?>
</div>
</div>
<div id="footer">
</div>
</div>
</body>
</html>
<?php
mysql_free_result($portadas);
mysql_free_result($text);
mysql_free_result($imgs);
?>