Rogerinho Fuzue Posted October 14, 2011 Report Share Posted October 14, 2011 Estou com uma pagina dando esse erro:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '10' at line 1alguém sabe me dizer o que e como posso solucionar isso?Grato Quote Link to comment Share on other sites More sharing options...
0 ESerra Posted October 14, 2011 Report Share Posted October 14, 2011 A query está errada, posta o script... Quote Link to comment Share on other sites More sharing options...
0 Rogerinho Fuzue Posted October 14, 2011 Author Report Share Posted October 14, 2011 Esse é o script:<?php require_once('Connections/fotos.php'); ?><?php$id = $HTTP_GET_VARS['id'];$inicio = $HTTP_GET_VARS['inicio'];$colname_Recordset1 = "1";if (isset($HTTP_GET_VARS['id'])) { $colname_Recordset1 = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['id'] : addslashes($HTTP_GET_VARS['id']);}mysql_select_db($database_fotos, $fotos);$query_Recordset1 = sprintf("SELECT * FROM img_bank WHERE id = '%s' order by ordena LIMIT $inicio,10", $colname_Recordset1);$Recordset1 = mysql_query($query_Recordset1, $fotos) or die(mysql_error());$row_Recordset1 = mysql_fetch_assoc($Recordset1);$totalRows_Recordset1 = mysql_num_rows($Recordset1);$colname_Recordset2 = "1";if (isset($HTTP_GET_VARS['id'])) { $colname_Recordset2 = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['id'] : addslashes($HTTP_GET_VARS['id']);}mysql_select_db($database_fotos, $fotos);$query_Recordset2 = sprintf("SELECT * FROM fotos WHERE id = '%s'", $colname_Recordset2);$Recordset2 = mysql_query($query_Recordset2, $fotos) or die(mysql_error());$row_Recordset2 = mysql_fetch_assoc($Recordset2);$totalRows_Recordset2 = mysql_num_rows($Recordset2);$numdepg = $row_Recordset2['numero_de_fotos'] / 10; $ini = $_GET['ini'];$atual = "";if($inicio[0] == 0){ $ini[0] = "S";}else if($inicio == 10){ $ini[1] = "S"; $ini[0] = "S";}else if($inicio == 20){ $ini[2] = "S"; $ini[0] = "S";}else if($inicio == 30){ $ini[3] = "S"; $ini[0] = "S";}else if($inicio == 40){ $ini[4] = "S"; $ini[0] = "S";}else if($inicio == 50){ $ini[5] = "S"; $ini[0] = "S";}else if($inicio == 60){ $ini[6] = "S"; $ini[0] = "S";}else if($inicio == 70){ $ini[7] = "S"; $ini[0] = "S";}else if($inicio == 80){ $ini[8] = "S"; $ini[0] = "S";}else if($inicio == 90){ $ini[9] = "S"; $ini[0] = "S";}else if($inicio == 100){ $ini[10] = "S";}else if($inicio == 110){ $ini[11] = "S";}else if($inicio == 120){ $ini[12] = "S";}else if($inicio == 130){ $ini[13] = "S";}else if($inicio == 140){ $ini[14] = "S";}else if($inicio == 150){ $ini[15] = "S";}else if($inicio == 160){ $ini[16] = "S";}else if($inicio == 170){ $ini[17] = "S";}else if($inicio == 180){ $ini[18] = "S";}else if($inicio == 190){ $ini[19] = "S";}else if($inicio == 200){ $ini[20] = "S";}else if($inicio == 210){ $ini[21] = "S";}else if($inicio == 220){ $ini[22] = "S";}else if($inicio == 230){ $ini[23] = "S";}else if($inicio == 240){ $ini[24] = "S";}else if($inicio == 250){ $ini[25] = "S";}else if($inicio == 260){ $ini[26] = "S";}else if($inicio == 270){ $ini[27] = "S";}else if($inicio == 280){ $ini[28] = "S";}else if($inicio == 290){ $ini[29] = "S";}else if($inicio == 300){ $ini[30] = "S";}else if($inicio == 310){ $ini[31] = "S";}else if($inicio == 320){ $ini[32] = "S";}else if($inicio == 330){ $ini[33] = "S";}else if($inicio == 340){ $ini[34] = "S";}else if($inicio == 350){ $ini[35] = "S";}else if($inicio == 360){ $ini[36] = "S";}else if($inicio == 370){ $ini[37] = "S";}else if($inicio == 380){ $ini[38] = "S";}else if($inicio == 390){ $ini[39] = "S";}else if($inicio == 400){ $ini[40] = "S";}else if($inicio == 410){ $ini[41] = "S";}else if($inicio == 420){ $ini[42] = "S";}else if($inicio == 430){ $ini[43] = "S";}else if($inicio == 440){ $ini[44] = "S";}else if($inicio == 450){ $ini[45] = "S";}else if($inicio == 460){ $ini[46] = "S";}else if($inicio == 470){ $ini[47] = "S";}else if($inicio == 480){ $ini[48] = "S";}else if($inicio == 490){ $ini[49] = "S";}?><?php$currentPage = $HTTP_SERVER_VARS["PHP_SELF"];$chave = $HTTP_GET_VARS['chave'];$maxRows_RS_get_festas = 4;$pageNum_RS_get_festas = 0;if (isset($HTTP_GET_VARS['pageNum_RS_get_festas'])) { $pageNum_RS_get_festas = $HTTP_GET_VARS['pageNum_RS_get_festas'];}$startRow_RS_get_festas = $pageNum_RS_get_festas * $maxRows_RS_get_festas;mysql_select_db($database_fotos, $fotos);$query_RS_get_festas = "SELECT * FROM fotos WHERE data like '%".$chave."%' or local like '%".$chave."%' or commentario like '%".$chave."%' ORDER BY id DESC";$query_limit_RS_get_festas = sprintf("%s LIMIT %d, %d", $query_RS_get_festas, $startRow_RS_get_festas, $maxRows_RS_get_festas);$RS_get_festas = mysql_query($query_limit_RS_get_festas, $fotos) or die(mysql_error());$row_RS_get_festas = mysql_fetch_assoc($RS_get_festas);if (isset($HTTP_GET_VARS['totalRows_RS_get_festas'])) { $totalRows_RS_get_festas = $HTTP_GET_VARS['totalRows_RS_get_festas'];} else { $all_RS_get_festas = mysql_query($query_RS_get_festas); $totalRows_RS_get_festas = mysql_num_rows($all_RS_get_festas);}$totalPages_RS_get_festas = ceil($totalRows_RS_get_festas/$maxRows_RS_get_festas)-1;$queryString_RS_get_festas = "";if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) { $params = explode("&", $HTTP_SERVER_VARS['QUERY_STRING']); $newParams = array(); foreach ($params as $param) { if (stristr($param, "pageNum_RS_get_festas") == false && stristr($param, "totalRows_RS_get_festas") == false) { array_push($newParams, $param); } } if (count($newParams) != 0) { $queryString_RS_get_festas = "&" . implode("&", $newParams); }}$queryString_RS_get_festas = sprintf("&totalRows_RS_get_festas=%d%s", $totalRows_RS_get_festas, $queryString_RS_get_festas);?>http://fuzue.hospedagem-de-site.info/porto...9-06-2011/0.jpg Quote Link to comment Share on other sites More sharing options...
0 ESerra Posted October 14, 2011 Report Share Posted October 14, 2011 Da-lhe dreamweaver...É provável que a variável $inicio esteja em branco, antes de:$query_Recordset1 = sprintf("SELECT * FROM img_bank WHERE id = '%s' order by ordena LIMIT $inicio,10", $colname_Recordset1);Coloque:$inicio = ($inicio == '')?'0':$inicio; Quote Link to comment Share on other sites More sharing options...
0 Rogerinho Fuzue Posted October 14, 2011 Author Report Share Posted October 14, 2011 Perfeito.. a pagina agora abril.. so falta abrir as imagens http://fuzue.hospedagem-de-site.info/porto...9-06-2011/0.jpgeu tenho ele funcionando em outro serverhttp://fuzue.net/porto/fotos.php?inicio=0&...9-06-2011/0.jpgso que no outro servidor que vou usar ele não quer fucionar direito.. Quote Link to comment Share on other sites More sharing options...
Question
Rogerinho Fuzue
Estou com uma pagina dando esse erro:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '10' at line 1
alguém sabe me dizer o que e como posso solucionar isso?
Grato
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.