[advanced search]
Results from the most recent live auction are here.
20 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Go Back   NamePros.Com > Design and Development > Programming > CODE
User Name
Password

Old 03-29-2006, 10:27 PM   · #1
Xyzer
Steven
 
Xyzer's Avatar
 
Name: Steven Gibbons
Location: United Kindom
Trader Rating: (45)
Join Date: Aug 2005
Posts: 1,506
NP$: 40.00 (Donate)
Xyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to all
Tsunami Relief AIDS/HIV
Show certain tutorials.

Hi,

I have a tutorial site here at www.x6core.com, and people submit tutorials, how would i make it so when the submit the choose a catorogry for the tutorial? I think on say the photoshop page the code could be something like this, but im not sure. Can someone help please? P.S All the records are in a mysql database.
Code:
if $categories == photoshop{ showrecord}


Im not sure how to show all records that meet criteria.


Please register or log-in into NamePros to hide ads
Xyzer is offline   Reply With Quote
Old 03-30-2006, 12:12 AM   · #2
sacx13
NamePros Regular
 
Trader Rating: (8)
Join Date: Mar 2006
Posts: 394
NP$: 286.68 (Donate)
sacx13 is on a distinguished road
Question

We need to know more ... When the tutorials are posted you you can decide for a category ? If yes then you can select them. If not the single posibility is to look in title after "category" like "photoshop".

Your tutorials are in sql database or are simple text files on harddrive ?

Regards
Adrian
sacx13 is offline   Reply With Quote
Old 03-30-2006, 04:51 AM   · #3
Xyzer
Steven
 
Xyzer's Avatar
 
Name: Steven Gibbons
Location: United Kindom
Trader Rating: (45)
Join Date: Aug 2005
Posts: 1,506
NP$: 40.00 (Donate)
Xyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to all
Tsunami Relief AIDS/HIV
My tutorials are all stored in a mysql database and i want it so when people submit them they can choose the catogoru.
Xyzer is offline   Reply With Quote
Old 03-30-2006, 11:28 AM   · #4
asgsoft
NamePros Regular
 
asgsoft's Avatar
 
Location: At Home
Trader Rating: (36)
Join Date: Sep 2005
Posts: 806
NP$: 981.10 (Donate)
asgsoft is just really niceasgsoft is just really niceasgsoft is just really niceasgsoft is just really niceasgsoft is just really nice
do you have a pre-defined list

if you sign up to http://aysha.hostmatrix.org/ and see the form for submitting a tutorial should show you a good example.
asgsoft is offline   Reply With Quote
Old 03-30-2006, 01:14 PM   · #5
sacx13
NamePros Regular
 
Trader Rating: (8)
Join Date: Mar 2006
Posts: 394
NP$: 286.68 (Donate)
sacx13 is on a distinguished road
Lightbulb

Your site support adding categorys ? otherwise you need to change your database and all ...

Regards
sacx13 is offline   Reply With Quote
Old 03-30-2006, 10:11 PM   · #6
Xyzer
Steven
 
Xyzer's Avatar
 
Name: Steven Gibbons
Location: United Kindom
Trader Rating: (45)
Join Date: Aug 2005
Posts: 1,506
NP$: 40.00 (Donate)
Xyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to all
Tsunami Relief AIDS/HIV
I know i will change the database and everything but i want the predifined list then a page that shows all the ones in which the catogory is photoshop.
Xyzer is offline   Reply With Quote
Old 03-31-2006, 12:58 AM   · #7
asgsoft
NamePros Regular
 
asgsoft's Avatar
 
Location: At Home
Trader Rating: (36)
Join Date: Sep 2005
Posts: 806
NP$: 981.10 (Donate)
asgsoft is just really niceasgsoft is just really niceasgsoft is just really niceasgsoft is just really niceasgsoft is just really nice
OK first what is ur pre-defined list
asgsoft is offline   Reply With Quote
Old 03-31-2006, 02:45 AM   · #8
wackyjoe
NamePros Regular
 
Trader Rating: (4)
Join Date: Dec 2005
Posts: 206
NP$: 270.00 (Donate)
wackyjoe is on a distinguished road
umm not quite getting wht your saying?

try:

PHP Code:
<a href="/tutorials.php?cat=photoshop">Photoshop</a>


PHP Code:
<?php
$cat
= $_GET['cat'];

if (
$cat == "photoshop") {
//whtever u can here
}
else
{
echo
"Invalid Category";
}
?>
wackyjoe is offline   Reply With Quote
Old 03-31-2006, 02:58 AM   · #9
sacx13
NamePros Regular
 
Trader Rating: (8)
Join Date: Mar 2006
Posts: 394
NP$: 286.68 (Donate)
sacx13 is on a distinguished road
Caution

Is more easy in this way ...

PHP Code:
<?php

