Dreamweaver - Ayuda en consulta a base de datos

 
Vista:
sin imagen de perfil

Ayuda en consulta a base de datos

Publicado por Luis Manuel (4 intervenciones) el 17/06/2014 20:32:34
NECESITO SU AYUDA URGENTEMENTE, RESULTA QUE TENGO UNA BASE DE DATOS CONECTADA A UNA PAGINA WEB, Y NECESITO UNA CONSULTA DEL PRECIO DE UN VIAJE EN AUTOBUS, ALGO COMO ESTO: https://secure.primeraplus.com.mx/Boletos/CompraporInternet/TarifasyDestinos.aspx; EN DONDE EL VISITANTE SELECCIONE SU ORIGEN Y SU DESTINO Y QUE ME BUSQUE EL PRECIO DE DICHO VIAJE, YA ME CANSE DE INTENTARLO Y SE ME HA COMPLICADO DEMASIADO. URGEEEEEEEEEE SU AYUDA MUCHAS GRACIAS. LO ESTOY HACIENDO EN DREAMWEAVER CS6.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de xve
Val: 96
Oro
Ha mantenido su posición en Dreamweaver (en relación al último mes)
Gráfica de Dreamweaver

Ayuda en consulta a base de datos

Publicado por xve (369 intervenciones) el 18/06/2014 08:43:15
Hola Luis, necesitaríamos conocer la estructura de la base de datos y el código HTML que utilizas actualmente, ya que sin esa información no se como ayudarte!!!
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil

Ayuda en consulta a base de datos

Publicado por Luis Manuel (4 intervenciones) el 18/06/2014 16:57:23
LO QUE PASA ES QUE NO TENGO NI LA MÁS MÍNIMA IDEA DE COMO HACERLO, PRIMERAMENTE SE ME OCURRIÓ CREAR OPCIONES EN ORIGEN, OPCIONES EN DESTINO, PERO EL PRECIO COMO???? HICE ESTO PRIMERAMENTE:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
</head>
 
<body>
<table width="510" border="0">
  <tr>
    <td width="55">&nbsp;</td>
    <td width="55">&nbsp;</td>
    <td width="55"><form id="form2" name="form2" method="post" action="">
      <label>
        <div align="center">Origen</div>
      </label>
    </form></td>
    <td width="192"><select name="Origen" id="Origen">
<option>.</option>
<option>CENTRAL DEL NORTE</option>
      <option>CENTRAL DEL SUR</option>
      <option>CENTRAL TAPO</option>
 
    </select></td>
    <td width="131">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><form id="form3" name="form3" method="post" action="">
      <label>
        <div align="center">Destino</div>
      </label>
    </form></td>
    <td><select name="Destino" id="Destino">
      <option>_</option>
      <option>PUEBLA</option>
      <option>VERACRUZ</option>
      <option>ACAPULCO</option>
      <option>TLAXCALA</option>
      <option>GUADALAJARA</option>
      <option>HIDALGO</option>
      <option>CAMPECHE</option>
      <option>CANCUN</option>
      <option>CHIAPAS</option>
      <option>TIJUANA</option>
      <option>MONTERREY</option>
      <option>CHIHUAHUA</option>
 
    </select>  </td>
    <td>&nbsp;</td>
  </tr>
 
 
</table>
<form id="form1" name="form1" method="post" action="enviar.php">
  <P>

DESPUES SE ME OCURRIO CREAR UNA BASE DE DATOS CON CUATRO CAMPOS: ID, ORIGEN, DESTINO Y PRECIO; CADA REGISTRO TIENE SU ORIGEN DESTINO, POR EJEMPLO: 1-CENTRAL DEL SUR-ACAPULCO-490.00
EL PROBLEMA ES QUE, NO SE COMO HACER LA PAGINA PARA QUE EL USUARIO ELIJA SU ORIGEN (CENTRAL DEL SUR), SU DESTINO(ACAPULCO) Y QUE ME APAREZCA EL PRECIO AL PRESIONAR EL BOTON DE BUSCAR :(
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
Imágen de perfil de xve
Val: 96
Oro
Ha mantenido su posición en Dreamweaver (en relación al último mes)
Gráfica de Dreamweaver

Ayuda en consulta a base de datos

Publicado por xve (369 intervenciones) el 18/06/2014 18:45:35
Pero Luis, los datos no los tienes en una base de datos? donde quieres buscarlos? no entiendo muy bien...
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil

Ayuda en consulta a base de datos

Publicado por Luis Manuel (4 intervenciones) el 18/06/2014 18:52:07
oh no, el ejemplo anterior, te comento que fue lo primero que se me ocurrió, pero no es posible obtener el precio, asi lo considero, por eso lo intente con una base de datos; con la base de datos solo la cree, hice mi conexion, elabore una consulta en donde me despliega el primer registro, o el numero de registros que yo decida, o paginarlo, pero te confieso que no tengo el conocimiento para poder hacer algo parecido a lo anterior con mi conexion de la base de datos, me despliega informacion de los registros, pero no se como hacer que me permita elejir el origen y destino. Enseguida te envío el codigo de lo que tengo en esa pagina ya con conexion a la base de datos. espero de verdad que puedas ayudarme porque no logro mi objetivo. de antemano muchas gracias.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil

Ayuda en consulta a base de datos

Publicado por Luis Manuel (4 intervenciones) el 18/06/2014 22:33:20
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php require_once('Connections/conexion_prueba.php'); ?>
<?php
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;
}
}
 
$currentPage = $_SERVER["PHP_SELF"];
 
$maxRows_practicando_tarifas = 10;
$pageNum_practicando_tarifas = 0;
if (isset($_GET['pageNum_practicando_tarifas'])) {
  $pageNum_practicando_tarifas = $_GET['pageNum_practicando_tarifas'];
}
$startRow_practicando_tarifas = $pageNum_practicando_tarifas * $maxRows_practicando_tarifas;
 
mysql_select_db($database_conexion_prueba, $conexion_prueba);
$query_practicando_tarifas = "SELECT ORIGEN, DESTINO, PRECIO FROM tarifa WHERE ORIGEN LIKE '%CENTRAL%' ORDER BY ORIGEN ASC";
$query_limit_practicando_tarifas = sprintf("%s LIMIT %d, %d", $query_practicando_tarifas, $startRow_practicando_tarifas, $maxRows_practicando_tarifas);
$practicando_tarifas = mysql_query($query_limit_practicando_tarifas, $conexion_prueba) or die(mysql_error());
$row_practicando_tarifas = mysql_fetch_assoc($practicando_tarifas);
 
if (isset($_GET['totalRows_practicando_tarifas'])) {
  $totalRows_practicando_tarifas = $_GET['totalRows_practicando_tarifas'];
} else {
  $all_practicando_tarifas = mysql_query($query_practicando_tarifas);
  $totalRows_practicando_tarifas = mysql_num_rows($all_practicando_tarifas);
}
$totalPages_practicando_tarifas = ceil($totalRows_practicando_tarifas/$maxRows_practicando_tarifas)-1;
 
$queryString_practicando_tarifas = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_practicando_tarifas") == false &&
        stristr($param, "totalRows_practicando_tarifas") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_practicando_tarifas = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_practicando_tarifas = sprintf("&totalRows_practicando_tarifas=%d%s", $totalRows_practicando_tarifas, $queryString_practicando_tarifas);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
</head>
 
<body>
<p>&nbsp;</p>
<p>&nbsp;</p>
<table border="1">
  <tr>
    <td>ORIGEN</td>
    <td>DESTINO</td>
    <td>PRECIO</td>
  </tr>
  <?php do { ?>
    <tr>
      <td><?php echo $row_practicando_tarifas['ORIGEN']; ?></td>
      <td><?php echo $row_practicando_tarifas['DESTINO']; ?></td>
      <td><?php echo $row_practicando_tarifas['PRECIO']; ?></td>
    </tr>
    <?php } while ($row_practicando_tarifas = mysql_fetch_assoc($practicando_tarifas)); ?>
</table>
<p>&nbsp;</p>
</body>
</html>
<?php
mysql_free_result($practicando_tarifas);
?>

AQUI ES DONDE NO PUEDO PONER LAS COSAS COMO LAS NECESITO :(
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar