elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Rompecabezas de Bitcoin, Medio millón USD en premios


  Mostrar Mensajes
Páginas: [1]
1  Programación / PHP / Re: cuestionario php en: 18 Marzo 2010, 14:05 pm
el problema es q el cuestionario es bastante largo y con varias opciones, tng una base de datos con las erespuestas, y lo que quería era hacer un bucle para implementarlo de una manera más sencilla

muchas gracias castg!
2  Programación / PHP / Re: cuestionario php en: 18 Marzo 2010, 10:47 am
<input type="checkbox" name="id1[]" value="TRUE" />opcion1
<input type="checkbox" name="id1[]" value="TRUE" />opcion2
<input type="checkbox" name="id1[]" value="TRUE" />opcion3
<input type="checkbox" name="id1[]" value="TRUE" />opcion4
-------------------------------
$id=$_POST['id1'];
for($i=0;$i<4;$i++){
 echo "iteracion".$i;
 echo $id[$i];
}
--------------------------------------

ejemplo

marco opcion2 y opcion4, me imprime:

iteracion0 TRUE
iteracion1 TRUE
iteracion2
iteracion3

debería aparecer
iteracion0
iteraacion1 TRUE
iteracion2
iteracion3 TRUE
¿por qye pasa esto?
3  Programación / PHP / cuestionario php en: 16 Marzo 2010, 11:47 am
le he dado muchas vueltas y no s e como soulicionarlo. os cuento

tengo un cuestionario donde cada input es un checkbox, (loo utilizo para una pregunta de verdadero-falso). cada input tiene un name="id[]" y un value="true" o false. lo q pasa  es como si el array almacenara primero las casillas marcadas (true) y las no marcadas las almacena al final. ejemplo
1 marcada
2 no marcada
3 marcada
4 no marcada

id[0]=marcada // valor true
id[1]=marcada // valor true
id[2]=no marcada // sin valor
id[3]=no marcada// sin valor

necesito almacenar en un array para luego comparar con los valores almacenados en la base de datos
gracias

4  Programación / PHP / Re: Tutorial php+sqlite en: 8 Marzo 2010, 11:59 am
gracias . estoi un poco perdido
5  Programación / PHP / Tutorial php+sqlite en: 24 Febrero 2010, 11:21 am
necesito un tutorial para crear paso a paso una base de datos sqlite con php, realizar consultas, etc
GRACIAS
6  Programación / Bases de Datos / Re: problemas con sqlite en: 2 Febrero 2010, 09:52 am
"Si pero es un trabajito pesado para un usuario modificar codigo fuente para que dicha aplicacion trabaje con SQLite, no se en que esta hecho Moodle, pero si es en PHP tendria que buscar el soporte de SQLite para PHP el modulo..."

moodle está hecho en php, a la hora de modificar el código fuente, qué tengo q hacer??
por ejemplo lo q tendría q modificar en install.php:

$INSTALL['dbtype']          = 'mysql';

if ($INSTALL['dbtype'] == 'mysql') {  /// Check MySQL extension is present
        if (!extension_loaded('mysql')) {
            $errormsg = get_string('mysqlextensionisnotpresentinphp', 'install');
            $nextstage = DATABASE;
        }
    }

if (empty($INSTALL['prefix']) && $INSTALL['dbtype'] != 'mysql') { // All DBs but MySQL require prefix (reserv. words)
        $errormsg = get_string('dbwrongprefix', 'install');
        $nextstage = DATABASE;
    }

