Jump to content

Recommended Posts

I\'m coding a forum right now

 

I have the idea

I know how to do a lot of it

 

I got all of the root pages working (ie. viewthread.php, index.php, addpost.php, etc)

 

right now I\'m adding all of the other stuff I\'m wanting to put into the forums such as what you see here or on a vBulliten forum

thins like how many views a thread has

 

I\'m having a problem though

the number of views isn\'t showing up

and its not updating the value in the database

 

heres my function to update how many views a thread has

[php:1:06e2cae966]

function updateviews($topicID) {

$views_query = mysql_query(\"SELECT * FROM topics WHERE (views=$views) AND (ID=$topicID)\");

$views = $views++;

mysql_query(\"Update topicz WHERE views=\'$views\'\");

}

[/php:1:06e2cae966]

 

heres what I have on my viewforum.php for views

[php:1:06e2cae966]

<?php

$views_query = mysql_query(\"SELECT * FROM topics WHERE (views=$views) AND (ID=$topic)\"); ?>

<TD>

<P><FONT SIZE=\"+1\" FACE=\"Trebuchet MS,Arial,Helvetica\"><?php echo $views[\'views\'] ?></FONT>

</TD>

[/php:1:06e2cae966]

 

I\'m not sure exactly whats wrong

I\'m pretty sure my code is right

but then again if it was right it\'d work so its obviously wrong

heh

 

anyways

if somebody has some ideas on this

could use the help

Link to comment
https://forums.phpfreaks.com/topic/317-thread-views-for-a-forum/
Share on other sites

Well, I don\'t know a lot about PHP, but I do spell a lot of things right.

 

[php:1:dbdcaa66c2]function updateviews($topicID) {

$views_query = mysql_query(\"SELECT * FROM topics WHERE (views=$views) AND (ID=$topicID)\");

$views = $views++;

mysql_query(\"Update topicz WHERE views=\'$views\'\");

}[/php:1:dbdcaa66c2]

 

Is that z supposed to be an s in your second query??

Link to comment
https://forums.phpfreaks.com/topic/317-thread-views-for-a-forum/#findComment-1012
Share on other sites

Well, I don\'t know a lot about PHP, but I do spell a lot of things right.

 

[php:1:c949c10aa3]function updateviews($topicID) {

$views_query = mysql_query(\"SELECT * FROM topics WHERE (views=$views) AND (ID=$topicID)\");

$views = $views++;

mysql_query(\"Update topicz WHERE views=\'$views\'\");

}[/php:1:c949c10aa3]

 

Is that z supposed to be an s in your second query??

 

haha

 

dyslexcia

a beautiful thing isn\'t it?

(my dyslexcia causes me to misspell a lot of things and I rarely see it)

 

that\'ll help with the update function

but

thats not the main problem

 

the problem is its not displaying the views

its not displaying anything

when it should be display 0 since 0 is whats in the database

so...

whats goin on here?

 

edit: ahh... I feel like an idiot

already had the code to display the views just had to use it instead of adding more code :roll:

so it displays them now

 

but...

it doesn\'t update it

Link to comment
https://forums.phpfreaks.com/topic/317-thread-views-for-a-forum/#findComment-1013
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.