Jump to content

deuxk

New Members
  • Posts

    2
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

deuxk's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, I'd get to do a join query with 3 (sometimes 2). Here is the structure of my 3 tables in question: items> id, cat, subcategory, created status> itemId, level Modify> id, itemId, date, type Here's my query so far: SELECT i.id, i.userId FROM items i LEFT OUTER JOIN statut s ON i.id = s.itemId WHERE CASE WHEN ( SELECT m.date FROM modification m WHERE m.itemId = i.id ORDER BY m.date DESC LIMIT 1 ) IS NULL THEN i.created END > DATE_SUB(NOW(), INTERVAL 90 DAY) AND s. LEVEL = 1 I would like to get a look at what the last change add and see if it has been over 90 days. In case no change was made compared with the creation date of the item. He that can strongly that there are several changes to a single item so it should really checked with the last added in case there. Thank you for your help!
  2. Hi, I try to make refresh my form page when the user chose a country (pays, i'am french). I have program all think for change and load the new states but when i change the country the page don't refresh and i don't have idea for make this work!!! I show you my code and if you have solution for it's really appreciate. thanks <? include("administration/dbconnect.php"); $sign_up = 'modules/signup_user/'; define( "FILE_COUNTRY", $sign_up . "country.txt" ); define( "FILE_CA_PROVINCES", $sign_up . "provinces.ca.txt" ); define( "FILE_US_STATES", $sign_up . "states.us.txt" ); function submit( $var ){ global $HTTP_POST_VARS, $HTTP_GET_VARS ; return ( strlen(trim($HTTP_POST_VARS[ $var ])) ) ? trim( $HTTP_POST_VARS[ $var ] ) : trim( $HTTP_GET_VARS[ $var ] ); } function displayCountry( $default = "Canada" ){ print "<select name='country' onchange='document.frmUser.submit();'>\n" ; print "<option value=''>Select</option>\n" ; $countries = file( FILE_COUNTRY ); foreach( $countries as $c ){ $value = htmlspecialchars(trim($c)) ; $selected = strtoupper($default) == strtoupper(trim($c)) ? " selected " : "" ; print "<option value=\"$value\" $selected>$value</option>\n" ; } print "</select>\n" ; } function generateActivation ($length = 18) { $activation_random = ""; $possible = "0123456789bcdfghjkmnpqrstvwxyz"; $i = 0; while ($i < $length) { $char = substr($possible, mt_rand(0, strlen($possible)-1), 1); if (!strstr($activation_random, $char)) { $activation_random .= $char; $i++; } } return $activation_random; } function VerifierAdresseMail($adresse) { $Syntaxe='#^[\w.-]+@[\w.-]+\.[a-zA-Z]{2,5}$#'; if(preg_match($Syntaxe,$adresse)) return true; else return false; } $erreur = ''; $inscription = ''; if (isset($_POST['submit'])) { // verifier si les champs sont rempli au complet if ($_POST['login'] != null && $_POST['nom']!= null && $_POST['prenom'] != null && $_POST['adresse'] != null && $_POST['region'] != null && $_POST['codepostal'] != null && $_POST['telephone'] != null && $_POST['courriel'] != null && $_POST['courriel_verif'] != null && $_POST['password'] != null && $_POST['password_verif'] != null) { $login = addslashes($_POST['login']); $nom = addslashes($_POST['nom']); $prenom = addslashes($_POST['prenom']); $adresse = addslashes($_POST['adresse']); $region = $_POST['region']; $codepostal = addslashes($_POST['codepostal']); $telephone = addslashes($_POST['telephone']); $courriel= htmlentities($_POST['courriel']); $courriel_verif = htmlentities($_POST['courriel_verif']); $password = md5($_POST['password']); $password_verif = md5($_POST['password_verif']); $activation = generateActivation(); $status = 0; // verifier si le login est deja pris $requete = mysql_query("SELECT login FROM users WHERE login = '$login'") or die(mysql_error()); $compte = mysql_num_rows($requete); if ($compte == 0) { // verification si le email est ecrit correct et si il est deja pris! if ($courriel == $courriel_verif) { $requete = mysql_query("SELECT courriel FROM users WHERE courriel = '$courriel'") or die(mysql_error()); $compte = mysql_num_rows($requete); if ($compte == 0) { // verification si le email est correctement ecris. if(VerifierAdresseMail($courriel)) { //verification si les 2 password sont pareille if ($password == $password_verif) { //verification si le password a plus de 4 caractere if (strlen($password) >= 4) { // enregistrer & link a l'acceuil mysql_query('INSERT INTO users (id, login, prenom, nom, adresse, region, codepostal, telephone, courriel, password, activation, status, timestamp) VALUES ("","'.$login.'", "'.$prenom.'", "'.$nom.'", "'.$adresse.'", "'.$region.'", "'.$codepostal.'", "'.$telephone.'","'.$courriel.'","'.$password.'","'.$activation.'","'.$status.'","'.$time.'")'); $sujet = 'Votre activation'; $expediteur = 'Administration'; $message = 'Cliquer ici pour activer votre compte : https://www.filmoptionsales.com/site.php?login='.$login.'&courriel='.$courriel.'&activation='.$activation; mail($courriel, $sujet, $message, $expediteur); $inscription = 'ok'; } else { $erreur = $txt17; } } else { $erreur = $txt18; } } else { $erreur = $txt19; } } else { $erreur = $txt20; } } else { $erreur = $txt21; } } else { $erreur = $txt22; } } else { $erreur = $txt23; } } if ($inscription == '') { ?> <center> <table width="600" CELLPADDING= CELLSPACING=0> <tr> <td align="center" class="text1"><h3><? echo $txt25; ?></h3></td> </tr> </table> <form action="site.php?cmd=inscription&type=user" method="post" name="frmUser"> <br /> <? if ($erreur != '') {?> <table width="600" BORDER=1 CELLPADDING= CELLSPACING=0 align="center"> <tr> <td align="center" style="color:red;"><? echo $txt26; ?><br /><br /> <? echo $erreur; ?><br /><br /></td> </tr> </table> <br /><br /> <? } ?> <table width="600" BORDER=0 CELLPADDING= CELLSPACING=0 align="center"> <tr> <td width="100" class="text1"><? echo $txt3; ?></td><td><input type="text" size="30" name="login" onKeyPress="return login(this, event)" value="<? echo $_POST['login']; ?>" /></td> </tr> <tr> <td width="100" class="text1"><? echo $txt4; ?></td><td class="text1"><input type="text" size="30" name="prenom" onKeyPress="return lettersonly(this, event)" value="<? echo $_POST['prenom']; ?>" /></td> <tr> <td width="100" class="text1"><? echo $txt5; ?></td><td class="text1"><input type="text" size="30" name="nom" onKeyPress="return lettersonly(this, event)" value="<? echo $_POST['nom']; ?>" /></td> </tr> <tr> <td width="100" class="text1"><? echo $txt6; ?></td><td class="text1"><input type="text" size="50" name="nom" onKeyPress="return lettersonly(this, event)" value="<? echo $_POST['adresse']; ?>" /></td> </tr> <tr> <td class="text1" nowrap width="140">Ville :</td> <td><input type="Text" name="city" size="30" value="<?= submit("city") ?>"></td> </tr> <tr> <td class="text1" nowrap>Pays :</td> <td> <? $defaultCountry = strtoupper( submit( "country" ) ? submit( "country" ) : "United States" ); displayCountry( $defaultCountry ) ; ?> </td> </tr> <tr> <td class="text1" nowrap>Province/State :</td> <td> <? if( $defaultCountry == "UNITED STATES" || $defaultCountry == "CANADA" ) { $provStates = file( $defaultCountry == "UNITED STATES" ? FILE_US_STATES : FILE_CA_PROVINCES ); ?> <select name="provOrState"> <? foreach( $provStates as $ps ) { print "<option value=\"" . htmlspecialchars(trim($ps)) . "\">" . htmlspecialchars(trim($ps)) . "</option>\n" ; } ?> </select> <? } else { ?> <input type="Text" name="provOrState" size="30" value=""> <? } ?> </td> </tr> <tr> <td class="text1" nowrap>Postal Code/Zip Code :</td> <td><input type="Text" size="30" name="postalCode" value="<?= submit("postalCode") ?>"></td> </tr> <tr> <td width="100" class="text1"><? echo $txt10; ?></td><td class="text1"><input type="text" size="30" name="courriel" value="<? echo $_POST['courriel']; ?>" /></td> </tr> <tr> <td width="100" class="text1"><? echo $txt11; ?></td><td class="text1"><input type="text" size="30" name="courriel_verif" value="<? echo $_POST['courriel_verif']; ?>" /></td> </tr> <tr> <td class="text1"><? echo $txt12; ?></td><td class="text1"><input type="password" name="password" value="" /></td> </tr> <tr> <td class="text1"><? echo $txt13; ?></td><td class="text1"><input type="password" name="password_verif" value="" /></td> </tr> </table><br /> <input type="submit" name="submit" value="<? echo $txt24; ?>" /> </form> <a href="site.php"><? echo $txt14; ?></a><br /><br /> </center> <? } else { ?> <br /><br /> <table align="center"> <tr><td class="text1" align="center"><? echo $txt15; ?></td></tr> <tr><td class="text1" align="center"><a href="site.php"><? echo $txt16; ?></a><br /></td></tr> </table> <br /><br /> <? } mysql_close(); ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.