Topic: need help with a php/mysql problem (Read 1293 times)
Google dot what?
Posts: 2
16 credits Members referred : 0
« on: Jun 02, 2008, 07:53:06 pm »
Hey everyone, I am not usually invovled with php so i Guess it fair to say I am a total n00b. Either way, I need some quick help.
I have a website that offers a "top 100" voting system of other sites.
I have 3 categories of websites titled education,professional, and public. these websites have been preorganized into these categorys using a "category_id" (either 1,2 or 3) i need to be able to pull these different categories out of an already made mysql db onto a page.
Google dot what?
Posts: 2
16 credits Members referred : 0
« Reply #2 on: Jun 03, 2008, 05:03:18 pm »
Yeah, i know its about as general as it gets. I do have knowledge in mysql and how this all works. I just can't seem to find any tutorials that deal with anything besides the most basic.
I guess a better question is what is the code used in a php file to say
pull and display any file in my mysql db with a "category_id" of 1,2 or 3?
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 5799
46391 credits Members referred : 3
« Reply #3 on: Jun 03, 2008, 10:30:49 pm »
This could be something like that:
Code:
<?php $result = mysql_query("SELECT id,url FROM categories WHERE id = '".(int)$_GET['category']."' LIMIT 1"); if (!$result) { echo 'Could not run query: ' . mysql_error(); exit; } $row = mysql_fetch_row($result);