<?php session_start(); $_SESSION['username']; $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = '1234'; $dbname = 'sessions'; mysql_connect($dbhost, $dbuser, $dbpass) or die("Could not connect: ".mysql_error()); mysql_select_db($dbname) or die(mysql_error()); $update = $_POST['update']; $query = ("UPDATE register set files = '$update' WHERE username = '$_SESSION['username']'"); mysql_query($query) or die(mysql_error()); echo "Username: " . $_SESSION['username']; echo "File updated"; echo "<br>"; include('home.php'); ?> i dont know what's the problem with this but when i remove $_session['username'] and the WHERE part it works please fix my sample program I've tried to explore but i need more support thnx in advance
good that you solved it yourself. Just curious to know what is $_SESSION['username']; along doing on 3rd line of your script? It has no effect to code anyways. Just to tell you little more.. have habit of using {} around variables inside double quoted string, specially if that variable is of array or object. The query would somewhat look like this after above changes.. $query = ("UPDATE register set files = '{$update}' WHERE username = '{$_SESSION['username']}'"); PHP:
thats my mistake i dont know that i can put $_Session['username'] to a variable but ive already fixed it. my code looks like this now $username = $_SESSION['username']; $query = "UPDATE register set files = '$update' WHERE username = '$username'"; you know how to use frame? can u please give me some example with that so that when i click a link the page doesn't refresh everything. thnx
frames are good to use but not in excess.. here are few links to give you good idea of it.. http://www.dyn-web.com/tutorials/iframes/load.php http://forums.htmlhelp.com/index.php?showtopic=7942
why is that so? im just going to use frame for the link: home,profile,contact us, services then that's all. thnks for the links. can u add me ym?
I would not recommend that way of keeping links for home, profile, contact us and other main links on website. More over, from the perspective of SEO also you should keep such links as direct links rather than inside iFrame.
its not literary inside the frame it looks like this one | HOME | PROFILE | PRODUCTS | CONTACT US | // THIS IS OUTSIDE THE FRAME ________________________________________________________ HOME BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA // INSIDE THE FRAME ________________________________________________________ what i want is that when i click the home at the upper part the contents inside the frame will be change. i don't know what to call it. forgive if im mistake.
Yes, this can be done and will be easier to do and user's will also feel good about it, but let few things be plain simple. However, if at all you want to implement the asked solution, please refer to the links I have given in my previous post.