Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by Err

  1. Err

    [PHP, SQL Question]

    <?php $local = @mysql_connect('localhost', 'root', 'PASSWORD'); if ($local) { mysql_select_db("DATABASE",$local); } else { $server = @mysql_connect('HOSTSERVER', 'USER', 'PASS'); if ($server) { mysql_select_db("DATABASE",$server); } else { echo "No connections were able to be established."; } }?> Try that code. It's not tested but it should do what you want. It's important to note that the @ in front of mysql_connect is to suppress errors. So just in case it doesn't connect the it won't give you any errors. Also if you want a certain connection to try to access a database you have to tell it which connection. mysql_select_db() has two arguments, the database name and the connection to use.e.g. mysql_select_db(DATABASE_NAME, MYSQL_CONNECT() )
  2. function dbErr($num,$n) { switch ($num) { case 1044: case 1045: $err = err("Access to \"{$n}\" denied using current DB User and/or DB Pass."); break; case 1049: $err = err("The database \"{$n}\" does not exist."); break; case 2002: $err = err("There is no such DB Host. Check spelling."); break; default: $err = err("There is a problem connecting to the database. ".mysql_errno().": ".mysql_error()); } return $err; } function dbConnect($h,$u,$p,$n) { if (!$con = @mysql_connect($h,$u,$p)) {$err = dbErr(mysql_errno(),$n);} else if (!@mysql_select_db($n,$con)) {$err = dbErr(mysql_errno(),$n);} return (isset($err)) ? $err : ""; } I got told my code was wrong so I come here hoping people can prove there is a fault in my code. I suspect that people are simply not understanding some PHP syntax. If you can find anything wrong with this, let me know. Edit: I should note that the code works fine, but since I was told by several people it was wrong, I'm out to be proved wrong.
  3. Err

    Can't Find Older Posts

    M'k. Thanks for the update.
  4. You won't get all the security concerns in one go, I would do some research on it and try to make it as secure as you can make it.
  5. I was using Google Chrome actually. I still see the text-over-the-date problem.
  6. I can tell you a few things, from a developers point of view at least: - When you hover over the main links, they change from bold to normal and it causes this drop in size-- that is very noticeable. I would recommend keeping bold or normal.- Because you're using a dark background and red links, it makes the links very hard to see once you hover over them. Maybe a lighter shade of red for the navigation links.- When you click on Home, the "Contact Us" link is blue. When you click on "About Us" the link is red.- The scrolling box on the home page-- text of the news is almost completely on top of the dates. I suggest fixing that.- Project Page: It's fine but when I first went there I moved my mouse over one of the links under the navigation and the images that were first there were gone. Maybe instead of having people hover over the links to change the images, have them click it so they don't accidently change the images. That's all I got.
  7. Yes. It's entirely up to you, I would love any testers and feedback either way!
  8. No, you haven't. It tells how you write a script.
  9. I'm not sure if this is related to not being able to Search but I can't lookup my posting history. I read I some threads that said the searching problem was being looked into. Any updates?
  10. Again, I don't have any problems. It looks good. I think this is a JavaScript / JQuery problem related to high resolutions and it's clearly out of my field of expertise.
  11. When I posted that it was 2am, sometimes things slip my mind.
  12. Err

    Table of database?

    I don't get it, why do the same people continue to help this user if everything they say is being ignored? I would of stopped helping a while ago.
  13. Dump POST content and see if your data is even being sent.var_dump($_POST);
  14. I'm not sure. I'm bad at design stuff, taking suggestions from me about websites as a whole is generally a bad idea, ask me anything about coding though and I don't do so bad.
  15. If you need more help on the subject you can refer to this thread:http://w3schools.invisionzone.com/index.php?showtopic=12509It's very helpful with basic php stuff.
  16. I just showed you how in my first post.
  17. It looks fine in Chrome and IE9. I recommend that you clear your browser cache it maybe the cause of that.
  18. Err

    registration page

    Here is one that one of the mods here made:http://w3schools.invisionzone.com/index.php?showtopic=12509&view=findpost&p=96608
  19. I would recommend a already built system and just modify it to your needs. But if you're not in a hurry, want a custom one built for your needs and not other things, and don't mind reinventing the wheel, then go for the custom one.I have built my own CMS as well, but I did it mostly because i saw it as an opportunity for the experience of building one and was doing it for one of my hobby sites so there was no time constraints.
  20. You want to use the URL variables to use in your queries, right? $var1 = $_GET['showtopic'];$var2 = $_GET['view'];$var3 = $_GET['p'];$sql = "SELECT * FROM db WHERE $var1 = '12509' AND $var2 = 'findpost' AND $var4 = '67512'";
  21. This is a very simple example: <form action="" method="post"> <input type="text" name="txtNam" value="" /></form> The PHP for this would be (on the same page where the form exists): <?php $nam = $_POST['txtNam']; echo $nam;?> Note that the "name" attribute inside the <input> tag is being used by PHP. PHP sees the name attribute and uses to reference the form and it's value. Then I grab the POST value and assign it to my own variable $nam, you can use $_POST['txtNam'] itself instead of using $nam but it's easier to type $nam than it is to type $_POST['txtNam'], no? After I do that, I echo $nam. The echo makes it display on the page. So now you should be able to see the value you put on the form box, on the page. I should note that this will normally only last for one page.If you want a small comment area or guest book, then you will have to save the data submitted somewhere and keep it stored so you don't lose what was submitted. If it's sensitive data people usually use a database like MySQL otherwise you can use a simple text file and save the submitted values there.A bit of advice: As long as people can freely submit data to your website that is later displayed on your website, I would strip out any HTML or at least render their HTML useless by using the htmlentities() function. Also, you may want to record their ips in case they decide to spam messages.
  22. [refer to the first post]
  23. I know very little about this but I can at least point you in the right direction, I hope it's helpful:http://www.google.com/search?q=flat+links+htaccess
  24. Err

    CSS format i html tag

    I read something a long time ago to use html and body together if you're gonna change spacings like margins and padding. It's probably outdated but when I'm changing the entire page, I will, even today use html, body {...}
  25. Lets do something just a little different to help you understand what's going on. I'm going to use a <div>, you can change it to a proper <table> if you want but I'm using <div> for simplicity's sake. <div id="box"></div> And you can center your <div> by using margins such as I'm doing below. I added width, height and borders so you can see the <div> as a rectangle otherwise you wouldn't be able to see it. Also if you want to be able to center an object it has to have a width smaller than whatever it's in but it does have to have a width or else you'll get crazy results. #box { width: 300px; height: 200px; border: 1px solid black; margin: 0 auto;} I used pixels (px) here but you can use percentages (%) so if anyone makes the window smaller, it gets smaller too.
  • Create New...