Jump to content
Larry Ullman's Book Forums

laurent vignaux

Members
  • Posts

    56
  • Joined

  • Last visited

laurent vignaux's Achievements

Newbie

Newbie (1/14)

2

Reputation

  1. Hello Larry, Yes, i read it and at first i try to install Composer and Elastic but i have a problem with Java' version on my mac. For Composer it's ok, not for Elastic. So i thinking that it will be so important. Now, i understand my problem. i re-read the chap 20. i try again and hope to win the match… Ok it's right, Elastic with Composer is installed. thanks for advice cordialy
  2. De rien babakitien, J'espère que cela résoudra ton problème. Moi, j'ai un interrogation avec l'exemple du CMS ch22 version Yii1. J'ai l'impression qu'il manque des fichiers et dossiers As tu teste cet exemple ? cordialement
  3. hello Babakitien, perhaps your internet's solution http://www.yiiframework.com/forum/index.php/topic/48375-creating-a-drop-down-list/ or http://stackoverflow.com/questions/16036927/get-selected-value-from-chtmldropdownlist best regards
  4. Hello Larry, i work with the version 1 to yii as the version 2 seems to be great. I wait with "impatience" the end of yours version 2's book. There is no dossier "vendor" and "runtime" in example CMS ch22 I try to work on CH 22 of the book with version 1. require_once($yii); $app = Yii::createWebApplication($config); $composer = dirname(__FILE__).'/protected/vendor/autoload.php'; require_once($composer); $app->run(); Ok test and i see that in the browser Error 500 require_once(/Applications/MAMP/htdocs/yiicmsch22/protected/vendor/autoload.php): failed to open stream: No such file or directory Thanks for advice cordialy
  5. Hello Larry, I read your book twice. Honestly I do not understand very well. I have already learned from your books, specially the e-commerce. I like the principle of explanation by example. In Yii, you go well in the way of doing your best and understand the subtle mechanisms of this framework. So, I yii installs and works correctly. I followed your chapters and wanted to better understand your example. Now i would like test your example CMS. I am unable to launch the application of Cms version of Chapter 22 of your book. The window is hopelessly empty. I notice in the index.php : $compose = dirname (__ FILE __) '/ protected / vendor / autoload.php.'; I do not see a vendor folder in protected'folder and evidently no autoload.php I have my composer.phar in protected folder. Is the problem here? Thanks for advice cordialy
  6. Yes Larry, sorry this part it's ok. it was an extract only to locate the place. You could see the top of the message LIVE -- Une erreur, An error occurred in script '/home/recettesih/www/category.php' on line 6: Undefined index: category <pre>Array ( [0] => Array ( [file] => /home/recettesih/www/category.php [line] => 6 [function] => my_error_handler_lv [args] => Array ( [0] => 8 [1] => Undefined index: category [2] => /home/recettesih/www/category.php [3] => 6 [4] => Array ( [_GET] => Array Since your advice, i don't get more errors. C'est formidable… Thanks a lot cordialy
  7. Thanks Larry for the advice. cordialy this night(5h28), I received this error. I hope this will be over thanks to your advice. [APP_ENGINE_VERSION] => 5.5 [APP_ENGINE] => php [ENVIRONMENT] => production [UNIQUE_ID] => VJEGeAoAPZgAAAoeccoAAAAu [GEOIP_COUNTRY_CODE] => US [GEOIP_COUNTRY_NAME] => United States [GEOIP_REGION] => VA [GEOIP_CITY] => Chantilly [GEOIP_DMA_CODE] => 511 [GEOIP_AREA_CODE] => 703 [GEOIP_LATITUDE] => 38.894299 [GEOIP_LONGITUDE] => -77.431099 [SCRIPT_URL] => /category.php [SCRIPT_URI] => http://recettesoriginales.fr/category.php [CFG_CLUSTER] => cluster007 [PHP_VER] => 5_5 [HTTP_REMOTE_IP] => 208.43.251.182 [HTTP_HOST] => recettesoriginales.fr [HTTP_COOKIE] => xxlplan=R908513162 [HTTP_X_PREDICTOR] => 1 [HTTP_CONNECTION] => close [HTTP_USER_AGENT] => Mozilla/5.0 (compatible; SiteExplorer/1.0b; +http://siteexplorer.info/)
  8. Hello Larry Maybe my question is about the limit of this forum but can nevertheless interested when the live website send forth errors with the exemple 1, i realized a site recettesoriginales.fr For a better url, i transform http://recettesoriginales.fr/category.php?cat_id=1 as http://recettesoriginales.fr/category.php?category=apéritifs so it's ok But I did a few days after launching the site on the web. Now I regularly get errors caused by robots like this: LIVE -- Une erreur, An error occurred in script '/home/recettesih/www/category.php' on line 6: Undefined index: category <pre>Array ( [0] => Array ( [file] => /home/recettesih/www/category.php [line] => 6 [function] => my_error_handler_lv [args] => Array ( [0] => 8 [1] => Undefined index: category [2] => /home/recettesih/www/category.php [3] => 6 [4] => Array ( [_GET] => Array ( [cat_id] => 3 ) [_POST] => Array ( ) [_COOKIE] => Array ( [xxlplan] => R908481581 ) [_FILES] => Array ( ) [_SERVER] => Array ( [USER] => recettesih [FCGI_ROLE] => RESPONDER [APP_ENGINE_VERSION] => 5.5 [APP_ENGINE] => php [ENVIRONMENT] => production [UNIQUE_ID] => VItXuAoAPZIAAEpi6pMAAAGp [GEOIP_COUNTRY_CODE] => FR [GEOIP_COUNTRY_NAME] => France [GEOIP_DMA_CODE] => 0 [GEOIP_AREA_CODE] => 0 [GEOIP_LATITUDE] => 48.860001 [GEOIP_LONGITUDE] => 2.350000 [SCRIPT_URL] => /category.php [SCRIPT_URI] => http://recettesoriginales.fr/category.php [CFG_CLUSTER] => cluster007 [PHP_VER] => 5_5 [HTTP_REMOTE_IP] => 188.165.15.198 [HTTP_HOST] => recettesoriginales.fr [HTTP_COOKIE] => xxlplan=R908481581 [HTTP_X_PREDICTOR] => 1 [HTTP_CONNECTION] => close [HTTP_USER_AGENT] => Mozilla/5.0 (compatible; AhrefsBot/5.0; +http://ahrefs.com/robot/) [HTTP_ACCEPT] => */* [HTTP_X_GEO] => varn36.rbx5 [HTTP_X_GEO_PORT] => 1007 [SERVER_SIGNATURE] => [SERVER_SOFTWARE] => Apache [SERVER_NAME] => recettesoriginales.fr [SERVER_ADDR] => 10.0.97.146 [SERVER_PORT] => 80 [REMOTE_ADDR] => 188.165.15.198 [DOCUMENT_ROOT] => /home/recettesih/www [SERVER_ADMIN] => postmaster@recettesoriginales.fr [SCRIPT_FILENAME] => /home/recettesih/www/category.php [REMOTE_PORT] => 51220 [GATEWAY_INTERFACE] => CGI/1.1 [SERVER_PROTOCOL] => HTTP/1.1 [REQUEST_METHOD] => GET [QUERY_STRING] => cat_id=3 [REQUEST_URI] => /category.php?cat_id=3 [SCRIPT_NAME] => /category.php [PHP_SELF] => /category.php [REQUEST_TIME_FLOAT] => 1418418104.4165 [REQUEST_TIME] => 1418418104 [argv] => Array ( [0] => cat_id=3 ) [argc] => 1 ) an extract of the code /*line 6*/ if( filter_var($_GET['category'], FILTER_SANITIZE_STRING ) ){ $category = $_GET['category']; $q ="SELECT category FROM categorie WHERE category =?"; $stmt = mysqli_prepare($dbc,$q); mysqli_stmt_bind_param($stmt, 's', $category); mysqli_stmt_execute($stmt); mysqli_stmt_store_result($stmt); if(mysqli_stmt_num_rows($stmt) !== 1 ){ $page_title = 'Error!'; include('./is/error-page.php'); /* include('./is/header.inc.html'); echo'<div class="alert alert-danger">Vous avez accéder à cette page par erreur. </div>'; include('./is/footer.inc.html'); */ exit(); } mysqli_stmt_bind_result($stmt, $category); mysqli_stmt_fetch($stmt); mysqli_stmt_close($stmt); $page_title = $category; include('./is/header.inc.html'); ?> ../.. and if i test in live http://recettesoriginales.fr/category.php?cat_id=4 i have my response error message "Vous avez accéder à cette page par erreur. Désolé." so it's the true and ok so i you are an advice cordialy
  9. Hello rocky66, I use the exemple of this site to develope a recipes sharing site So, i use this "plus" on my site recettesoriginales.fr …if you are a user evidently you can read also this article from Larry on peachpit'site, Creating an Ajax-Enabled Rating System for Your Website http://www.peachpit.com/articles/article.aspx?p=1681764 So thanks Larry for your books. cordialy
  10. Hello, so now this part of reflexion and application is ok. I find all code for the part of Extending the first site, "Placing HTML content in Multiple Category" p.406 . I use Tag for Category. Certainly, some ameliorations are possible, but it's match. All suggestions are welcome. //le code en extraits if( isset($_GET['page_id']) && !$_POST ){ //recuperer les infos $page_id = $_GET['page_id']; //SELECT $q = "SELECT les valeurs FROM pages WHERE page_id=?"; $stmt = mysqli_prepare($dbc, $q); //associe selon mysqli_stmt_bind_param($stmt,'i', $page_id); mysqli_stmt_bind_result($stmt, $user_id, les valeurs, etc...); // $OK = mysqli_stmt_execute($stmt); mysqli_stmt_fetch($stmt); mysqli_stmt_free_result($stmt); //pour la table des tags $q = 'SELECT tag_id FROM pages_tag WHERE page_id=?'; $stmt = mysqli_prepare($dbc, $q); //bind mysqli_stmt_bind_param($stmt,'i', $_GET['page_id']); mysqli_stmt_bind_result($stmt, $tag_id); $OK = mysqli_stmt_execute($stmt); //loop tag à récuperer (voir avec Formulaire) $selected_tags = array(); while (mysqli_stmt_fetch($stmt) ) { $selected_tags[] = $tag_id; } }//end if GET //et maintenant le formulaire à enregistrer if(isset($_POST['update'])){ $page_id = $_POST['page_id']; if(!empty($_POST['title']) ){ $title = escape_data(strip_tags($_POST['title']), $dbc); }else{ $update_page_errors['title'] = 'SVP, un titre'; } //les autres valeurs à verifier if(empty($update_page_errors) ){ //Update $q ="UPDATE pages SET VALEURS=? WHERE page_id=? "; $stmt = mysqli_prepare($dbc, $q); mysqli_stmt_bind_param($stmt, 'iisssssssi', $VALEURS); $title= strip_tags($_POST['title']); $done = mysqli_stmt_execute($stmt); //delete les valeurs existantes de tag $q = "DELETE FROM pages_tag WHERE page_id=?"; $stmt = mysqli_prepare($dbc,$q); mysqli_stmt_bind_param($stmt, 'i', $_POST['page_id']); mysqli_stmt_execute($stmt); //inserer les nouvelles valeurs pour la table pages_tag if(isset($_POST['tag']) && is_numeric($_POST['page_id']) ){ $page_id = (int) $_POST['page_id']; foreach ($_POST['tag'] as $tag_id) { $values[]="($page_id, " . (int) $tag_id . ')'; } if($values){ $qInsert ='INSERT INTO pages_tag (page_id, tag_id) VALUES ' . implode(',', $values); mysqli_query($dbc, $qInsert); }//fin values }//end if postTag et page_id }//END pas erreur $update else { echo 'Tous les champs doivent être remplis'; } } //ifPost UPDATE best regards cordialy
  11. Thanks Larry. Now, after the SELECT action, i work on the UPDATE part of the updating's page. Cordialy
  12. Hello, Book "Effortless E-Commerce with PHP and MySQL (2nd Edition)" -- Annexe -- html content multiple cat" of ex1- suite. i find the soluce is in the form checkbox with the in_array function and transform the result of $tag // php/sql query SELECT GROUP_CONCAT(t.tag) AS tag $tagNom = preg_split("/[\,]+/", $tag ); <div class="checkbox form-control"> <label for="tag" class="control-label">Tag</label> <?php $qt="SELECT tag_id, tag FROM tag ORDER BY tag DESC"; $r=mysqli_query($dbc,$qt); while ($rowt=mysqli_fetch_array($r, MYSQLI_ASSOC)) { //print_r($rowt); $monTag_id = $rowt['tag_id']; $monTag = $rowt['tag']; ?> <div class="checkbox <?php if(array_key_exists('tag', $update_page_errors)) echo ' has-error'; ?>"> <label> <input type="checkbox" name="tag[]" id="<?php echo $monTag ?>" value="<?php echo $rowt['tag_id'] ?>" <?php //print_r($tagNom); if( isset($tagNom) && in_array( $monTag , $tagNom ) ) echo !empty('checked="checked"') ? 'checked="checked"' : '';?>><?php echo $rowt['tag'] ?> </label> </div> <?php if(array_key_exists('tag', $update_page_errors)) echo'<span class="help-bloc">'.$update_page_errors['tag'].'</span>'; ?> <?php } ?> </div> Cordialy
  13. hello thanks for an answer. Yes, it's only an application and the developement of "html content multiple cat" of ex 1. For the query SELECT, I can not recover in the Form the registered tag of the bd . Only one appears and is always the last in the list. For select the tag's field, I use "GOUP_CONCAT (tag) and the result is a list of string of tags. ie : végétarien,classique I transformed into array with the function preg_split with a comma: preg_split ("/ [\,] + /", $ tag); I created a foreach and I compare the name for the index recovered for : la value : végétarien , tag_id = 1 ; la value : classique , tag_id = 5 $tag("végétarien", 1); tag $ ('classique', 5); But no, only one result is cheked , the last one : tag $ ('classique', 5) I really do not understand where is the error; thank you for advice or a solution perhaps best regards <div class="checkbox form-control"> <label for="tag" class="control-label">Tag</label> <?php $qt="SELECT * FROM tag ORDER BY tag DESC"; $r=mysqli_query($dbc,$qt); while ($rowt=mysqli_fetch_array($r, MYSQLI_ASSOC)) {?> <div class="checkbox <?php if(array_key_exists('tag', $update_page_errors)) echo ' has-error'; ?>"> <label> <input type="checkbox" name="tag[]" id="<?php echo $rowt['tag'] ?>" value="<?php echo $rowt['tag_id'] ?>" <?php if(isset ($tag) && ($tag_id== $rowt['tag_id']) ) echo !empty('checked="checked"') ? 'checked="checked"' : '';?>><?php echo $rowt['tag'] ?> </label> </div> <?php if(array_key_exists('tag', $update_page_errors)) echo'<span class="help-bloc">'.$update_page_errors['tag'].'</span>'; ?> <?php } ?> </div>
  14. Hello Larry, Hartley, suite of the multiple Category advice, (ps. For me i use a "button checkbox" instead selector and "Tag" for Category) The insert function is ok. i worked on another part of my site and i come back to the author admin. For UPDATE information all is ok but only one field don't match well : "Tag" . Only 1 checkbox is checked on the form and this is the last one. in DB $tag = (végétalien, sans gluten, classique) $tag = explode(',', $tag); foreach ($tag as $tags) { switch ($tags) { case "végétarien": $tag_id = 1; break; case "végétalien": $tag_id = 2; break; case "sans gluten": $tag_id = 3; break; case "sans lactose": $tag_id = 4; break; case "classique": $tag_id = 5; break; default: $tag_id = 0; break; }//switch echo( '<br /> tag : ' .$tags .' et tag_id : ' . $tag_id .'<br />'); // echo // tag : végétalien et tag_id : 2 tag : sans gluten et tag_id : 3 tag : classique et tag_id : 5 the query is ok all tags are here and ok with BD but Only one checkbox is checked on the form. The FORM <div class="checkbox form-control"> <label for="tag" class="control-label">Tag</label> <?php $qt="SELECT tag_id, tag FROM tag ORDER BY tag DESC"; $r=mysqli_query($dbc,$qt); while ($row=mysqli_fetch_array($r, MYSQLI_ASSOC)) {?> <div class="checkbox <?php if(array_key_exists('tag', $update_page_errors)) echo ' has-error'; ?>"> <label> <input type="checkbox" name="tag[]" id="<?php echo $row['tag'] ?>" value="<?php echo $row['tag_id'] ?>" <?php if(isset($tag) && ($tag_id == $row['tag_id'])) echo !empty('checked="checked"') ? 'checked="checked"' : '';?>><?php echo $row['tag'] ?> </label> </div> <?php if(array_key_exists('tag', $update_page_errors)) echo'<span class="help-bloc">'.$update_page_errors['tag'].'</span>'; ?> <?php } ?> </div> an error on the html form? Sometimes when we have only one and the last response with a loop, it's a problem in a loop ? Some advices and thanks for reply Merci d'avance pour une piste de recherche Cordialement
×
×
  • Create New...