if (empty($errormsg)) {

        error_reporting(0);  // Hide errors

        if (! $dbconnected = $db->Connect($INSTALL['dbhost'],$INSTALL['dbuser'],$INSTALL['dbpass'],$INSTALL['dbname'])) {
            /// The following doesn't seem to work but we're working on it
            /// If you come up with a solution for creating a database in MySQL
            /// feel free to put it in and let us know
            if ($dbconnected = $db->Connect($INSTALL['dbhost'],$INSTALL['dbuser'],$INSTALL['dbpass'])) {
                switch ($INSTALL['dbtype']) {   /// Try to create a database
                    case 'mysql':
                        if ($db->Execute("CREATE DATABASE {$INSTALL['dbname']};")) {
                            $dbconnected = $db->Connect($INSTALL['dbhost'],$INSTALL['dbuser'],$INSTALL['dbpass'],$INSTALL['dbname']);
                        } else {
                            $errormsg = get_string('dbcreationerror', 'install');
                            $nextstage = DATABASE;
                        }
                        break;
                }
            }
        } else {
        /// We have been able to connect properly, just test the database encoding now.
        /// It must be Unicode for 1.8 installations.
            $encoding = '';
            switch ($INSTALL['dbtype']) {
                case 'mysql':
                /// Get MySQL character_set_database value
                    $rs = $db->Execute("SHOW VARIABLES LIKE 'character_set_database'");
                    if ($rs && $rs->RecordCount() > 0) {
                        $records = $rs->GetAssoc(true);
                        $encoding = $records['character_set_database']['Value'];
                        if (strtoupper($encoding) != 'UTF8') {
                        /// Try to set the encoding now!
                            if (! $db->Metatables()) {  // We have no tables so go ahead
                                $db->Execute("ALTER DATABASE `".$INSTALL['dbname']."` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci");
                                $rs = $db->Execute("SHOW VARIABLES LIKE 'character_set_database'");  // this works

                            }
                        }
                        /// If conversion fails, skip, let environment testing do the job
                    }
                    break;
                case 'postgres7':
                /// Skip, let environment testing do the job
                    break;
                case 'oci8po':
                /// Skip, let environment testing do the job
                    break;
            }
        }
    }

    error_reporting(7);

    if (($dbconnected === false) and (empty($errormsg)) ) {
        $errormsg = get_string('dbconnectionerror', 'install');
        $nextstage = DATABASE;
    }

 <td class="td_mainheading" colspan="2">
            <p class="p_mainheading"><?php echo $headstagetext[$nextstage] ?></p>
            <?php /// Exceptionaly, depending of the DB selected, we show some different text
                  /// from the standard one to show better instructions for each DB
                if ($nextstage == DATABASE) {
                    echo '<script type="text/javascript" defer="defer">window.onload=toggledbinfo;</script>';
                    echo '<div id="mysql" name="mysql">' . get_string('databasesettingssub_mysql', 'install') . '</div>';

                    echo '<div id="postgres7" name="postgres7">' . get_string('databasesettingssub_postgres7', 'install') . '</div>';

                    echo '<div id="mssql" name="mssql">' . get_string('databasesettingssub_mssql', 'install');
                /// Link to mssql installation page
                    echo '<p align="right"><a href="http://docs.moodle.org/en/Installing_MSSQL_for_PHP" target="_blank">';
                    echo '<img src="' . $INSTALL['wwwrootform'] . '/pix/docs.gif' . '" alt="Docs" class="iconhelp" />';
                    echo get_string('moodledocslink', 'install') . '</a></p>';
                    echo '</div>';

                    echo '<div id="mssql_n" name="mssql">' . get_string('databasesettingssub_mssql_n', 'install');
                /// Link to mssql installation page
                    echo '<p align="right"><a href="http://docs.moodle.org/en/Installing_MSSQL_for_PHP" target="_blank">';
                    echo '<img src="' . $INSTALL['wwwrootform'] . '/pix/docs.gif' . '" alt="Docs" />';
                    echo get_string('moodledocslink', 'install') . '</a></p>';
                    echo '</div>';

                    echo '<div id="odbc_mssql" name="odbc_mssql">'. get_string('databasesettingssub_odbc_mssql', 'install');
                /// Link to mssql installation page
                    echo '<p align="right"><a href="http://docs.moodle.org/en/Installing_MSSQL_for_PHP" target="_blank">';
                    echo '<img src="' . $INSTALL['wwwrootform'] . '/pix/docs.gif' . '" alt="Docs" class="iconhelp" />';
                    echo get_string('moodledocslink', 'install') . '</a></p>';
                    echo '</div>';

                    echo '<div id="oci8po" name="oci8po">' . get_string('databasesettingssub_oci8po', 'install');
                /// Link to oracle installation page
                    echo '<p align="right"><a href="http://docs.moodle.org/en/Installing_Oracle_for_PHP" target="_blank">';
                    echo '<img src="' . $INSTALL['wwwrootform'] . '/pix/docs.gif' . '" alt="Docs" class="iconhelp" />';
                    echo get_string('moodledocslink', 'install') . '</a></p>';
                    echo '</div>';
                } else {
                    if (!empty($substagetext[$nextstage])) {
                        echo '<p class="p_subheading">' . $substagetext[$nextstage] . '</p>';
                    }
                }
            ?>
        </td>

<?php choose_from_menu (array('mysql' => get_string('mysql', 'install'),
                                              'oci8po' => get_string('oci8po', 'install'),
                                              'postgres7' => get_string('postgres7', 'install'),
                                              'mssql' => get_string('mssql', 'install'),
                                              'mssql_n' => get_string('mssql_n', 'install'),
                                              'odbc_mssql' => get_string('odbc_mssql', 'install')),
                                        'dbtype', $INSTALL['dbtype'], '', 'toggledbinfo();') ?>

 document.getElementById('mysql').style.display = '';

 document.all['mysql'].style.display = '';

 document.layers['mysql'].style.display = '';


y donde ponga mysql lo cambio por sqlite???
7  Programación / Bases de Datos / Re: problemas con sqlite en: 30 Enero 2010, 10:48 am
muchas gracias a todos. os voy a explicar exactamente mi problema:
tengo que instalar moodle en un servidor cuyo gestor de base de datos es sqlite, y antes de la instalación tengoq crearme una base de datos mysql. uno de los problemas es q ese servidor no es mio y no puedo instalar nada ahí, no cambio de servidor pq tng q utilizar ese. alguien ha tenido éste problema?
8  Programación / Bases de Datos / problemas con sqlite en: 29 Enero 2010, 13:35 pm
hola! necesito ayuda
quiero crear una base de datos mysql en mi servidor pero el servidor no tiene instalado msql, tiene sqlite. cómo lo hago?
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines