-
Posts
902 -
Joined
-
Last visited
-
Days Won
9
Everything posted by doddsey_65
-
How would i get it so i can show the most active forum the user has posts in. I have a posts table which lists the posts aswell as the forum they are in by id. So how would i select all of the posts with their username(easy) but then from these results calculate which id shows up the most so i can echo that?
-
thanks but its not quite what im looking for. I have my combo box and when the user selects an item from it it will display some text along side the box in a div or something.
-
Hi, basically i want it so that when the user selects a value from a drop down list a small peice of text appears next to it describing what they have selected. I dont know what words to put into google so does anyone have any links or can help?
-
Whenever i make a website it appears to load slowly compared to others. Could this be because i always use select all in my sqls? would SELECT 1, 2 be better for speed than SELECT *?
-
it works, sort of, the 1st group is displayed again under the second group. And i know my code is always a mess lol
-
thanks, i tried yours but i couldnt get it to work. heres what i have now: $sql = mysql_query("SELECT * FROM forum_groups") or die (mysql_error()); while ($row = mysql_fetch_object($sql)) { $groupid = $row->groupid; $forumid2 = $row->forumid; $groupname = $row->groupname; } echo ' <td class="forum-left">'.$groupname.'</td> <td class="forum-middle">Topics</td> <td class="forum-middle">Posts</td> <td class="forum-right">Last Post</td></tr>'; $sql = mysql_query("SELECT * FROM $forums WHERE groupid = $groupid") or die (mysql_error()); while ($row = mysql_fetch_object($sql)) { echo '<tr><td class="forum2"> <a href="index.php?f='.$row->id.'">' . $row->name . '</a><br /> <h4 style="font-size:10px;">'.$row->description.'</h4> </td><td class="forum">'; $id = $row->id; $sql2 = mysql_query("SELECT * FROM $threads WHERE forumid = '$id'") or die (mysql_error()); $num = mysql_num_rows($sql2); echo $num . '</td><td class="forum">'; $sql3 = mysql_query("SELECT * FROM forum_posts WHERE forumid = '$id'") or die (mysql_error()); $num2 = mysql_num_rows($sql3); echo $num2 . '</td><td class="forum">'; echo 'By '.$row->lastpost.' <h5 style="font-size: 10px;">On '; echo date("F j, Y, g:i a", strtotime($row->date)); echo '</h5></td></tr><tr>'; } there are currently 2 items in group 1 and 1 in group 2. This displays the stuff in group 1 properly but doesnt display stuff from group 2 under it as i had hoped.
-
my mind has drawn a blank so i need help. look here http://thevault.cz.cc/forum/index.php for a better look. Im making a forum and i have 4 database tables: groups, forums, threads, and posts all i want to do is show the forums on the home page categorized by which group they are in like normal forums do. ie the forums belonging to group NEWS will display together with the news header at the top of the table and then the different groups under that with their own table headers. Sounded simple enough to me but i cant do it. When i try it just displays a header above each forum rather than a header at the top of the forums in a group. Hope this makes sense.
-
but the id in the details table is different from the id in the post table since the details id is for the users and the post id is the id for the posts. So a join wouldnt work with 2 different id values would it?
-
the post is in forum_posts.content the author is in posts.author the user signature is in details.signature i echo the post by pulling all posts from the database i then echo who the author is i then want to echo the sig by doing something like echo $post echo $sig WHERE author= $_SESSION['usr'] something like that?
-
thanks, now i understand that this isnt what i need lol. More info: I have 2 tables: forum_posts and details i need to pull everything from forum_posts and i need to pull signature row from details. How would i do this? it cant be a join because there are no identical tables.
-
i tried this but i dont get any results: $sql = mysql_query(" SELECT forum_posts.content, forum_posts.postedby, forum_posts.postedby, details.signature FROM forum_posts INNER JOIN details on forum_posts.content = details.signature WHERE forum_posts.topicid = '$threadid'") or die (mysql_error());
-
so how would i change mine to match yours? sorry but this is the first time i have used join. I tried and i get an error not unique table
-
im using the following query to pull all rows from forum_posts and the signature row from a table called details. Only problem is that the signature doesnt show up and the posts are repeated several times. What have i done wrong? $sql = mysql_query(" SELECT * FROM forum_posts p, details d WHERE p.topicid = '$threadid'") or die (mysql_error()); while ($row = mysql_fetch_object($sql)) { $topicname = $row->topicname; $topicnamesafe = str_replace(" ", "-", $topicname); $sig = $row->signature; echo '<tr><td class="posts" style="width:80%;">' .$row->content . '<hr />'.$sig.'</td><td class="forum">'; echo 'By ' . $row->postedby . '<br /><h5 style="font-size: 12px;">On '; echo date("F j, Y, g:i a", strtotime($row->date)); echo '</h5></td></tr><tr>'; }
-
okay i have a htaccess file which reqrites profile.php?username=username to profile/username/username.html Do i now need my href links to point to the second url instead of the dynamic one? I have done this and it loads the page profile/usewrname/username.html but the information i am supposed to get from $_GET['username'] doesnt show up and its just a blank section.
-
nope neither of them worked either. just to make sure im putting it in the right place the .htaccess file is in the same directory as the main index.php page.
-
I am trying to use a htaccess file to rewrite my urls to be SEO friendly. eg instead of profile.php?username=username it would be profile/username/username.html this is the contents of my htaccess: Options +FollowSymLinks RewriteEngine on RewriteRule profile/usrename/(.*)/ profile.php?usrename=$1 unfortunatly its not working. My host does have this enabled and it is in my site root. Is there anything i have forgot to include for it to work?
-
i added that line but still nothing, is there something else i need to do?
-
I have 4 files which i include into every file. These are header.php, db.php, sidebar.php and footer.php. It works like a dream, but i have changed the file layout. It used to be htdocs/myaccount.php and in myaccount.php i would use include('includes/header.php'); which also worked. However now i have moved myaccount.php to myaccount/index.php. What do i need to do to make the includes work? ive tried ../ and ../../ and ./ but none of them work, i keep getting a syntax error(500). Heres my directory list Root includes header.php db.php sidebar.php footer.php myaccount index.php
-
okay my host doesnt allow .htaccess so i need something different. like i said i changed if (isset($_GET['id'])) to if (isset($_GET['tutorialname'])) and changed <a href="tutorials.php?id=<?php echo $row->id; ?>"> to <a href="tutorials.php?name=<?php echo $row->tutorialname; ?>"> but its not working, the content doesnt show up when the page loads.
-
i did change it to get name but it didnt work. I think i will go for the rewrite thing cos i was doing this for SEO anyway.
-
i have a page called tutorials.php. When a user clicks one of the displayed tutorials they are sent to tutorials.php?id=thetutorialid thetutorial id is taken from the database column id. however i want it to look something like tutorials.php?name=tutorialname i thought of changing the $_GET['id'] to $_GET['tutorialname'] but it didnt work. I also changed the hyperlink from tutorials.php?id=<? echo $id; ?>"> to tutorials.php?name=<? echo $tutorialname; ?>"> Any ideas?
-
sorry but i get a 500 error when using the code
-
Hi, I am trying to use preg_replace on a database column called content. This column contains some html code and within is several img tags. What i want to do is replace style="width: xxxpx; to style="width: 100px;. Here is the code i tried but it didn't work. Any ideas? $content = preg_replace('/(width:)=("[^"]*")/i', 'width: 100', $content);
-
I would like to include a section on my tutorials website where people can add text tutorials. This means i would like to have a text area where html code can be inputted. I would like to be able to restrict the html tags to just stuff like <b> and <em>. I have no idea on how to even start this or if its possible. Also how would i store these tutorials? They would probably be long text documents so the contents couldnt really be stored in the database....could they?