Jump to content


Sphere's coding problems


  • Please log in to reply
19 replies to this topic

#16 Sphere

Sphere

    The moth next to my brain is Bart, say hi to him if you like

  • Sponsor
  • PipPipPipPipPip
  • 2,355 posts
  • Location:*tap* Behind ya!
  • Interests:I'm a Dutchy, that means I'm not a German (which doesn't sound/look the same to me!) also, being a Dutchy means I'm an idiot... sort off!

    And I def. need to get a real life again... I'm bored with my current life, ideas can be pm'd to me!
  • Country:Dutchyland

Posted 27 January 2009 - 12:07 AM

Stupidity:
I call this calendar: INFINITE!
Yes, I was complaining at Google Services about Googlebot downloading over 300mb in 3 days...

Got that coming right!
At least fixed it to indeed exactly the period between the opening of my home, and now...

But, do you know a way of preventing GoogleBot from following only those marked as don't follow?
rel="nofollow" appearantly doesn't mean the bot won't follow the links, for some reason it'll only prevent the link from being ranked (which is odd imo)

That's it for now, my worldmap is almost done and my exam will not go well tomorrow!

#17 Sphere

Sphere

    The moth next to my brain is Bart, say hi to him if you like

  • Sponsor
  • PipPipPipPipPip
  • 2,355 posts
  • Location:*tap* Behind ya!
  • Interests:I'm a Dutchy, that means I'm not a German (which doesn't sound/look the same to me!) also, being a Dutchy means I'm an idiot... sort off!

    And I def. need to get a real life again... I'm bored with my current life, ideas can be pm'd to me!
  • Country:Dutchyland

Posted 08 February 2009 - 01:46 AM

The
Posted Image
has a problem again!

I can't seem to get my PHP-mod-rewrite to work.
It either works too good (thus, if a 404 is needed, it just goes to the main page)
Or it doesn't work at all (everything is a 404)...

I'll post my code tomorrow for the interested people.
I'm writing this code, to give people who are not familiar with Apache's .htaccess the opportunity to use some sort of mod-rewrite feature on their site.

#18 Sphere

Sphere

    The moth next to my brain is Bart, say hi to him if you like

  • Sponsor
  • PipPipPipPipPip
  • 2,355 posts
  • Location:*tap* Behind ya!
  • Interests:I'm a Dutchy, that means I'm not a German (which doesn't sound/look the same to me!) also, being a Dutchy means I'm an idiot... sort off!

    And I def. need to get a real life again... I'm bored with my current life, ideas can be pm'd to me!
  • Country:Dutchyland

Posted 18 February 2009 - 03:44 AM

Ok, sorry for that, got the code working before I needed anything else :christo:

Here's something, just a try:

http://www.casa-lagu...et/taal/view/41
(please replace the number with anything you like!)

That link working for you guys?
It should, but somehow, it only works at random for me!

#19 Sphere

Sphere

    The moth next to my brain is Bart, say hi to him if you like

  • Sponsor
  • PipPipPipPipPip
  • 2,355 posts
  • Location:*tap* Behind ya!
  • Interests:I'm a Dutchy, that means I'm not a German (which doesn't sound/look the same to me!) also, being a Dutchy means I'm an idiot... sort off!

    And I def. need to get a real life again... I'm bored with my current life, ideas can be pm'd to me!
  • Country:Dutchyland

Posted 14 August 2009 - 11:33 PM

Ok, something new, here's the idea:

I want my posting-members to do the following:
[poll=Question here]Answer 1
Answer 2
Answer 3[/poll]

to output (0 == radiobutton):
Question
0 - Answer 1
0 - Answer 2
0 - Answer 3


Well, mainly, what I run into, is that I can make the poll work visible, but the problem is storage. I can't find a way to store the stuff into a database without messing something up.

What I want is the database ONLY storing the post-number (as my site works by numbering, not titles) and the vote-count.

the idea is something like the database looks like this:
ID - Post# - Answer count
1 - 100 - 0;0;5

Something like that. But I just run stuck in how it works to the database. I can't post it without a full reload, which kinda resets all data for unknown reasons.

Anyone got a clue?

basecode is PHP/MySQL/AJAX

#20 brewin

brewin

    Victory is mine!

  • Administrator
  • PipPipPipPipPip
  • 1,262 posts
  • Location:Missouri
  • Interests:Anything interesting.
  • Country:USA

Posted 15 August 2009 - 06:06 AM

You shouldn't put more than one value in a single field. I'm guessing this is what you're doing with Answer Count, where each value is delimited by a semicolon? That can cause problems. Always remember to normalize your data.

I would create three new tables. Something like this...

- polls - 
id | post_id | poll_text

- options -
id | poll_id | option_text

- votes -
id | option_id

option_id is a foreign key to the option chosen by someone (each row is a single vote)
poll_id is a foreign key to the poll that contains the option
post_id is a foreign key to the post that contains the poll


To get the current total for each option in a poll, you might do something like this psuedocode...

SELECT COUNT(*) 
FROM votes 
INNER JOIN options ON options.id = votes.option_id
INNER JOIN polls ON polls.id = options.poll_id
INNER JOIN posts ON posts.id = polls.post_id
WHERE votes.option_id = $someOptionID

If I got the syntax correct, it should work. There is probably a better way to get the totals though. It might be better to just get all the votes for the poll in the current post and use PHP to calculate the totals.




5 user(s) are reading this topic

0 members, 5 guests, 0 anonymous users