Jump to content

IndyTechNerd

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

About IndyTechNerd

  • Birthday 07/27/1972

Profile Information

  • Gender
    Male
  • Location
    Cubefarm

IndyTechNerd's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Try putting an exit(); after you set $errMsgPost to kick it out of the script. Or, try something like this.. if ($yourPost == "" || strlen($yourPost) < 1) { $errMsgPost = "Error: You did not type in a post."; //no post entered $errLvl = 1; }else{ $errLvl = 0; } // SNIP if($errLvl < 1){ mysql_query($insertpost) or die("Could not insert post"); //insert post $updatepost = "UPDATE `forumtutorial_posts` SET `numreplies`=`numreplies`+'1', `lastposter`='$name', `lastrepliedto`='$thedate' WHERE `postid`='$forumpostid'"; mysql_query($updatepost) or die("Could not update post"); $updatep = "UPDATE `users` SET `post_count`=`post_count`+'1', last_post=$thedate WHERE `Username`='$name'"; mysql_query($updatep) or die("Could not update post"); //header("Location: index.php?page=message&forum=$forum&id=$forumpostid&pagenum=last"); } // end errLvl check }
  2. try doing an echo of $root to see what directory is being pulled. You show 2 in your error message... Warning: main(/var/www/html/_common/cls-database-inc.php) [function.main]: failed to open stream: No such file or directory in /home/sites/rccdams.co.uk/public_html/_common/config.php on line 26
  3. change this... $root = $HTTP_SERVER_VARS['DOCUMENT_ROOT']; to this... $root = $_SERVER['DOCUMENT_ROOT']; $HTTP_SERVER_VARS didn't work, but $_SERVER did. I think the former is outdated. change this... require ($root . "/_common/cls-database-inc.php"); require ($root . "/_common/site-functions-inc.php"); to this... require ($root . "_common/cls-database-inc.php"); require ($root . "_common/site-functions-inc.php"); Give that a shot. What I did was use a test page I have and instead of require($root...), I just echoed it. What I got was "<!---C:/wamp/www//_common/cls-database-inc.php -->" see the //, looks like $root has the "/" at the end of the directory.
  4. It looks very similar to what I have in my login script... $query = "SELECT * FROM users WHERE username ='".$username."' AND active='1'"; //...password check comes later...// $query1 = "UPDATE users SET logincount=logincount+1,lastlogin= now() WHERE id='$uid'"; //...after user and password are verified, update # of logins and activity...// Once I check for the username, everything else uses the id field from the users table.
  5. Try moving your ORDER BY event_date to after the WHERE... $query ="SELECT events.*, event_detail.* FROM events LEFT JOIN event_detail ON events.event_id = event_detail.event_id WHERE event_date >= '$today' ORDER BY event_date DESC LIMIT 10";
  6. How is your event_date stored normally, without adding DATE_FORMAT(event_date, '%m-%d-%Y')? What I'd do is change the format of $today to match your date string in the db. For example, I have a 'news' table with post dates stored as "Y-m-d H:i:s", so using Jan 1, 2008 as my 'today', I ran this... SELECT * FROM news WHERE postdate >= '2008-01-01 00:00:00'; and it worked like a charm.
  7. $today = date('m-d-y'); // be sure to format the date the same as your date field in the db $query = "SELECT * FROM events WHERE event_date >= '$today'";
  8. yup, you can do this with as many queries as you want to give you parts of a whole.
  9. what does your output look like? $datum = date("d-m-Y") would be 27-10-2008 but you've never formatted $line['datum'] (assuming that's a date also).
  10. That's if you want to know how many were resolved out of how many were routed. if you want a total, $total = $resolved+$routed; $res_percent = round ( ( ($resolved/$total) *100) , 2); $rout_percent = round ( ( ($routed/$total) *100) , 2);
  11. Alright, lemme see if I've got this right... You're looking for a page with "Welcome to my Blog!" as the page title and a list of post titles with a short blurb of the content of that post when no post is selected. When one is selected, you need the content of that post with the post's title as the page title. Right? If that's the case, then you can dump the 2nd while loop and add the values to what I showed you before. Something like this: if (not-a-post){ page-title = "Welcome to my blog" }else{ single row call (no need for while()) page-title = row->title id = row-id body = row body} then down below... if(not-a-post){ while-loop for some number X posts{ echo post titles & blurbs } }else{ echo data retrieved above in whatever format you want for a single blog post } Off the top of my head, that should work. edit: I put your code into an editor and modified the db stuff to pull from a news db here. It all seemed to work just fine.... <?php // this line changed for my db connection file include_once ('engweb_conn.php'); ?> <?php //mysql_select_db ("database_name",$con); - commented out due to my db connect file above $post = $_GET['b']; if (!isset($post)) { $result = mysql_query ("SELECT * from news ORDER BY id DESC"); } else { $result = mysql_query ("SELECT * from news WHERE id = $post"); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title><?php if (!isset($post)) {echo "Welcome to my Blog!";} else { echo "headline";} ?></title> <link href="styles.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="wrapper"> <div id="header"> </div> <div id="leftColumn">Content for id "leftColumn" Goes Here </div> <div id="main"> <table><tr><td> <?php //changed only field names here. if (!isset($post)) { while($row = mysql_fetch_array ($result)) { echo "<h1>" . $row['id'] . "-" . "<a href='?b=" . $row['id'] . "'>" . $row['title'] . "</a> </h1><br>" . substr ($row['newstext'],0,strpos($row['newstext'], "\n")). "<br><br>"; } } else { while($row = mysql_fetch_array ($result)) { echo "<h1>" . $row['id'] . "-" . "<a href='?b=" . $row['id'] . "'>" . $row['title'] . "</a> </h1><br>" . nl2br ($row['newstext']) . "<br><br>"; } } ?> </td></tr></table> </div> </div> </body> </html> <?php mysql_close ($con); ?>
  12. You don't need to repeat the while loop You said (my changes in bold).... $post = $_GET['b']; if (!isset($post)) { $result = mysql_query ("SELECT * from blog ORDER BY blog_id DESC"); $page_title = "Welcome to my Blog!"; } else { $result = mysql_query ("SELECT * from blog WHERE blog_id = $post"); $titlerow = mysql_fetch_object($result); $page_title = $titlerow->blog_title; } ... <title><?php if (!isset($post)) {echo "Welcome to my Blog!";} else { echo single blog's Headline;} ?> <?php echo $page_title; ?> </title> I've done something similar using this method.
×
×
  • 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.