Page 1 of 3 123 Last
  • Jump to page:
    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    33
    Rep Power
    2

    Update form in dreamweaver cc


    Can someone give me a hint on how to get only the record of the session user to show in this page?

    PHP Code:
    <?php require_once('../Connections/localhost.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function 
    GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
    {
      if (
    PHP_VERSION 6) {
        
    $theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      }

      
    $theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

      switch (
    $theType) {
        case 
    "text":
          
    $theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
          break;    
        case 
    "long":
        case 
    "int":
          
    $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case 
    "double":
          
    $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case 
    "date":
          
    $theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
          break;
        case 
    "defined":
          
    $theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
          break;
      }
      return 
    $theValue;
    }
    }

    mysql_select_db($database_localhost$localhost);
    $query_rsTenantProfile "SELECT * FROM tenants";
    $rsTenantProfile mysql_query($query_rsTenantProfile$localhost) or die(mysql_error());
    $row_rsTenantProfile mysql_fetch_assoc($rsTenantProfile);
    $totalRows_rsTenantProfile mysql_num_rows($rsTenantProfile);
    ?>
    <!doctype html>
    <!--[if lt IE 7]> <html class="ie6 oldie"> <![endif]-->
    <!--[if IE 7]>    <html class="ie7 oldie"> <![endif]-->
    <!--[if IE 8]>    <html class="ie8 oldie"> <![endif]-->
    <!--[if gt IE 8]><!-->
    <html class="">
    <!--<![endif]-->
    <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Tenant Profile</title>
    <link href="../boilerplate.css" rel="stylesheet" type="text/css">
    <link href="../styles/css.css" rel="stylesheet" type="text/css">
    <script src="../respond.min.js"></script>
    </head>
    <body>
    <div class="gridContainer clearfix">

    <?php

        
    require("common.php");
        include(
    "../templates/header.php");
        if(empty(
    $_SESSION['user']))
        {
           
    header("Location: login.php");
                 die(
    "Redirecting to login.php");
        }
        
    ?>
    <div id="sectionHeader">Tenant Profile</div> Hello <?php echo htmlentities($_SESSION['user']['username'], ENT_QUOTES'UTF-8'); ?>, <br />

      <div id="sectionHeading" class="fluid">Please review the content of your profile and update where necessary</div>
      <div id="sectionBody" class="fluid"></div>
      
    <?php //this is where I want my result to apear in the form below.  More field will be added later on once I know how to get this code working!?>
    <form id="TenantProfileF">
      <input type="text" name="firstname"><br/>
      <input type="text" name="lastname"><br/>
      <input type="text" name="email"><br/>
    </form> 

    </div>
    </body>
    </html>
    <?php
    mysql_free_result
    ($rsTenantProfile);
    ?>
  2. #2
  3. Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jan 2004
    Location
    New Springfield, OH
    Posts
    1,247
    Rep Power
    1469
    If you are using PHP5, why are you using deprecated functions?

    That being said, you're not giving any information about your data source. I can only assume that you need to add a WHERE clause to your query. Right now, you're returning every record in the table.
    Last edited by Nilpo; December 4th, 2013 at 05:40 PM.
    Don't like me? Click it.

    Scripting problems? Windows questions? Ask the Windows Guru!

    Stay up to date with all of my latest content. Follow me on Twitter!

    Help us help you! Post your exact error message with these easy tips!
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2003
    Posts
    3,600
    Rep Power
    595
    You can start by removing the deprecated mysql extensions and switch to PDO. Next you can better explain what you want. None of us are mind readers so we can't know all the things your question is assuming we know about "this page" and the content of your database or even what "the record of the session user" means. Also, what does any of this have to do with dreamweaver in your title?
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  6. #4
  7. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1014
    Oh c'mon! You've asked us how to deal with SQL injections a few weeks ago, and now you're doing the exact opposite of what we told you.

    If you're not interested in what we have to say, then why do you even ask us?
    The 6 worst sins of securityHow to (properly) access a MySQL database with PHP

    Why can’t I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    33
    Rep Power
    2
    Originally Posted by Nilpo
    If you are using PHP5, why are you using deprecated functions?

    That being said, you're not giving any information about your data source. I can only assume that you need to add a WHERE clause to your query. Right now, you're returning every record in the table.
    lol... well that is a long story lol... I am a real newbie at this and I was able to get this code from a tutorial. I am trying to learn as I go. I learned about deprecated function just about a day ago. I had to look up the word in the dictionary as a matter of fact.

    so to answer your question: the data source is a mysql table called tenants. I have made the connect to it and that works fine. I just picked up a subscription of Dreamweaver CC thinking that a lot of the php can be generated with server behavior and I thought it would be a great way to start learning how to code in php by looking at what Dreamweaver wrote while using snipets. anywhoooo, I can't even get Dreamweaver to display anything to start with since the "update record server behavior doesnt' even work and been asking around for 3 days how to get it to work and nobody knows how to. so I decided to take the bull by the horn and by-pass dreamweaver all together and learn how to hard code in php insteat. I know it will take me a few months just to grasp the basic of php but you have to start somewhere; I'm sure you all did.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    33
    Rep Power
    2
    Originally Posted by Jacques1
    Oh c'mon! You've asked us how to deal with SQL injections a few weeks ago, and now you're doing the exact opposite of what we told you.

    If you're not interested in what we have to say, then why do you even ask us?
    True I did asked about sql injections and I learned a great deal about it since then. I was able to get my passwords salted and incryted and learned about the my_real_escape_string() function and all sort of other things. This code I am showing at the moment comes from this site actually and everyone here think it is great codes according to all the posts connected to it. I DON"T KNOW? i;m new at this, what did I do wrong?
  12. #7
  13. Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jan 2004
    Location
    New Springfield, OH
    Posts
    1,247
    Rep Power
    1469
    Originally Posted by jaad
    This code I am showing at the moment comes from this site actually and everyone here think it is great codes according to all the posts connected to it.
    I wrote a lote of code on this site similar to this too, as far back as almost ten years ago. The tutorial you are reading is most likely outdated. Let's try something different. Why don't you tell us what you are interested in learning about instead, and we'll recommend some current tutorials. Does that work for you?
    Don't like me? Click it.

    Scripting problems? Windows questions? Ask the Windows Guru!

    Stay up to date with all of my latest content. Follow me on Twitter!

    Help us help you! Post your exact error message with these easy tips!
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    33
    Rep Power
    2
    Look, I apologize to everyone here. I am very sorry to bug you with my questions. would anyone be able to tell me where I newbie in php can go to start from the start? is there a site or a forum that will show me how to start learning?

    I have been going crazy every night for about a month trying to learn by reading, watching tuorials on youtube and posting in forums. It's not easy to start at something you don't even know where to start to begin with.

    writing in computer codes is like telling yourself "Well, I want to go to Europe and I jump in the water from the shore of Canada to start my swim to Europe. If anyone would have told me I could use a boat to go to Europe, it would make thing a lot simpler for me to reach Europe I think. But if you don't know boat exist, how are you suppose to know if you are doing the right thing or not?

    Comments on this post

    • Jacques1 agrees : Sorry for the harsh reply.
  16. #9
  17. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1014
    Throw away the tutorial. It's crap.

    Copypasting code you found somewhere on the Internet is almost always a very bad idea, because 90% of all "tutorials writers" can barely write their own name. They know less about PHP than you do. In fact, most tutorials are copies themselves, which is why the same nonsense gets passed around since the 90s.

    Half of the "stolen" code doesn't even make sense. It's not just bad. It's brainless.

    If you wanna learn PHP, write your own code. It will take a while, and the result won't be perfect. But at least it's your code. And if you have just a tiny bit of common sense, it will be much better than any of those "tutorials".

    So my suggestion would be to throw away the code, read up on modern database extensions and then write your own code. You can do it.

    I'm sorry for my harsh reply. It's just a bit tiring to repeat the same warnings 10 times a day and then again three times per user.
    The 6 worst sins of securityHow to (properly) access a MySQL database with PHP

    Why can’t I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  18. #10
  19. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    33
    Rep Power
    2
    Thank you Jacques, I will read up the link you sent me. I'm sure I will learn something new with it and start from there. It's hasn't been easy! But I have a good heart and wanting to learn.

    I have been going to bed every night for the last month watching the series of "Computer Science Harvard Extension School) Harvard School I know it by heart now. What I need help with is the fundamentals. I have been a tradesman all my life and I wouldn't have any problem whatsoever renovating your home with any kind of toolbox since I know what every tools does and how to use them. Right now it's like I;m trying to building a house with tools an Alien civilization left on the ground for me to use without any instruction as to what the tools are and what they are used for lol.
    Last edited by Nilpo; December 4th, 2013 at 07:29 PM. Reason: Link fixed.
  20. #11
  21. Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jan 2004
    Location
    New Springfield, OH
    Posts
    1,247
    Rep Power
    1469
    Is there anything you're interested in? A specific type of PHP application you'd like to try building? Most people start with something like a login page, a form mailer, or something similar. Something to begin building. But start small. Don't start learning with the intention of building a blog or MVC framework. Build your house one wall at a time. Basically, start off with something that you can tinker with. Make it work. Post back here and get suggestions on ways to improve it. This way you'll learn by doing, not by watching tutorials alone. I agree with Jacques that most tutorials are terribly written by amateurs who really don't know what they are doing. And the ones who do, generally don't have enough space or time to explain something thoroughly.

    You should also dedicate a bit of study on coding standards and general good practices. This can help you get off on the right foot. The rest you'll learn as you go (and mostly by trial and error!)
    Don't like me? Click it.

    Scripting problems? Windows questions? Ask the Windows Guru!

    Stay up to date with all of my latest content. Follow me on Twitter!

    Help us help you! Post your exact error message with these easy tips!
  22. #12
  23. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    33
    Rep Power
    2
    Originally Posted by Nilpo
    Is there anything you're interested in?
    Actually yes.... I have created quite a good application in MS Access and been using it for the last 3 years to manage the administration of facilities.

    What I would real like to do is bring this application online. I want to learn how to re-build the whole application so it can be used online. It took me three years to build it so I know it will take as much if not more to replicate online but it doesn't scare me at all. I didn't know anything about database when I first started and managed to build something pretty decent. The problem with a GUI environment is you don't learn anything. the application does the work for you. it writes the codes in the background. "I" want to do the work now. "I" want to build the application and crunch the code myself. That is the goal.

    That said I have to start somewhere. I have created a few fake tables in mysql to test with and to learn how to connect, extract and update record as a first step. This would be what I would like to accomplish as a first step.

    once I am good with playing with the data and manipulate it I will then be able to start learning about new functionality I can do with the data.

    what can I do at this time:

    I can connect to my database and I can enter data into it through php. That's it!

    what I would like to learn now is how to pull it out and display it in form so I can edit the data. That is all I want to do for now. once I have learned how to do that then I can start learning how to join table and create relationships with play with the data on my webpage. All this stuff I can do my eyes closed in Access. I understand how 1st normal 2nd normal... and how to make very complicated queries in a GUI environment but writing the sql lines myself is something I have never done before.
  24. #13
  25. Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jan 2004
    Location
    New Springfield, OH
    Posts
    1,247
    Rep Power
    1469
    Originally Posted by jaad
    Actually yes.... I have created quite a good application in MS Access and been using it for the last 3 years to manage the administration of facilities.

    What I would real like to do is bring this application online. I want to learn how to re-build the whole application so it can be used online. It took me three years to build it so I know it will take as much if not more to replicate online but it doesn't scare me at all. I didn't know anything about database when I first started and managed to build something pretty decent. The problem with a GUI environment is you don't learn anything. the application does the work for you. it writes the codes in the background. "I" want to do the work now. "I" want to build the application and crunch the code myself. That is the goal.

    That said I have to start somewhere. I have created a few fake tables in mysql to test with and to learn how to connect, extract and update record as a first step. This would be what I would like to accomplish as a first step.

    once I am good with playing with the data and manipulate it I will then be able to start learning about new functionality I can do with the data.

    what can I do at this time:

    I can connect to my database and I can enter data into it through php. That's it!

    what I would like to learn now is how to pull it out and display it in form so I can edit the data. That is all I want to do for now. once I have learned how to do that then I can start learning how to join table and create relationships with play with the data on my webpage. All this stuff I can do my eyes closed in Access. I understand how 1st normal 2nd normal... and how to make very complicated queries in a GUI environment but writing the sql lines myself is something I have never done before.
    Is this something you can share for us to look at? I'm pretty good on both sides (Access and PHP), I may be able to point you in the right direction.

    It sounds to me though, like getting to know the PHP/MySQL relationship is a good place to start. I would suggest starting with PDO. It's easy to pick up and use, and it will force you to use fairly secure practices from the start.

    Try googling PDO and CRUD. Those keywords should start getting you in the right direction. Just remember that it's ok to take baby steps. We'll keep you pointed in the right direction.
    Don't like me? Click it.

    Scripting problems? Windows questions? Ask the Windows Guru!

    Stay up to date with all of my latest content. Follow me on Twitter!

    Help us help you! Post your exact error message with these easy tips!
  26. #14
  27. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    33
    Rep Power
    2
    Originally Posted by Nilpo
    We'll keep you pointed in the right direction.
    Thank you, this sounds like a great idea. I have been pedaling and pedaling for a month and my wheel keeps spin lol.

    *** My next endeavor will be to kidnap an engineer from Adobe and force him to show me how Dreamweaver CC is optimized from CS6 lol
  28. #15
  29. 'fie' on me, allege-dly
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2003
    Location
    in da kitchen ...
    Posts
    12,894
    Rep Power
    6444
    Notepad ++ roxxorz

    Personally don't do any coding in Dreamweaver, can only assume it's come on leaps and bounds since I started looking at it

    To my knowledge CC is mostly a rebranding exercise to take advantage of cloud computing, and everyone who bought the application, because now we're looking at a different licensing model

    Have a look at Eclipse if you want an IDE
    YMMV
    --Ax
    without exception, there is no rule ...
    Handmade Irish Jewellery
    Targeted Advertising Cookie Optout (TACO) extension for Firefox
    The great thing about Object Oriented code is that it can make small, simple problems look like large, complex ones


    09 F9 11 02
    9D 74 E3 5B
    D8 41 56 C5
    63 56 88 C0
    Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.
    -- Jamie Zawinski
    Detavil - the devil is in the detail, allegedly, and I use the term advisedly, allegedly ... oh, no, wait I did ...
    BIT COINS ANYONE
Page 1 of 3 123 Last
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo