Ver Mensaje Individual
  #6 (permalink)  
Antiguo 21/10/2011, 03:44
campussummertime
 
Fecha de Ingreso: octubre-2011
Mensajes: 129
Antigüedad: 12 años, 11 meses
Puntos: 1
Respuesta: Vincular a una variable php

Ahora he conseguido que el enlaze rediriga pero me da fallos en el $alias tengo que verificar algo ?

<?php $sitio = "localhost";
$sitio = "localhost";
$usuario = "kfernandez92";
$pass = "brothers";
$base = "kfernandez";
$alias = 'alias';
$con = mysql_connect($sitio, $usuario, $pass,$alias);
require_once('Connections/localhost.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;
}
}

$colname_Recordset1 = "-1";
if (isset($_GET['buscador'])) {
$colname_Recordset1 = $_GET['buscador'];
}
mysql_select_db($database_localhost, $localhost);
$query_Recordset1 = sprintf("SELECT * FROM web WHERE name LIKE %s ORDER BY name ASC", GetSQLValueString("%" . $colname_Recordset1 . "%", "text"));
$Recordset1 = mysql_query($query_Recordset1, $localhost) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>

En el navegador me sale así

http://localhost/kfernandez/users/$alias/index.php