function get_articles_cat($cat)
{
//  sql stuff searching for articles from categories $cat
}

$cat = $_GET['cat'];

if (
$cat != "") get_articles_cat($cat);

?>


if you trto doit with if's you will need to add a if for each category added

Regards
sacx13 is offline   Reply With Quote
Old 04-02-2006, 11:43 AM   · #10
Xyzer
Steven
 
Xyzer's Avatar
 
Name: Steven Gibbons
Location: United Kindom
Trader Rating: (45)
Join Date: Aug 2005
Posts: 1,506
NP$: 40.00 (Donate)
Xyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to all
Tsunami Relief AIDS/HIV
^^ what goes in the orange area?
Xyzer is offline   Reply With Quote
Old 04-02-2006, 02:46 PM   · #11
asgsoft
NamePros Regular
 
asgsoft's Avatar
 
Location: At Home
Trader Rating: (36)
Join Date: Sep 2005
Posts: 806
NP$: 981.10 (Donate)
asgsoft is just really niceasgsoft is just really niceasgsoft is just really niceasgsoft is just really niceasgsoft is just really nice
that is a comment
asgsoft is offline   Reply With Quote
Old 04-03-2006, 03:41 AM   · #12
Xyzer
Steven
 
Xyzer's Avatar
 
Name: Steven Gibbons
Location: United Kindom
Trader Rating: (45)
Join Date: Aug 2005
Posts: 1,506
NP$: 40.00 (Donate)
Xyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to all
Tsunami Relief AIDS/HIV
right, i like the way this one is made and i want to use it:
Code:
<?php $cat = $_GET['cat']; if ($cat == "photoshop") { //whtever u can here } else { echo"Invalid Category"; } ?>


I dont know how to intergrate it with this:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> </head> <body> <?php $connect = mysql_connect("localhost", "dbun", "dbpw"); mysql_select_db("dbname", $connect); $select = mysql_query("SELECT * FROM `tutorials`", $connect); while($row = mysql_fetch_array($select, MYSQL_ASSOC)) { $id = $row['id']; $name = $row['name']; $email = $row['email']; $url = $row['url']; $url2 = $row['url2']; $WebsiteName = $row['WebsiteName']; $TutorialName = $row['TutorialName']; $description = $row['description']; echo " <p> <strong>Tutorial Name:</strong> <a href=\"$url2\">$TutorialName</a><br />\n <strong>Submitted By:</strong> <a href=\"$url\">$WebsiteName</a><br />\n <strong>Description:</strong> $description </p> "; } ?>


I think it should be:
Code:
<?php $connect = mysql_connect("localhost", "bdun", "dbpw"); mysql_select_db("dbname", $connect); $select = mysql_query("SELECT * FROM `tutorials`", $connect); while($row = mysql_fetch_array($select, MYSQL_ASSOC)) { $id = $row['id']; $name = $row['name']; $email = $row['email']; $url = $row['url']; $url2 = $row['url2']; $WebsiteName = $row['WebsiteName']; $TutorialName = $row['TutorialName']; $description = $row['description']; $cat = $row['cat']; } if ($cat == "photoshop") { //echo statement?? echo " <p> <strong>Tutorial Name:</strong> <a href=\"$url2\">$TutorialName</a><br />\n <strong>Submitted By:</strong> <a href=\"$url\">$WebsiteName</a><br />\n <strong>Description:</strong> $description </p>"; } else { echo "There are no tutorial in this category"; { ?>


Is this correct??
Xyzer is offline   Reply With Quote
Old 04-03-2006, 04:04 AM   · #13
whyme953
NamePros Member
 
whyme953's Avatar
 
Trader Rating: (0)
Join Date: Jun 2004
Posts: 92
NP$: 183.00 (Donate)
whyme953 is an unknown quantity at this point
i think what you want to do is

SELECT * FROM tutorials WHERE cat = 'photoshop'

then loop through the results.
__________________
Bais Menachem
whyme953 is offline   Reply With Quote
Old 04-03-2006, 04:39 AM   · #14
Xyzer
Steven
 
Xyzer's Avatar
 
Name: Steven Gibbons
Location: United Kindom
Trader Rating: (45)
Join Date: Aug 2005
Posts: 1,506
NP$: 40.00 (Donate)
Xyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to all
Tsunami Relief AIDS/HIV
Thanks, ive done a copy with my code and get this error:
Code:
Parse error: syntax error, unexpected $end in /home/gibbons/public_html/photoshop.php on line 37


In
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> </head> <body> <?php $connect = mysql_connect("localhost", "dbun", "dbpw"); mysql_select_db("dbname", $connect); $select = mysql_query("SELECT * FROM `tutorials`", $connect); while($row = mysql_fetch_array($select, MYSQL_ASSOC)) { $id = $row['id']; $name = $row['name']; $email = $row['email']; $category = $row['category']; $url = $row['url']; $url2 = $row['url2']; $WebsiteName = $row['WebsiteName']; $TutorialName = $row['TutorialName']; $description = $row['description']; if ($category == "Photoshop"){ echo " <p> <strong>Tutorial Name:</strong> <a href=\"$url2\">$TutorialName</a><br />\n <strong>Submitted By:</strong> <a href=\"$url\">$WebsiteName</a><br />\n <strong>Description:</strong> $description </p>"; } else { echo "Sorry, There are currently no tutorials in this category."; } ?> </body> //LINE 37 BELOW </html>
Xyzer is offline   Reply With Quote
Old 04-03-2006, 05:46 AM   · #15
whyme953
NamePros Member
 
whyme953's Avatar
 
Trader Rating: (0)
Join Date: Jun 2004
Posts: 92
NP$: 183.00 (Donate)
whyme953 is an unknown quantity at this point
you're missing the closing } for the while($row = mysql_fetch_array... statement.

generally when you get an error like that on the last line that's what it is.
__________________
Bais Menachem
whyme953 is offline   Reply With Quote
Old 04-03-2006, 06:12 AM   · #16
Xyzer
Steven
 
Xyzer's Avatar
 
Name: Steven Gibbons
Location: United Kindom
Trader Rating: (45)
Join Date: Aug 2005
Posts: 1,506
NP$: 40.00 (Donate)
Xyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to all
Tsunami Relief AIDS/HIV
I have done this and its has worked the WHERE cat=photoshop.

Where can i put a statement if there is no tutorials??

Last edited by webmonkey : 04-03-2006 at 06:41 AM.
Xyzer is offline   Reply With Quote
Old 04-03-2006, 08:44 AM   · #17
Xyzer
Steven
 
Xyzer's Avatar
 
Name: Steven Gibbons
Location: United Kindom
Trader Rating: (45)
Join Date: Aug 2005
Posts: 1,506
NP$: 40.00 (Donate)
Xyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to all
Tsunami Relief AIDS/HIV
also now what has happened is that it wont display the site and tutorial name, check here: http://www.x6core.com/?id=photoshoptutorials But all i have changed is the where cat = photoshop, if you want to see my code its here:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> </head> <body> <?php //Connect goes here, but deleted user and pw. $select = mysql_query("SELECT * FROM `tutorials` WHERE category = 'photoshop'", $connect); while($row = mysql_fetch_array($select, MYSQL_ASSOC)) { $category = $row['category']; $id = $row['id']; $name = $row['name']; $email = $row['email']; $url = $row['url']; $url2 = $row['url2']; $WebsiteName = $row['WebsiteName']; $TutorialName = $row['TutorialName']; $description = $row['description']; echo " <p> <strong>Tutorial Name:</strong> <a href=\"$url2\">$TutorialName</a><br />\n <strong>Submitted By:</strong> <a href=\"$url\">$WebsiteName</a><br />\n <strong>Description:</strong> $description </p> "; } ?> </body> </html>
Xyzer is offline   Reply With Quote
Old 04-03-2006, 10:30 PM   · #18
Xyzer
Steven
 
Xyzer's Avatar
 
Name: Steven Gibbons
Location: United Kindom
Trader Rating: (45)
Join Date: Aug 2005
Posts: 1,506
NP$: 40.00 (Donate)
Xyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to all
Tsunami Relief AIDS/HIV
can anyone help me please?
Xyzer is offline   Reply With Quote
Old 04-03-2006, 11:26 PM   · #19
whyme953
NamePros Member
 
whyme953's Avatar
 
Trader Rating: (0)
Join Date: Jun 2004
Posts: 92
NP$: 183.00 (Donate)
whyme953 is an unknown quantity at this point
after you run the mySQL query add this:
PHP Code:
if (mysql_num_rows($select) >0) {//there are tutorials in this cat.

//print out your stuff

} else {//nothing in this cat.

    
echo 'Sorry, no tutorials in this category'; //replace with message of your choice.
}


i'm not sure if this is what you're looking for or not. hope it helps.
__________________
Bais Menachem
whyme953 is offline   Reply With Quote
Old 04-04-2006, 02:17 AM   · #20
Xyzer
Steven
 
Xyzer's Avatar
 
Name: Steven Gibbons
Location: United Kindom
Trader Rating: (45)
Join Date: Aug 2005
Posts: 1,506
NP$: 40.00 (Donate)
Xyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to all
Tsunami Relief AIDS/HIV
Fixed thanks everyone.
Xyzer is offline   Reply With Quote
Closed Thread

NamePros is a revenue sharing forum.

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


Site Sponsors
Proof is in the Parking Buy Flash Arcade Game Script Thousand Dollar Profits
Advertise your business at NamePros
All times are GMT -7. The time now is 11:23 PM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0