nlefebvre

Inscris le 24/04/2010 à 22:00
  • Site web
  • Nombre de sujets
    3
  • Nombre de messages
    8
  • Nombre de commentaires
    Aucun
  • Nombre de news
    Aucune
  • Niveau en PHP
    Débutant

Ses derniers messages sur les forums

nlefebvre
le 12/05/2010 à 16:02
PB smarty et msql
slt limit 1 ne marche pas plus
struture mysql


$dbname = 'motivation';
$link = mysql_connect("localhost","root","") or die("Couldn't make connection.");
$db = mysql_select_db($dbname, $link) or die("Couldn't select database");
nlefebvre
le 11/05/2010 à 15:34
PB smarty et msql
slt merci pour vos réponse et votre indulgence sur l'orthographe. en faite j'aimerai convertie le code qui suit en sarmty:

<?php require_once('Connections/dbc.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;
}
}

mysql_select_db($dbname, $link);
$query_Recordset1 = "SELECT acceuilID, Titre1, article1, titre2, article2 FROM table_motiv_acceuil ORDER BY acceuilID DESC";
$Recordset1 = mysql_query($query_Recordset1, $link) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php require_once('header.php'); ?>
<div id="conteneur">
<?php require_once('block.php'); ?>


<div id="block4"><div id="block3"></div><div id="left_content">
<div class="h2"><?php echo $row_Recordset1['Titre1']; ?></div>

<div class="content"><?php echo $row_Recordset1['article1']; ?><br />
</div>
</div>



<div id="content">
<div class="h1"><?php echo $row_Recordset1['titre2']; ?></div>
<div class="content"><?php echo $row_Recordset1['article2']; ?><br />
</div>
<br />
<div class="h1"><br />
</div></div>
</div></td><div id="block5"></div>

<div id="bloc_du_bas"></div></div>
</div><div id="bloc_du_bas2"></div></div>
</html>
<?php
mysql_free_result($Recordset1);
?>
nlefebvre
le 07/05/2010 à 13:35
PB smarty et msql
SLT
je cherche a afficher un seul texte, le plus réssant, mais le problème c'est qu'il me sort tous la table du 1 id au dernier. voici mon code php
<?php 
$smarty->compile_check = true;
$smarty->debugging = false;
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($dbname, $link);
$query_Recordset1 = "SELECT acceuilID, Titre1, article1, titre2, article2 FROM table_motiv_acceuil ORDER BY acceuilID DESC";
$Recordset1 = mysql_query($query_Recordset1, $link) or die(mysql_error());

$totalRows_Recordset1 = mysql_num_rows($Recordset1);
#...your mysql connection & smarty initialization goes here
while ($row = mysql_fetch_assoc($Recordset1))
{
$id[] = $row['acceuilID'];
$titles[] = $row['Titre1'];
$article[] = $row['article1'];


}
$smarty = new Smarty();
$smarty->assign ('ids',$id);
$smarty->assign ('titles',$titles);
$smarty->assign ("articlesdroite",$article);


// Affichage du template après compilation
$smarty->cache_lifetime = 24 * 60 * 60;
$smarty->display('test.tpl');
?>


Voici le code TPL
{section name=id loop=$titles} 
{$articlesdroite[id]}

{/section}

Merci pour votre aide
nlefebvre
le 04/05/2010 à 14:06
smarty mysql help
j'aimerais savoir comment en fais apparaitre du texte depluis une bd sur smarty merci
nlefebvre
le 25/04/2010 à 16:54
help Formulaire de donné
voici mon code

<?php $destinataires=array("Acceuil" ,
"audit",
"accompagenemet",
"fromation",
);

?>


if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "$destinataires")) {
$insertSQL = sprintf("INSERT INTO table_motiv_acceuil (article1,article2) VALUES (%s,%s)",
GetSQLValueString($_POST['eco1'], "text"),
GetSQLValueString($_POST['eco2'], "text"));

mysql_select_db($dbname, $link);
$Result1 = mysql_query($insertSQL, $link) or die(mysql_error());
}
nlefebvre
le 25/04/2010 à 15:19
help Formulaire de donné
un formulaire texte avec un menu déroulent avec dedans (accueil,audit, formation, etc)
lorsque met "accueil" le formulaire insert dans le table accueil lorque je met "audit le formulaire met dans la table audit etc
nlefebvre
le 24/04/2010 à 22:05
help Formulaire de donné
Bonjour je cherche a faire un formulaire de donner avec un menu dérouland qui changerais les insertion BDD. Se qui donnerai 1 formulaire pour 3 formulaire voire plus.
Merci d'avance
LoadingChargement en cours