<?xml version="1.0" encoding="UTF-8" ?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
    <title>Posteet: mysql,php</title> 
    <link>http://www.posteet.com/</link> 
    <description>Recent posteets posted to Posteet</description>
    <ttl>60</ttl>

    
    <item>
        <title>Mostrar todas las tablas de una base de datos</title>
        <link>http://www.posteet.com/view/1378</link>
        <description>
        <![CDATA[<pre>&lt;?php

$dbhost = &quot;servidor&quot;; $dbuser = &quot;usuario&quot;; $dbpassword = &quot;clave&quot;; $dbname = &quot;base_de_datos&quot;;
mysql_connect($dbhost,$dbuser,$dbpassword);
$tablas = mysql_list_tables($dbname);

while (list($tabla) = mysql_fetch_row($tablas)) {
echo $tabla.&quot;&lt;br /&gt;&quot;;
} ?&gt;</pre> <a href="http://www.posteet.com/tags/mysql">[mysql]</a>  <a href="http://www.posteet.com/tags/php">[php]</a> ]]>        </description>
        <dc:creator>jacinmontava</dc:creator>
        <pubDate>Fri, 28 Nov 2008 12:26:38 +0000</pubDate>

            <category>mysql</category>
            <category>php</category>
    
    </item>

  
    <item>
        <title>mysql dump with delete more then 3 backups</title>
        <link>http://www.posteet.com/view/1069</link>
        <description>
        <![CDATA[<pre>DATUM=`date '+%Y-%m-%d'`
mysqldump -u USER --password=PASSWORD DATABASE TABLE &gt; /home/backup/db.sql
gzip /home/backup/db.sql
mv /home/backup/db.sql.gz /home/backup/db-${DATUM}.sql.gz
find /home/backup/ -mtime +2 -type f -print0 | xargs -0 rm</pre> <a href="http://www.posteet.com/tags/mysql">[mysql]</a>  <a href="http://www.posteet.com/tags/php">[php]</a> ]]>        </description>
        <dc:creator>sx</dc:creator>
        <pubDate>Tue, 08 Jul 2008 21:01:19 +0000</pubDate>

            <category>mysql</category>
            <category>php</category>
    
    </item>

  
    <item>
        <title>Extraer un dato de la BD</title>
        <link>http://www.posteet.com/view/627</link>
        <description>
        <![CDATA[<pre>function dime_datos($tabla, $campo, $id_recibida)
{
   $link = conectarse();
   $consulta_sql = &quot;SELECT $campo FROM $tabla WHERE id = '$id_recibida'&quot;;
   $consultar = mysql_query($consulta_sql, $link);
   return mysql_result($consultar, 0);
}</pre> <a href="http://www.posteet.com/tags/mysql">[mysql]</a>  <a href="http://www.posteet.com/tags/php">[php]</a> ]]>        </description>
        <dc:creator>jacinmontava</dc:creator>
        <pubDate>Wed, 26 Dec 2007 15:03:33 +0000</pubDate>

            <category>mysql</category>
            <category>php</category>
    
    </item>

  
    <item>
        <title>Conexion Base de Datos</title>
        <link>http://www.posteet.com/view/623</link>
        <description>
        <![CDATA[<pre>$localhost = &quot;localhost&quot;;
$usuario = &quot;nombre usuario BD&quot;;
$password = &quot;password BD&quot;;
$nombreBD = &quot;nombre BD&quot;

function conectarse()
{
   if (!($link=mysql_connect($localhost,$usuario,$password)))
   {
      echo &quot;Error conectando a la base de datos.&quot;;
      exit();
   }
   if (!mysql_select_db($nombreBD,$link))
   {
      echo &quot;Error seleccionando la base de datos.&quot;;
      exit();
   }
   return $link;
}</pre> <a href="http://www.posteet.com/tags/mysql">[mysql]</a>  <a href="http://www.posteet.com/tags/php">[php]</a> ]]>        </description>
        <dc:creator>jacinmontava</dc:creator>
        <pubDate>Wed, 26 Dec 2007 14:35:53 +0000</pubDate>

            <category>mysql</category>
            <category>php</category>
    
    </item>

  
    <item>
        <title>Recuperar la ultima id insertada</title>
        <link>http://www.posteet.com/view/602</link>
        <description>
        <![CDATA[<pre>mysql_query(&quot;INSERT INTO table (nom_table) values ('ex')&quot;);
   $ultima_id =  mysql_insert_id();
   echo $ultima_id;</pre> <a href="http://www.posteet.com/tags/mysql">[mysql]</a>  <a href="http://www.posteet.com/tags/php">[php]</a> ]]>        </description>
        <dc:creator>jacinmontava</dc:creator>
        <pubDate>Thu, 20 Dec 2007 11:55:09 +0000</pubDate>

            <category>mysql</category>
            <category>php</category>
    
    </item>

  
    <item>
        <title>Récupérer le dernier id inséré</title>
        <link>http://www.posteet.com/view/562</link>
        <description>
        <![CDATA[<pre>&lt;?php

   mysql_query(&quot;INSERT INTO table (nom_table) values ('ex')&quot;);
   $dernier_id =  mysql_insert_id();
   echo $dernier_id;

?&gt;</pre> <a href="http://www.posteet.com/tags/mysql">[mysql]</a>  <a href="http://www.posteet.com/tags/php">[php]</a> ]]>        </description>
        <dc:creator>xillon</dc:creator>
        <pubDate>Mon, 10 Dec 2007 06:35:46 +0000</pubDate>

            <category>mysql</category>
            <category>php</category>
    
    </item>

  
    <item>
        <title>Construct select (HTML) dynamic with any table SQL</title>
        <link>http://www.posteet.com/view/218</link>
        <description>
        <![CDATA[<pre>function selectTable($nomtable, $where = NULL, $order = NULL)
         {
            $sql = &quot;SELECT * FROM $nomtable&quot;;
            if ( $where !== NULL ) $sql .= &quot; WHERE $where&quot;;
            if ($order !== NULL)$sql.=&quot; ORDER BY $order &quot;;
            
            $query=mysql_query($sql);
            
            $ret = array();
            while ( $donnee = mysql_fetch_assoc($query))
            {
               $ret[] = $donnee;
            }
            return $ret;
         }
         
         function sqlSelect($sqlDonnee, $nomCol, $valCol)
         {
            for($i = 0 ; $i&lt;count($sqlDonnee) ; $i++)
            {
               $selectDonee[&quot;name&quot;][$i] = $sqlDonnee[$i][$nomCol];
               $selectDonee[&quot;value&quot;][$i] = $sqlDonnee[$i][$valCol];
            }
         return $selectDonee;
         }
         
         function htmlSelect($nom, $options, $selected = NULL, $css = NULL)
         {
            $select  = &quot;&lt;select name=\&quot;&quot;.htmlentities($nom).&quot;\&quot;&quot;;
            if ( $css !== NULL )
               $select .= &quot; $css&gt;&quot;;
            else
               $select .= &quot;&gt;&quot;;

            for($i = 0 ; $i&lt;count($options[&quot;name&quot;]) ; $i++)
            {
               if ( $selected !== NULL &amp;&amp; $selected == $options[&quot;value&quot;][$i] )
                  $select .= &quot;&lt;option value=\&quot;&quot;.$options[&quot;value&quot;][$i].&quot;\&quot; selected=\&quot;selected\&quot;&gt;&quot;.$options[&quot;name&quot;][$i].&quot;&lt;/option&gt;\n&quot;;
               else
                  $select .= &quot;&lt;option value=\&quot;&quot;.$options[&quot;value&quot;][$i].&quot;\&quot;&gt;&quot;.$options[&quot;name&quot;][$i].&quot;&lt;/option&gt;\n&quot;;
            }
            $select .= &quot;&lt;/select&gt;\n&quot;;

            return $select;
         }

/*** Exemple utilisation ***/
/* &lt;option selected&gt; par defaut pour le pays ayant l'id 72 */
         $paysSelect = isset($_POST[&quot;pays&quot;]) ? ($_POST[&quot;pays&quot;]) : (&quot;72&quot;);
         
         $selectPays=selectTable(&quot;pays&quot;);
         $pays=sqlSelect($selectPays,&quot;nom&quot;,&quot;id&quot;);         
         echo htmlSelect(&quot;id&quot;, $pays, $paysSelect); // on construit notre &lt;select&gt;</pre> <a href="http://www.posteet.com/tags/fonction">[fonction]</a>  <a href="http://www.posteet.com/tags/function">[function]</a>  <a href="http://www.posteet.com/tags/html">[html]</a>  <a href="http://www.posteet.com/tags/mysql">[mysql]</a>  <a href="http://www.posteet.com/tags/php">[php]</a>  <a href="http://www.posteet.com/tags/select html">[select html]</a>  <a href="http://www.posteet.com/tags/select table">[select table]</a>  <a href="http://www.posteet.com/tags/sql">[sql]</a>  <a href="http://www.posteet.com/tags/web">[web]</a> ]]>        </description>
        <dc:creator>xillon</dc:creator>
        <pubDate>Mon, 05 Nov 2007 11:52:08 +0000</pubDate>

            <category>fonction</category>
            <category>function</category>
            <category>html</category>
            <category>mysql</category>
            <category>php</category>
            <category>select html</category>
            <category>select table</category>
            <category>sql</category>
            <category>web</category>
    
    </item>


</channel>
</rss>
