yannzool

sql et dream cs5
« le: 07 March 2011 15:21:45 »
bonjour a tous et a toutes

j'ai creer mon site hébergé chez free, une base avec une table, par le biais de free, mais comment me connecter avec dreamweaver en distant sur la base de donnée.
j'ai un fichier config.php dans un dossier "connections"
# FileName="Connection_config.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_config = "sql.free.fr";
$database_config = "#####";
$username_config = "######";
$password_config = "nom_base";
$config = mysql_pconnect($hostname_config, $username_config, $password_config) or trigger_error(mysql_error(),E_USER_ERROR);
?>

puis dans ma page index.php qui est dans un dossier html


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;
}
}

mysql_select_db($database_config, $config);
$query_actualites = "SELECT * FROM tab_news WHERE ch_news_etat = 1 ORDER BY ch_news_date DESC";
$actualites = mysql_query($query_actualites, $config) or die(mysql_error());
$row_actualites = mysql_fetch_assoc($actualites);
$totalRows_actualites = mysql_num_rows($actualites);
?>

voila si une tete assez plein pouvait me venir en aide, car la mienne fume depuis trop longtemps.

merci a vous.

yannzool

sql et dream cs5
« Réponse #1 le: 07 March 2011 19:46:56 »
et bien j'ai trouver

dans le $hostname_config = "votre_login.sql.free.fr";

le reste ne change pas
pour le fichier de config qui est dans le dossier connections

mettre ../ devant

et non

voila merci pour toutes les réponses qui m'ont beaucoup pas aidé.

@++