Jump to content

jodunno

Members
  • Posts

    222
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by jodunno

  1. look closer at your code, please:
     

    <span class="login100-form-title p-b-43" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post">

    it seems as though you may be new to html as well.
    action and method attributes belong with the form element not the span element.

    also, just use action="#" or leave it blank action="" versus the awful idea of PHP_SELF.

    you should recode your form correctly.
    you should also read about get and post methods.
    your php script should be separated into post and get content:

    if server request method = post then check login etc redirect to dashboard else show your form page

    do you not understand the problems with your code?
    try reading about forms and handling form submissions (posts).

    remember to exit after a header redirect.

    Best wishes.

    • Like 1
  2. Hello Skorpio,

    I just want to add a method to accomplish the task of separating single and double quotes: use single quotes to echo html with double quotes then concatenate variables, arrays and constants. Using your original code and the code suggested by Barand as a basis:

    echo '<li><a href="' . $row['url'] . '" title="' . $row['title'] . '"><i class="fas fa-user site-nav--icon"></i> Help</a></li>';

    it is probably what you were looking to accomplish.

    Barand is a superb coder! I don't know gw1500se but gw1500se is also a pro, so i am not trying to step on anyones toes here. I see what you are doing and i think i can help you see what you should've been doing instead. Some people do not like spaghetti code (mixing php with html) so use whatever method suits you best. Again, i am just trying to add a method that is successful for me whenever i use the pasta :-)

    Best wishes,

    John

  3. hmm, i think that preg_match_all should have three parameters:
    preg_match_all ($pattern, $subject, $matches)

    the posted code only contains $pattern and $subject (2/3).
    preg_match_all( "/$needle/im", $haystack )

    php manual entry for preg match all

    most helpful text from the php manual:
    "Searches subject for all matches to the regular expression given in pattern and puts them in matches in the order specified by flags."

    maybe i am wrong but i think that a proper parameter count will solve the problem.

  4. you really are a fantastic programmer. You work very quickly, so it is obvious that coding is second nature to you. I have alot to learn before i could reach such a level. I cannot thank you enough for spending time on this subject. I was pulling my hair out trying to get it to work. Your code makes much more sense.

    I will add my species list to your table design and try it out tomorrow. I'm going to bed soon. I've sent a zip file to you with some of my routing code that uses my taxonomical arrays. The router just explodes the path to check for a rank. I then use a rank and name array so the page knows what it is (latin and vernacular). I believe my arrays are actually called $yourRank and $yourName. So each traversal through the file system can ask what it is and recieve an answer. I can show you the code if you need to see how it works.

    Anyway, i'll try this tomorrow. Sleep well, Barand and please stay healthy. I hate this corona stuff that we all have to deal with.

  5. 5 hours ago, Barand said:

    Sounds like you are manully typing in the data when you already have it in your files. (Or are keywords a new addition?)

    i only maintain a latin (scientific) name with a German translation (if one exists in vernacular form). Alot of insects do not have a common name. I live in Berlin, so German is the default language of the system. I wanted to add English since it is my native language but it does not exist in my flat files at this time. So English is being added to search table. I try to add both American and British English whenever possible. I suppose that it might be easier to use my flat files for this data?

    I will zip some of my code for you to look at, so you can see how my site is working. Code will answer more questions than i can answer. I'll show you how my router works based upon the flat file system. I was going to convert it to a db but it was easier to continue with a functional approach because php has more power than sql. For example, if else. I kept the functional approach for this reason and because i am really new to database design. I can only issue basic commands using sql. join is beyond me right now. But again, my functions work very well and quickly and i have more power over the data with php. Thus, i keep using them instead of a db.

    originally, i had folders and files (static pages of html/css only). I experimented with php and ended up with a routing system which depends upon arrays. I never tweaked the arrays to something smaller and easier like numbers. My goal was to eliminate files and folders. I've accomplished this goal.

    Anyway, many keywords are not in the arrays used to fill the template with selections. I'd have to add multi-dimensional arrays for other languages.

    it may be easier to show you code. I'll email some scriots to you, if it is okay to do so.

  6. I am trying to build the table of birds for search keywords and it is brutal. I've spent two hours now and i only have 15 species entered of 79. While building this list i wondered if it would be faster to make a large array in cpp and use that instead. Then i got an idea for a cache system. Instead of building a database, how about i build a cache folder with every possible keyword as a file with pre determined results? wouldn't that be fast and easy? so cache folder has meise.php meisen.php and soundexmeise.php and soundexmeisen.php since i am manually building this list i think it would be better than using a slow and sluggish database.

    what do you think? search meise and if file exists searchterm.php then show file with manually entered matches.

  7. I made a video of my site but it is 163mb and too large to attach to email from Google. I'll try to add two screen captures, nay, resized screen captures. I hope that they are small enough to attach here. I've spent alot of time on the front end trying to avoid the cookie cutter designs.

    anytime i mention photos and trying to protect my hard work, people automatically think that my photo driven site is porn or something. LOL

    I had some things/designs in mind when i began the site: photo backgrounds that can be disabled, background tint that can be changed and strength can be changed, language options, bookmarks (browsers have no business knowing what your customers are looking at. my pages are protected, so i offer a bookmarking system which also stops browsers from aiding yet more espionage), i wanted a search feature but i'm struggling with this concept, i recently imagined my sticky notes being private messages (which you all ready know about) and i wanted to keep all of my photos and data outside of the root directory. I've managed to accomplish most of these tasks on my own.

    photo1.jpg

    photo2.jpg

  8. 10 hours ago, Barand said:

    Bird porn?

    yes, i'm making a nature porn website. I'm hoping to have a million bird subscribers. 😄

    I think that i'll call my site "feather fantasy". LOL

    Birds are easy to id in most cases. Flies, spiders and beetles pose a big problem most of the time. If you ever start photographing nature you will learn that many insects cannot be identified by photo, which sucks. You may have an award winning photo but no id for the subject. Experts will often tell you species sp. I started studying this subject and i managed to teach myself how to dissect and identify my own subjects. Sometimes i need experts to confirm my id.

    I will attach an example of fly porn: a male Helina pertusa

     

    Helina-pertusa-m.jpg

  9. 1 hour ago, Barand said:

    I was expecting you to have thousands of species.

    I have one thousand one hundred species documented (photos, genitalia, confirmation from experts, data and measurements). Building my site prevents me from working on nature.

    Anyway, i don't use a database for retrieving species. I use alphabetic functions which return arrays to load each rank. I don't have actual php files per species. I use one file to load all species based upon the flat file functions. I avoid using a database for every little aspect of the site to avoid locking and overruse. My alphabetic/targeted approach is working faster than a db. I use the db to verify that you are a logged in user and match your db session id with your session id instead. In order to use a search, i'll have to build a search table.

    I actually narrow the alphabetic approach to the first three letters of the target. So Aves will be found in function file A under function Ave. Lightning fast retrieval and better than a db.

    Best wishes.

  10. 43 minutes ago, Barand said:

    I may be guilty of exaggeration. I was just saying that the queries are are going be as slow as they could get.

    If you want to send me a dump of your full taxonomy table I'll experiment to see if I can find a way to make searches more efficient

    Hi Barand,

    I don't think it is exaggeration since we are talking about internet usage. People/website users think a second too long is a second too long. I was just confused because my queries were working fast on xampp. Anyway, i've removed this code and started over.

    the taxonomy table is very small for search testing. I now only have Cyanistes caeruleus in the table. I've started over. I will build a bigger table for experimentation and send it to you. Meantime, my website started out as static html/css. I decided to take it to the server side using php. I started studying php two years ago in my spare time. I have acquired alot of knowledge since then but i am still a novice. I just don't know how certain tasks are accomplished in this industry. Anyway, i have a species list for each major class. I use it on my publicly non-logged in pages for prospective members to see which species i have documented. I can also send a copy of these lists to you. I mean, if there is any significance in doing so. Otherwise, please allow me to build a bigger table. I will send the code and also a dump of the database for you. You would probably shriek if you saw my entire website code. LOL I use my own router based upon post methods. I do alot of things that coders hate. For example, i use the session to store image names for loading on a page so that images cannot be viewed unless the variable is set. You'd probably lay an egg looking at that code alone. I also keep my taxonomical navigator private with prg posts instead of uris with get requests. You'd probably faint if you saw it. So i will stick to the relevant code for critique.

    I will build my table tommorrow. I am very tired today and i will go to bed soon.

    Thank you for guiding me in the right direction. As a wanna-be coder, it is very nice to have a master coder offer advice and guidance. Really, i appreciate every word that you type to me.

    Best wishes. Stay healthy and happy.

  11. Hi Barand,

    your opinion is trusted, naturally, i just wonder what you mean by finish by breakfast since my results are instantaneous on xampp. I assume that you mean lots of users? anyway, i heed your advice and remove the current code.

    I have started over with full text and match against, like so:

    CREATE TABLE taxonomy (id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, title VARCHAR(128), link VARCHAR(128), keywords TEXT, FULLTEXT (keywords)) ENGINE=InnoDB;
    
    INSERT INTO taxonomy SET title = 'Cyanistes caeruleus', link = 'path/to/sp', keywords = CONCAT ('Cyanistes caeruleus blau meise meisen blaumeise blaumeisen blue tit tits bluetits bluechickadees chickadee chickadees',' ',soundex('Cyanistes'),' ',soundex('caeruleus'),' ',soundex('blau'),' ',soundex('meise'),' ',soundex('meisen'),' ',soundex('blaumeise'),' ',soundex('blaumeisen'),' ',soundex('blue'),' ',soundex('tit'),' ',soundex('tits'),' ',soundex('bluetits'),' ',soundex('bluechickadees'),' ',soundex('chickadee'),' ',soundex('chickadees'));
    
    $keyword = (string) $_POST['suchworte'];
    $skeyword =  (string) soundex($_POST['suchworte']);
    
    $searchQuery = 'SELECT title, link FROM taxonomy WHERE match(keywords) against(:keyword) or match(keywords) against(:skeyword)';

    it is working but i have to add all of the keywords and soundex values.

    is this method better?

    ps: i romanize German, id est, u with umlaut is ue. Thus, soundex is working just fine for me. I really have no complaints. I suppose that they mean non romanized languages?

    Best wishes.

  12. Hello again,

    I've had an exhausting, stressful week but i managed to tinker with my simple name search feature. For some reason, MATCH AGAINST full-text searches failed me.

    So i redesigned my table with id, title, link, keywords.

    keywords is varchar(255), which contains a small list of names for a species in plural form as one word (no spaces). I also discovered the soundex() method of searching for misspelled word matches. I combined like and soundex to get the results that i was seeking.

    so as an example of my current test code:

    $title = (string) '%' . $_POST['search'] . '%';
    $keyword = (string) '%' . str_replace(' ', '', $_POST['search']) . '%';
    $stitle = $skeyword =  (string) '%' . soundex($_POST['search']) . '%';
    
    $Query = 'SELECT title, link FROM taxonomy WHERE title LIKE :title or title LIKE :stitle or keywords LIKE :keyword or keywords LIKE :skeyword';

    and an example of my table data:

    title: Parus major
    link: path/to/Parus/major
    keywords: Parus major Kohlmeisen Coaltits soundex('Parus') soundex('major') soundex('Kohlmeisen') soundex('Coaltits') soundex('Kohl') soundex('meisen') soundex('coal')

    now i wonder if this is too complicated and searches will slow down my website?
    i just want to add a very basic/primitive/simple search feature.
    i really don't like java and i am not interested in using the free java based search engines like Lucene, Solr etc.
    besides, i am not indexing pages. I all ready maintain a manually edited.controlled species list.
    i just want the species list to be searchable.

    is this new code okay? any suggestions? any criticism?
    call me a stupid loser for all i care, just please explain why this method is bad/negative and how could i make it better?

    so far it is working well for me. I can type meisen and all entries appear. I can also type maisen and get the same results via soundex. I like it but i am nescient about this subject.

    Thank you.

  13. Hi requinix,

    I'm actually happy that I can offer a basic search for taxonomy using a database. I am not an advanced programmer yet so building an indexer is not my goal. I simply desire a list of all of the species that i have photographed and identified via genitalia. I currently have over 1,100 species. Thus, i think that a simple keyword list with a link is good. I don't understand why you object to using a database for such a simple search other than because of memory consumption(?). I use Latin (scientific nomenclature), English and German languages. My reason for posting is because plural searches yield no results. Other than that, i am happy that i am getting results at all. I entered a few examples into a table for testing:

    Turdus merula link/to/file, Turdus philomelos link/to/file, Blaumeise link/to/file, Kohlmeise link/to/file etc.

    typing turdus brings up both merula and philomelos which is good. typing meise brings up both Blaumeise and Kohlmeise. However, typing meisen yields my no results catch (if empty($results))). I just wanted to be able to support plural forms.

    I'm definitely interested in learning how to build a search engine and also in becoming an advanced coder. Such desires could become a reality one day but definitely not anytime so soon.

    Best wishes, requinix.

    Hi Barand,

    That is great! Thank you for adding this data. I will recode my simple search query and enjoy the new results.

    I was wondering if building a separate database for searches is a good idea or not. I say this because i think that i could make searching faster by adding a table for all letters of the alphabet. Then, take first letter of search term and narrow the field to a single table. Like a dictionary with lettered thumb indexes. Go right to the relevant letter and spare the database resource consumption. yes? no?

    just an idea.

    I have to go now. Best wishes to all!

  14. Hello everyone,

     

    I am wondering if anyone can offer tips for dealing with plural forms of words in searches? l was wondering if boolean mode is simply the answer or if i should implement a keywords column which contains a list of keywords including plurals to be searched with like? I simply wish to find the database entry (which is in singular form) when a user searches for a plural form (user searches for meisen but title column houses meise).

    Best wishes

  15. Dear Barand,

    Brilliant! Thank you for the design model and the user id tip to avoid display name issues. I will work on a test mail system and see how it goes as a rough draft. I think that maybe i should call this messaging system notes instead of mail to avoid confusion with real email systems. Private Notes with individual/self, friends or group settings. File upload is easy enough (although security is complicate and delicate.) I will also implement soft deletions and copyright infringement blocks. File uploading will have to deal with all of the legal issues that accompany the process for sure.

    I will start working on this design sometime today. I'm currently adjusting my bookmark system because i use a one hit history for taxonomical browsing. bookmarks overwrite the history and i want to avoid this overwriting. Thus, i am setting a variable to detect that a bookmark was used to access the rank which in turn avoids rewriting history. I guess a good name for it is paradox variable. if paradox then do not log history. The onetime history is to make it easy to return to your last view in the taxonomical browser. Anyway, I will adjust this bookmark problem, then start working on the Note system.

    Thank you and Best wishes.

    ps you are so Brilliant with databases. You make it seem so simple.

  16. Hello to all,

    I have an idea for my website but i am hoping to have some design tips from experienced members. I am not a programmer or a database designer. I am not asking for code as i am capable of coding with pseudocode guides. I am not sure how to properly implement my ideas.

    here is my idea and necessary site data:

    i have a member application for taxonomy (nature, meaning that i identify animals by keys or dissection and i am providing my own biological research material for all of the ranks that i have documented to date.) I ask for application login name and password, then a separate display name (i don't want your login name used anywhere on my site. it is only for application access.) The screen name can be changed (poses a problem with my idea, so i need a solution for handling the problem, which i will mention below). I want to add a mail box which is not public like an email provider. This is more like a private messaging system. I will call it post and your messages will be displayed as sticky notes with titles that are clickable to the full message/note. The only way to use this private mail system is to manually add display names that you trust to a friend list. Once a friend is added by screen name, then you can accept and send messages to this person. Some messages can be notes for your own viewing (not available to friends, thus i suppose a db column flag is appropriate, such as column named privatenote- = yes/no, 1/0 etc).

    then i would like to add a "group" feature where the messages are visible in a group page/tab. The site is private but these notes are visible to all in the group like a public gathering/meeting.

    then i would like to allow file uploads for sharing data. For example, a scientist may join my site and offer a research paper for download to anyone in his/her friend list.

    a problem with adding friends to a list is that i use the display name which can be changed. so i need to be able to update all friend lists if a member changes his/her display name.

    so i am wondering how to design such a database or do i just make tables in my current members database which also holds a bookmarks table.

    anyone willing to offer advice for such a feature?

    Best wishes.

  17. Hi gizmola,

    I typically do not understand certain mysqli code and i usually ignore it. I am happy with pdo and pdo is usually suggested by experts, like you, anyway.

    Meantime, i should also explain my code and repost it. You may notice a break(2) and wonder why it exists, for example. My code acually contains a switch based upon a form post. I keep all of my bookmark db code in one file (bookmarksdb). I have a page to display all bookmarks (case 'select'), a page method to add a bookmark on bookmarkable pages (case 'insert') and a page to delete bookmarks from your bookmarks list (case 'delete'). I also use a counter case which simply returns the count ($result['total']). The counter (case 'count') is used as a small circle that holds the count of bookmarks to be displayed at the top right div of the bookmarks page icon. I use it like a phone apps new messages bubble beside app icons. Thus, the icon count bubble will inform you how many bookmarks you have to avoid a need to view the bookmarks page just for this info.

    <?php declare (strict_types = 1);
    $dbhost = '127.0.0.1';
    $dbname = 'test';
    $dbuser = 'root';
    $dbpass = '';
    $dbattr = array(PDO::ATTR_EMULATE_PREPARES => false,PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC);
    
    try { $connection = new PDO("mysql:host=$dbhost; dbname=$dbname; charset=utf8mb4", $dbuser, $dbpass, $dbattr); }
    catch (PDOException $e) { error_log($e->getMessage()); }
    
        $query = 'SELECT count(*) as total FROM bookmarks WHERE uid = :uid';
        $stmt = $connection->prepare($query);
        $stmt->execute(array(':uid' => $uid));
        $result = $stmt->fetch();
    
    switch ($action) { //$action is known by session array key which holds the csrf token of the form field posted
      case 'delete':
        //code to delete a bookmark, which relies upon !empty($result['total']) 
        break;
      case 'insert':
        if ($result['total'] < 100) { 
            $query = 'SELECT link FROM bookmarks WHERE uid = :uid';
            $stmt = $connection->prepare($query);
            $stmt->execute(array(':uid' => $uid));
            while ($column = $stmt->fetch()) {
                if ($column['link'] === $link) { $duplicate = true; break(2); }
            }
                $query = 'INSERT into bookmarks (uid, type, link, icon, label, date) VALUES (:uid, :type, :link, :icon, :label, NOW())';
                $stmt = $connection->prepare($query);
                $stmt->execute(array(':uid' => $uid, et cetera...));
        } break;
    
    }

    I still don't know how to handle errors from the other queries. I don't want my site to break and a white page to be shown with error data. I prefer that my site remain visible and i display the error and not the software. I have no idea how to do this yet.

    anyway, Thank you for the info in this thread. I appreciate everyone taking time to help me. Like i said before, i am not delusional about my status here. I am not a programmer at all. I am street smart for sure and able to code despite no education in this field. I sometimes do things correctly and many times just get something to work. No matter what, i always appreciate professionals offering inside advice. I sometimes wish hackers would dump source code to big tech company websites so i can truly learn how the pros do it. I enjoy coding when i can do it correctly but i lack so much info about this industry. I often have to employ street smarts to bring a concept to life. I have no programming friends so i never receive inside intel about 'how the pros code common ideas'.

    ok, too much babbling and i far too much work to do today. Off i go...

    Best wishes.

  18. Hello gizmola and benanamen,

    Thank you for the informative replies. I did not know that one can "enforce uniqueness on a user/link basis". I am nescient about sql. I will have to drop my table and rebuild it now. I don't mind an extra query if there is no other way but clearly you know of a better way. I will drop the table and add the new unique constraint. Thank you for this valuable info!!! I should've expressed my desires clearly. My apologies for any vagueness in this thread. Your assumptions are correct about unique links per user. I just want to allow bookmarks but not duplicate entries for each user. I am excited to learn how to do this properly. I doff my hat to you! Thank you.

    I use pdo. I just started studying php two years ago in my spare time. I never learned mysqli. I made my first login script two years ago using pdo. Thus, i only know pdo.

    my code is slightly different than the following but only by variable names. I clean it up for posting here because some people just insist on doing things their way. such as, naming db variable $conn, $stmt etc. I use my own names.

    <?php declare (strict_types = 1);
    $dbhost = '127.0.0.1';
    $dbname = 'test';
    $dbuser = 'root';
    $dbpass = '';
    $dbattr = array(PDO::ATTR_EMULATE_PREPARES => false,PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC);
    
    try { $connection = new PDO("mysql:host=$dbhost; dbname=$dbname; charset=utf8mb4", $dbuser, $dbpass, $dbattr); }
    catch (PDOException $e) { error_log($e->getMessage()); }
    
        $query = 'SELECT count(*) as total FROM bookmarks WHERE uid = :uid';
        $stmt = $connection->prepare($query);
        $stmt->execute(array(':uid' => $uid));
        $result = $stmt->fetch();
        $Total = $result['total'];
    
        if ($Total < 100) { 
            $query = 'SELECT link FROM bookmarks WHERE uid = :uid';
            $stmt = $connection->prepare($query);
            $stmt->execute(array(':uid' => $uid));
            while ($column = $stmt->fetch()) {
                if ($column['bm_path'] === $bmPath) { $duplicate = true; break(2); }
            }
                $query = 'INSERT into bookmarks (uid, type, link, icon, label, date) VALUES (:uid, :type, :link, :icon, :label, NOW())';
                $stmt = $connection->prepare($query);
                $stmt->execute(array(':uid' => $uid, et cetera...));
        }
    

    I wonder if you have any suggestions about making my code better. Please remember that i can now remove the SELECT link query because you showed me how to enforce a unique link per user. Honestly, i am very happy about this info.

    Best wishes.

  19. On 5/9/2020 at 6:44 PM, jodunno said:

    I do not have so much coding experience as you do, so i am a bit slow. I'll update the post when i can finish this feature.

    Hello again,

    I've finally added my bookmarking system and it is working! However, the unique key constraint had to be removed because it is applied to the single table. The unique constraint could only work with a table for each user. I had to add a pre-insert query to check for a duplicate entry (a loop with if column = attempted link). Other than the unique constraint error, al is good. Thanks again!

     

    edit: what i mean by unique constraint is that my site crashed with a duplicate entry error (1062) when i added the same link from a different account. I failed to realize too that the unique constraint will allow the link to be entered for only one user in the table.

    Best wishes.

  20. On 8/1/2020 at 9:53 PM, jodunno said:

    I strongly urge you to create a practice file. You have to integrate your code to the pdo format. You implemented pdo but you still have old mysqli statements left in the code which need to be removed. I wouldn't loop at all if you are only fetching all columns in one row. a loop is necessary if you need all columns from many rows.

    xampp is nice and easy to install. set up a simple database and create a php file to practice pdo. like so:

    
    database name: mytestdb
    table name: convoys
    columns: id, user_id, convoy_name, convoy_organizer
    
    $host = 'localhost';
    $yourdbnamevar = 'mytestdb';
    $your_db_username = 'root';
    $your_db_password = '';
    $attributes = array(
      PDO::ATTR_EMULATE_PREPARES => false,
      PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
      PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC
    );
    $fake_id = 1;
    $connection = new PDO("mysql:host=$host; dbname=$yourdbnamevar; charset=utf8mb4", $your_db_username, $your_db_password, $attributes);
    $query = 'SELECT convoy_name, convoy_organizer FROM convoys where id = :id';
    $start = $connection->prepare($query);
    $start->execute(array(':id' => $fake_id)); 
    $result = $start->fetch();
    
    echo $result['convoy_name'] . '<br>' . $result['convoy_organizer'];
    

    Best wishes.

    advice allready given. read entire thread b4 trolling.

  21. so this is not correctly formed. I wish i knew how to describe the variables accurately but i do not know how to do so. let's try it this way and see if it makes sense:

    you need to define a way to connect to the database using pdo. thus $bdd = new PDO (); you can name this variable whatever you want to name it. $80s_rocker_still_rockin_but_missing_me_long_hair = new PDO(). get it?

    then you need a query, which can be called whatever you want it to be called. such as $qry, $query, $scorpions_bad_boys_running_wild. who cares about the name. The concept is important here: $jodunno_nuthin = 'SELECT * FROM convoy_part WHERE user_convoy= :I"; you are actually going to 'prepare' this query for execution.

    then you use another variable named anything that you want to represent the database actions being performed. $s2, $start, $kix_blow_my_fuse or whatever.

    $gnr_nighttrain = new PDO("bla blah", more-blah , blah);

    $jodunno_nuthin = 'SELECT * FROM convoy_part WHERE user_convoy= :I";

    $load_the_cannons = $gnr_nighttrain->prepare($jodunno_nuthin);

    $load_the_cannons->execute(array(':I' => $_GET['id']));

    $db_is_shooting_back = $load_the_cannons->fetch();

    put it all together in one sensical operation. so let's light the cannons and fire:

    $query = "SELECT * FROM convoy_part WHERE user_convoy= :I';
    $start = $bdd->prepare($query);
    $start->execute(array(':I' => $_GET['id']));
    
    then perform your fetch. think of a dog chasin' a stick: fetch boy!
    $result = $start->fetch();

    naming variables really doesn't matter when you are practicing code. understanding variables is 'sehr wichtig'. keep it all sensical, logical and easy to understand when you look at the code 5 years from now. The idea is to understand what $bdd represents and what $query represents, etc. you are often times getting lost and mixing variable names as if you don't understand what is happening. stay focused!

    Best wishes.

×
×
  • 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.