Jump to content

denno020

Members
  • Posts

    761
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by denno020

  1. Well if you want to use mysql_connect, which again, I suggest you dont, but if you do, then that will create a connection to the database. You will then use that in another function, mysql_query(), which will take a string as the first paramater, which is the query, and the second parameter is your $con variable (which represents the connection to the database). But seriously, you should learn to use PDO. It's really not hard, and will mean your code won't become useless when these functions are eventually removed from php..
  2. I find it a bit weird that you're using PDO in your 'old' database connection and mysql_connect() in your new one, because mysql_connect has been deprecated.. I suggest you move back to using PDO. And you will need to make sure you actually have a correct PDO object in the $con variable, so var_dump() it directly after initializing it, and see what it is
  3. Edit: Appears boompa beat me to the submit button . Well for some proper help you'll need to share your error as well, otherwise we've got nothing to go on.. But I will have a guess that you're getting an error saying that $_GET['action'] isn't set? You need to do it like this: if(isset($_GET['action']) && $_GET['action'] == 'add'){ .... } As for the other part, I'm not sure from looking at it what the error might be, let us know and I'm sure we'll be able to help more. Denno
  4. It's not difficult at all. All you need to do is have a field in your products table which is the ID of the retailer in the users table (which I think from your comments is called user_ids). That way the two tables are linked through the retailers ID, and you can get all of the retailers information and all of their products in one hit.
  5. I do believe that $_SESSION actually saves to the users browser session, so they will only ever have their own user data. I could be wrong, but that's what I've always assumed.. Edit: Just saw your reply. It's not stupid to ask a question if you're unsure. How else will you ever be certain about the answer?
  6. trq is right.. You'll need to bring all of your code here, and highlight which line 74 is.. In the process of doing that though, you'll see where the error is and probably be able to figure out the solution yourself. Denno
  7. You're doing the isset() test too late. You should assign the variables like this: if(isset($_POST['submit'])){ $form = $_POST['submit']; } //And the same with email and password. (or on one line) $form = isset($_POST['submit']) ? $_POST['submit'] : NULL; That will clear up your undefined index errors. And the reason you're getting the errors is most likely because the form that is submitting to this script either isn't passing the variables through with the same name, or the fields haven't been filled out in the form. Hopefully that'll help you out. Denno
  8. glob will return the filenames/paths to all files that match the expression in the directory that you give it as an array. So you will need a foreach loop to loop through each of the files and do with them what you would like: $files = glob(path/to/images/*); foreach($files as $file){ echo $file; //this will echo the complete filename/path } Start playing around with that and post back if you need more help. Luke
  9. I think it would be more on the database side that you would need to set this up.. Make sure that they field is allowed to have NULL values, and then make NULL the default, so if no value is entered, it will be NULL.. So you do all that in your database manager (which I assume might be phpmyadmin?). Denno
  10. In answer to your question about what the SQL query does, it will query the database (ask the database) for any records that have the username that matches what the user put into the form, and a password that also matches. Ideally this would only be one record, as all usernames in the database should be unique. The second line then counts the number of rows (database records) that were returned, if this number is 0, then there is no user with that username, or the password was wrong. If there is 1 record returned, then the user provided login details are correct. Denno
  11. I would suggest you set it out like this: <?php $loginError = false; if(isset($_POST['username'])){ //Check if a form has been submitted //Do all your login processing here. //... //... //... //... if($login_check > 0){ //Do all of the processing that you have header('Location: index.php'); exit(); }else{ $loginError = true; //Flag to turn on error messaging below } } ?> <!DOCTYPE html> <html> <head> </head> <body> <?php if($loginError){ echo "There is an error processing your login details. Please try again"; } ?> <form> <!-- form contents --> </form> </body> That will allow you to print out error messages wherever you want them, but placing the if($loginError) section of code wherever you want it to appear, so you could move it inside the form tags, and just before the inputs. Hopefully that will get the ball rolling for you. Denno
  12. If I were to do something like this, I wouldn't be using htaccess at all. Just use PHP to re-direct the user to their directory: //Get the users username by whatever means. This is a simple example of just grabbing it straight from the form POST. $username = $_POST['username']; header('Location: http://blah.com/client/'.$username); That should work fine.
  13. What you're saying is correct, you're getting a redirect because 'section' isn't set, which is therefore satisfying the first condition of the second if statement. The only way to be able to echo out content related to username even if section isn't set or what it should be is to remove the checking of section..
  14. You need to include secured.php into your login.php script, otherwise you never grab the username/password from the form. Also, your form uses POST as the method, but you're trying to get the variables using GET. Fix those two problems up and you should start getting some meaningful errors (if there are any), that you can start to debug. Denno
  15. denno020

    tooltip

    No worries at all, we all started somewhere! And also, I've just noticed your signature, very clever! However I'm going to nit-pick on the use of "your".. echo "I will try to help, because your you're still $skill_level , and my skill level is at $my_knowledge"; Sorry to be a jerk! Denno
  16. denno020

    tooltip

    I would say that's because it's a HTML comment and not a CSS comment .. Even though your CSS is internal, when your brower sees the <style> tag, it turns into CSS mode, reading everything up until the </style> tag as CSS.
  17. denno020

    tooltip

    In css, comments start with '/*' and end with '*/'. Try removing your comment with <!-- --> and see what happens . Denno
  18. denno020

    tooltip

    To be honest.. I don't really understand what you're asking?
  19. denno020

    tooltip

    So you want the tooltip to be positioned by the location of the mouse? That will be a bit more involved.. I'm not sure you can do it with just CSS, you'll have to use javascript to constantly update the position of the tooltip div every time the mouse moves, and it's hovered over the button..
  20. denno020

    tooltip

    Well I can imediately see a problem. You're targeting ".tooltip span". That refers to a span inside .tooltip, which is never going to happen, as it's applied to an img. You will need to put a div around both the elements, and apply .tooltip to that div: http://jsfiddle.net/S5J8h/1/ Works straight away. Denno
  21. denno020

    tooltip

    Post your code so we can see what you're attempting this with.
  22. denno020

    tooltip

    After I replied I actually noticed that if you scroll down on that page, they show you some html with exactly how they make it, so you should be able to follow that. The main css property's you're going to use are 'display' or 'visibility'. Do some googling to find out how they work. Essentially you will create a css class, called hidden (or whatever you want), and apply that to the div by default. Then, when the user hovers over the button, use JavaScript to remove that class. As soon as they mouse off the button, your JavaScript should detect that, and apply your css class back to the div. Alternatively, you could do it using just JavaScript. Give your div an id of tooltip. In your JavaScript, hide that div on page load, and then show it again only on muse over. Jquery has some very simple functions already set up if you want to use those, otherwise it's not too hard to do with raw JavaScript. I'm replying on my phone at the moment so apologies for no code examples. If you still can't figure it out, let me know and I'll give you some specific code that will help. Denno
  23. This is something I started to put together until I realized that someone else would have surely done it: http://jsfiddle.net/T6PcS/ So the jQuery credit goes to http://stackoverflow.com/questions/5422001/jquery-infinite-loop-for-function user Felix King. Tweak that until you have what you want. Denno
  24. denno020

    tooltip

    Whilst that's called a tooltip, it's probably built using divs and some js to hide/show the div on mouse hover on the button.. Would be fairly simple. Just create a div and style it up how you want it to look (including any images you might want in there). Position it on the page where you want it, and then set it to hidden or display none. Then use some javascript to show that div when someone hovers over the button/link/whatever you want the tooltip to be attached to. Hopefully that'll get you started. Denno
×
×
  • 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.