28, May 2012

need help with a php/mysql problem - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: need help with a php/mysql problem
« previous next »
Pages: [1] Print
Instabuck - The easy way to sell digital products online

Author 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.

hopefully using a something like this :
Code:
http://www.mywebsite.com/sites.php?category=(_________)

what exactly do I need to include in my "sites.php" to allow such a thing?

I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #1 on: Jun 03, 2008, 01:26:55 am »

What you ask is very general.

First of all do you have any basic php and mysql knowledge? If not you should try to read some basic php tutorials before doing this.

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
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: Male
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);

echo 
$row[0];
echo 
$row[1];
?>


Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=7763
Tags : php db mysql Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: need help with a php/mysql problem
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 08:17:38 pm





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!






Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2012 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.