Jump to content

kyles0623

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

kyles0623's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I was echoing for testing. lol.
  2. oh ok. So the echo's were stopping the header from working. Thankyou very much.
  3. I have this: function login_check(){ echo" WOOT!"; if(isset($_COOKIE['ID_my_site'])): echo "hello"; $username = $_COOKIE['ID_my_site']; echo" WOOT!"; $pass = $_COOKIE['KEY_my_site']; echo" WOOT!"; $sql = "SELECT * FROM users WHERE username = '$username' "; $res = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_assoc($res)){ echo" here!"; if($pass != $row['password']): header("Location:login.php"); else: header("Location:login.php"); endif; } else: header("Location:login.php"); echo "hello"; endif; } If you notice in the else statement at the end there is a header redirect. It doesnt work. It does work though if i make it the first thing in the function. Also, the function echo's out the hello in the else statement at the end. This function is called before the head tag. Any ideas?
  4. that worked. thankyou very much. Im new to classes. lol. Once again thankyou.
  5. I have an index page. The PHP for it is: <?php $obj->display_article(); ?> The first function code is: function display_article(){ echo "asdf...."; if(isset($_GET['id'])): echo "sadf...."; get_content($_GET['id']); else: echo "asdf...."; $obj->get_content(); endif; } and then the other function is: function get_content($id = ''){ echo "asdfjkl;"; if($id!=""): $id=mysql_real_escape_string($id); $sql = "SELECT * FROM cms_content WHERE id = '$id'"; else: $sql = "SELECT * FROM cms_content ORDER BY id DESC"; endif; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) != 0): while($row = mysql_fetch_assoc($res)){ echo '<h1><a href="index.php?id='. $row['id']. '">' . $row['title'] . "</a></h1>"; echo "<p>" . $row['body'] . "</p>"; } else: echo "<p>UH OH! THAT DON'T EXIST BUDDDD!</p>"; endif; } My result code when I look at the source code for the page is: <html> <head> <title>Testing Site</title> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body> <div id="page-wrap"> asdf....asdf.... It goes through the first function but not the second function because it doesn't echo the text i tell it to at the beginning of the function and then kills the rest of the code on the page. Can anyone help?
  6. I am trying to create a simple CMS and when someone deletes an article I want to loop through all of the articles and make it in order. For example, is I have article numbers: 1,2,3,4,5 and I delete 4, then I want to loop through all the articles so it goes and change the article number so it goes 1,2,3,4 and not 1,2,3,5. Help?
  7. OH because it is saved into my table and I dont know how to loop through all the articles on the table and change something for each.
  8. I am trying to create a simple CMS and when someone deletes an article I want to loop through all of the articles and make it in order. For example, is I have article numbers: 1,2,3,4,5 and I delete 4, then I want to loop through all the articles so it goes 1,2,3,4. Help?
  9. oh......well don't I feel stupid....Thankyou very much.
  10. I get this error: 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 'order' at line 1 I only get this error when I order by an int variable called order taken from the table. $sql = "SELECT * FROM cms_content ORDER BY order"; I can order it by other things but not that.
×
×
  • 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.