Jump to content

bigdaddykraven

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

bigdaddykraven's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Wait! Doh! I realized that meant auto_increment wasn't on. I had it checked when creating the table but I bet I scroll balled it off again before submitting :) Edit: That seemed to have done it. I'm stupid and as I said, it was an easy one, just needed help isolating the problem. Thanks a bunch for your help.
  2. yeah, I'm sorry. The timestamp thing in the mysql field, for my postdate field in the table. So when I post my articles, it'll date/time it for me. After removing the backtags and single quotes, I got this: Unable to perform query INSERT INTO articles (title, content) VALUES ('Testing',' Article Info ') Duplicate entry '1' for key 1 --- I think the backtags to single quotes my my bad because I accidentally deleted one of em and on the fly, just replaced them with single quotes.
  3. Error: Unable to perform query INSERT INTO 'articles' (title, content) VALUES ('HEllo','testing') You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''articles' (title, content) VALUES ('HEllo','testing')' at line 1 Like I said, strange since I have another script just like this one and it posts fine...could the TIMESTAMPER data be a problem?
  4. Good call, I didn't think about having an error bounce back :) Error: Warning: Wrong parameter count for mysql_query() in /home3/bdkraven/public_html/kraven/newsposter.php on line 72 Unable to perform query INSERT INTO `articles` (title, content) VALUES ('Testing','Boom') Line 72 is the second part of the code you asked me to put in, the "or die" string.
  5. The code: [code=php:0]   <?php if (!isset($_POST['submit'])) { ?> </p>           <p class="style3">Post the newest news Article Here for it to appear on the front page.</p>           <form action="" method="post">   <p>Article Title:     <input name="title" type="text" id="title">     </p>   <label>Full Article: <br>   <textarea name="content" cols="80" rows="10" id="content"></textarea> </label>       <br>       <br>         <input type="submit" name="submit" value="Submit!">     </p>   </form> <?php } else { $title = $_POST['title']; $content = $_POST['content']; mysql_query("INSERT INTO `articles` (title, content) VALUES ('$title','$content')"); echo "This news article has been added to the page!"; } ?> [/code] I have two forums, one posts my roleplays into their archive while this one is SUPPOSED to post into my articles board. The roleplays board works fine, it posts to my database and then I can look at my archives board and see them all. It's this article poster I have trouble with. I know everything should work fine in my connections (which I am not showing but trust me, it works). The only difference between this and the rp poster code is that it is posting into a different table within the same database "articles" and other than the Title and Content (and the usual ID), I have a postdate with a timestamper invloved. I'm wondering if maybe that has something to do with it? I've never used timestamper before, so I don't know if that's different. I know the table does work as I manually inputted one article on the mySQL/PHP admin page and it displays on the front page just fine. SO I know it's something simple, but what am I missing? This code goes through and says it is posted, but in reality, doesn't send it to my articles table...
  6. Ok, I got it working. It was set to be == logged when it should have been != logged. Thanks for all of your help, I much appreciate it :)
  7. It still keeps throwing me back to the login page. I'm going to have a play with it for a bit and see if I can find what part is exactly the problem... IF I get anywhere or fail miserably, I'll let you know. Thanks for your help.
  8. $_SESSION['login']; I tried setting it just before the if($login==""); if you look it is already set in the login function script, at the bottom. Also, in the bottom of the login function, it sets $login=$r["username"]; Strange because it worked fine as is (although with session_register("login"); instead of $_SESSION). When I made the change I mentioned above, it continued to do the same thing.
  9. Hey Everyone, I have a bit of a problem. I had this script I put together from a mixture of other scripts and modified it to where it would work on my roleplaying character site. When I had to move to a new host, I went from a post 4.1 PHP server to a PHP 5 server. Prior to the switch, the session_register command was being used and as you know, it no longer supports that with globals turned off. So tried to change it to $_SESSION ['login']; yet it still gives me the same result. What happens when you log in correctly, it simply loads the login page once more. I have the pages set to where you go to them, it checks for the logged in session and then if not, will HEADER revert to the login page. The problem is, I don't think it's keeping the session when I login. It's sending me to the posting page, but saying I'm not logged in and pushing me back to the login page. Funny thing is, if you put in an incorrect password, it registers as being incorrect and will direct you to the OOPS, page, proving that it is in the reading of the session. I'll include the scripts: [b]Protected Page[/b] [code=php:0]<?php session_start(); if($login=="") { Header("Location: login.php"); } else { ?> Page Contents go below this. <?php } ?> [/code] [b]Login Function[/b] [code=php:0]<?php session_start(); $db_host="localhost"; // Your mySQL host, normally localhost $db_user="mydbhere"; // Your database username $db_pass="mypasswordhere"; // Your database password $db="mydbhere"; // the database you are trying to connect to $connection=mysql_connect ("$db_host", "$db_user", "$db_pass") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("$db"); $username=$_POST["username"]; $pw=$_POST["password"]; $q="SELECT * from users where username='$username' and password='$pw'"; $result= mysql_query($q, $connection) or die ("Could not execute query : $q." . mysql_error()); if (mysql_num_rows($result) == 0) { echo "<div align=center><b>Oops! Your login is wrong. Please click back and try again.</b></div>"; } else { $r=mysql_fetch_array($result); $login=$r["username"]; $_SESSION["login"]; //session_register("login"); //This is the old script that I replaced because register_globals are off Header("Location: roleplaypost.php"); // Place the location of the file you want to go to. } ?> [/code] I don't want to enable the globals (I don't have that option, .htaccess crashes my website when I put in the coding to allow for this. If anyone wants to check it out, I can set up a false user password/login. Any and all help would be great, thank you.
×
×
  • 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.