Jump to content

datanut

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Male

datanut's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. It's an IE thing! I was finally able to get Firefox installed on this computer. Changes were immediate. Here's the fun part: if I made a change to the file but did not refresh in Firefox, the change didn't show in IE8. Once I refreshed in Firefox, a refresh in IE showed the change. Another thing I didn't notice earlier is that IE8 wouldn't actually let me view the css. The download box appeared and would open the file in notepad++. If I changed the local .css settings to open with IE, nothing would happen after I selected open. Firefox shows the file in the browser without hesitation. Thanks Jesi!
  2. Sure enough, it's showing me the older file. After viewing the file directly, deleting history, closing the browser, and even flsuing the DNS cache, the changes still don't take effect. Yesterday, changes appeared after about 2 hours. On my computer at home, changes were immediate. Best guess, this has something to do with the network I am on. Another possibility is somewhere between this computer and godaddy things are getting hung up. Last year when I had my laptop connected to this network and working with files from a different web host, I had zero problems (except I couldn't connect with filezilla, but that was a different story altogether).
  3. You betcha. For giggles, I commented the css part out of the header. As expected, the page loaded without any styling. After removing the commenting, the page loaded with the styles as if I had never edited the .css file. Equally befuddling is that I can delete the files from the folder and upload fresh files with radically different settings in the css file. And the page loads again with...wait for it...the old css settings.
  4. When I make edits to my .css file, those changes don’t reflect in the browser upon refresh. However, if I copy that modified .css fileto another folder, those changes appear. Then if copy the .css back to the original folder, the changes still don’t appear. Here’s the scenario: .css edits in domain.com/dev will not appear. When moving the css to domain.com, those changes are seen. After replacing the css to domain.com/dev, it’s as if the edits and move never happened. I have cleared my cache; deleted history, cookies, etc; and I have restarted my computer. I have even created a new folder and copied all the files from /dev to /dev2. After editing the css in dev2, the same headache starts anew. My first suspicion is that it has something to do with godaddy (my fault for downgrading web hosts). It also may be the settings on my computer. But I find it hard to believe I can do all sorts of things in phpMySql and edit html and .ini files, but still have issues with a lil old .css. Any thoughts or advice?
  5. Right now, I'm hosted at godaddy with the economy linux setup (rather liquidweb but on the cheap right now), i.e. sharing server space with who knows what. With that said, looking at one of the warnings in phpMyAdmin about enabling statistics, the web server and MySQL server are separate.
  6. I've been trying to find a good, up-to-date source on how to secure the authentication credentials for my db connection. I've done some PHP coding and would like to learn more. There's plenty information available, but I often find books inevitably have typos in the code. Also most of the online tutorials are either at least several years old or deal more with user login security. User authentication is one thing, but what are the best ways to secure the connection to the database itself? Obviously your basic newbie method of unencrypted host, username, password, and database stored in a connectvar file is just open invitation--or maybe not since it doesn't present a challenge to a hacker. Some say to encrypt the credentials with something like MD5 and store them in .htaccess. Other sources say not to use MD5. Any advice on where to find some good resources on this? Cheers!
  7. I'm just getting started with PHP and MySQL, and I've noticed a difference in naming the query variable. Is there a difference in using $sql vs $query? For example this code $sql = "SELECT COUNT(*) FROM tblname"; $result = mysqli_query($dbc, $sql); brings the same as: $query = "SELECT COUNT(*) FROM tblname"; $data = mysqli_query($dbc, $query); Is it a matter of semantics? The book I've been reading uses "$query," but the tutorials on phpfreaks use "$sql."
  8. Thanks a lot everyone! On a side note, the form wasn't disappearing but getting pushed way over to the right, off-screen. But, that's easy enough tame. Thanks again!
  9. Thanks, Drummin. That was a nuance I missed. That got rid of the two errors. Unfortunately one of the errors popped up elsewhere, "Undefined index: fc_id in C:\wamp\www\917\editday.php on line 58," which is $fc_id = $row['fc_id']; else { // Grab the profile data from the database $query = "SELECT fc_date, fc_speakers, fc_text, fc_topics, fc_refdel FROM tblfedconvn WHERE fc_id = '" . $_GET['fc_id'] . "'"; $data = mysqli_query($dbc, $query); $row = mysqli_fetch_array($data); if ($row != NULL) { $fc_id = $row['fc_id']; $fc_date = $row['fc_date']; $fc_speakers = $row['fc_speakers']; $fc_text = $row['fc_text']; $fc_topics = $row['fc_topics']; $fc_refdel = $row['fc_refdel']; } } mysqli_close($dbc); ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <fieldset> <legend>Debate data</legend> <input type="hidden" name="fc_id" value="<?php echo $fc_id; ?>" /> <label for="fc_date">Date:</label> <input type="text" id="fc_date" name="fc_date" value="<?php if (!empty($fc_date)) echo $fc_date; ?>" /><br /> <label for="fc_speakers">Speakers:</label> <input type="text" id="fc_speakers" name="fc_speakers" value="<?php if (!empty($fc_speakers)) echo $fc_speakers; ?>" /><br /> <label for="fc_text">Debate text:</label> <input type="text" id="fc_text" name="fc_text" value="<?php if (!empty($fc_text)) echo $fc_text; ?>" /><br /> <label for="fc_topics">Topics:</label> <input type="text" id="fc_topics" name="fc_topics" value="<?php if (!empty($fc_topics)) echo $fc_topics; ?>" /><br /> <label for="fc_refdel">Delegates referenced:</label> <input type="text" id="fc_refdel" name="fc_refdel" value="<?php if (!empty($fc_refdel)) echo $fc_refdel; ?>" /><br /> </fieldset> <input type="submit" value="Save Entry" name="submit" /> </form> I tried adding fc_id to the queries. Then I replaced the fc_id hidden input with a text input. but, this caused the form to disappear.
  10. Perhaps I'm getting the order of all that mixed up. Here is the code that I have so far. I use this to generate the link to the update form. echo '<td><a href="editday.php?id=' . $row['fc_id'] . '">Edit</a>'; And here is the update form. if (isset($_GET['fc_id'])) { // Grab the data from the GET $fc_id = $_GET['fc_id']; } // Connect to the database $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); if (isset($_POST['submit'])) { // Grab the data from the POST $fc_id = mysqli_real_escape_string($dbc, trim($_POST['fc_id'])); $fc_date = mysqli_real_escape_string($dbc, trim($_POST['fc_date'])); $fc_speakers = mysqli_real_escape_string($dbc, trim($_POST['fc_speakers'])); $fc_text = mysqli_real_escape_string($dbc, trim($_POST['fc_text'])); $fc_topics = mysqli_real_escape_string($dbc, trim($_POST['fc_topics'])); $fc_refdel = mysqli_real_escape_string($dbc, trim($_POST['fc_refdel'])); // Update the data in the database // Only set the picture column if there is a new picture $query = "UPDATE tblfedconvn SET fc_date = '$fc_date', fc_speakers = '$fc_speakers', fc_text = '$fc_text', " . " fc_topics = '$fc_topics', fc_refdel = '$fc_refdel' WHERE fc_id = '" . $_GET['fc_id'] . "'"; mysqli_query($dbc, $query); // Confirm success with the user echo '<p>The debate information has been successfully updated.</p>'; mysqli_close($dbc); exit(); } // End of check for form submission else { // Grab the profile data from the database $query = "SELECT fc_date, fc_speakers, fc_text, fc_topics, fc_refdel, FROM tblfedconvn WHERE fc_id = '" . $_GET['fc_id'] . "'"; $data = mysqli_query($dbc, $query); $row = mysqli_fetch_array($data); if ($row != NULL) { $fc_id = $row['fc_id']; $fc_date = $row['fc_date']; $fc_speakers = $row['fc_speakers']; $fc_text = $row['fc_text']; $fc_topics = $row['fc_topics']; $fc_refdel = $row['fc_refdel']; } } mysqli_close($dbc); ?> <form enctype="multipart/form-data" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <fieldset> <legend>Debate data</legend> <input type="hidden" name="fc_id" value="<?php echo $fc_id; ?>" /> <label for="fc_date">First name:</label> <input type="text" id="fc_date" name="fc_date" value="<?php if (!empty($fc_date)) echo $fc_date; ?>" /><br /> <label for="fc_speakers">Last name:</label> <input type="text" id="fc_speakers" name="fc_speakers" value="<?php if (!empty($fc_speakers)) echo $fc_speakers; ?>" /><br /> <label for="fc_text">fc_text:</label> <input type="text" id="fc_text" name="fc_text" value="<?php if (!empty($fc_text)) echo $fc_text; ?>" /><br /> <label for="fc_topics">fc_topics:</label> <input type="text" id="fc_topics" name="fc_topics" value="<?php if (!empty($fc_topics)) echo $fc_topics; ?>" /><br /> <label for="fc_refdel">fc_refdel:</label> <input type="text" id="fc_refdel" name="fc_refdel" value="<?php if (!empty($fc_refdel)) echo $fc_refdel; ?>" /><br /> </fieldset> <input type="submit" value="Save Entry" name="submit" /> </form> I am getting two error codes: "Undefined index: fc_id in C:\wamp\www\917\editday.php on line 54" which is $query = "SELECT fc_date, fc_speakers, fc_text, fc_topics, fc_refdel, FROM tblfedconvn WHERE fc_id = '" . $_GET['fc_id'] . "'"; . "mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\wamp\www\917\editday.php on line 56" which is $row = mysqli_fetch_array($data);
  11. Recent newbie here hoping to fill some gaps. I have a small database, and I have built a form for inserting records. What I need is to also build an form to update records. I thought I understood what seems to be a simple concept, but I seem to be missing a vital piece of the puzzle. After much searching, all I seem to find are a) the bare SQL example statements, out of context of the PHP code, or b) php code to update user related data, which gets the id from the session id. Is there a good resource that can explain how to pull the data from a record into an update form? Thanks!
×
×
  • 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.