Jump to content
Old threads will finally start getting archived ×

ip2g

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ip2g's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Yeah the feedback image doesn't work on desktop for some reason. I'm working on the desktop version right now, actually.
  2. If any of you have iPhones, check my new blog out: http://ip2g.free-site-host.com Please review fairly, this is my first PHP enabled website. I did not make the layout, but I did code everything else. So review that . Oh and I need ideas on stuff to add, so if you have any ideas, tell me.
  3. Oh okay, I never knew that. Thanks for all the help guys! And thanks for putting up with my noobish ways, I pretty much just started PHP. I'm more of a C++ guy
  4. So change it to <form id='submit' action='post.php?postID=$postID' method='GET'>?
  5. Thanks! I never really thought about using javascript in this situation. EDIT: Oh wait.. it only worked like once.. how is that possible?
  6. I would like to do this without using submit buttons though... Is that possible?
  7. Hmm, well I did the ini_set('error reporting') thing and I found the error to be that I didn't initialize $postID. But even then, it still does not print out anything on the other page, and the other page literally says: <? $a = $_GET['postID']; echo $a; ?> What's up now? index.php: <? $dbhost = 'localhost'; $dbuser = 'ip2g_*****'; $dbpass = '*****'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'ip2g_*****'; mysql_select_db($dbname) or die('Could not connect to Database'); $num = mysql_query("SELECT * FROM Posts"); $num_rows = mysql_num_rows($num); for ($i=$num_rows;$i>=($num_rows - 2);$i--) { $query = "SELECT * from Posts WHERE postID = '$i'"; $result = mysql_query($query,$conn) or die(mysql_error()); $row = mysql_fetch_assoc($result); $postTitle = $row['postTitle']; $postDate = $row['postDate']; $postID = $row['postID']; echo " <li class='menu'> <form action='post.php' method='GET'> <a href='post.php'> <input type='hidden' name='postID' value='$postID' /> <span class='name'>" . $postTitle . "</span> <span class='comment'>" . $postDate . "</span> <span class='arrow'></span> </a> </form> </li>"; ini_set('error_reporting', E_ALL); } ?>
  8. Wow I can't believe I forgot that. But still, it won't print out anything. Is it the placement of the form tag in index.php?
  9. Okay I'm pretty noobish to PHP, and I have no idea why this isn't working. I thought it would work, but it doesn't. Okay so let me explain before I post the code. On index.php, I show the most recent blog posts (it works fine, don't worry about that) as a link. Then a form sends it to the post.php page using GET (so they can save the page). The problem is well... on post.php, nothing happens. It somehow doesn't receive the information. I have a feeling it's a really noobish problem, but all the same, be nice. Okay so here are the codes: index.php <? $dbhost = 'localhost'; $dbuser = 'ip2g_*****'; $dbpass = '*****'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'ip2g_*****'; mysql_select_db($dbname) or die('Could not connect to Database'); $i = 1; for ($i=1;$i<=3;$i++) { $query = "SELECT * from Posts WHERE postID = '$i'"; $result = mysql_query($query,$conn) or die(mysql_error()); $row = mysql_fetch_assoc($result); $postTitle = $row['postTitle']; $postDate = $row['postDate']; echo " <li class='menu'> <a> <form action='post.php' method='GET'> <input type='hidden' name='postID' value='$postID' /> <span class='name'>" . $postTitle . "</span> <span class='comment'>" . $postDate . "</span> <span class='arrow'></span> </form> </a> </li>"; } ?> post.php <? $dbhost = 'localhost'; $dbuser = 'ip2g_*****'; $dbpass = '*****'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'ip2g_*****'; mysql_select_db($dbname) or die('Could not connect to Database'); $query = "SELECT * from Posts WHERE postID = \"{_GET['postID']}\""; $result = mysql_query($query,$conn) or die(mysql_error()); $row = mysql_fetch_assoc($result); $postPost = $row['postPost']; $postDate = $row['postDate']; $postTitle = $row['postTitle']; echo " <li class='menu'> <a> <span class='name'>" . $postTitle . "</span> <span class='comment'>" . $postDate . "</span> <span class='arrow'></span> </a> </li>"; ?> Right now, it's not supposed to print out the post, it's just supposed to print out the title and the date. But, once again, it won't print out anything. It obviously has something to do with the form and the query: ($query = "SELECT * from Posts WHERE postID = \"{_GET['postID']}\"" Once again, I be a nub, so help me
×
×
  • 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.