Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Professional help needed :p
Old 03-17-2005, 07:30 PM Professional help needed :p
feraira's Avatar
BeTheBand!

Posts: 350
Trades: 0
I am trying to make a tutorial database script... I haven't really topped it up yet, just got the basic frame work, anyway.. I can't use my webserver as Cpanel is not working to create the databases and such.

Can someone check this code on there server? If there are any problems PLEASE get back to me!

Code:
<?

// Connect to DB
mysql_connect("localhost", "dbuser", "dbpass");
mysql_select_db("dbname") or die("Unable to select DB");

$result=mysql_query("SELECT * FROM tutorials ORDER BY cat");
while ($row=mysql_fetch_array($result)) {

// Pull all information needed from the database
$id = $row['id']; // The ID for the tutorial / category
$cat = $row['cat']; // The category names
$tname = $row['tname']; // The tutorial name inside the category
$tdesc = $row['tdesc']; // A small description of the tutorial
$tutorial = $row['tutorial']; // The full tutorial

}

if ($_GET['p']=="$cat") {	// If the action is categorys, show the tutorials in that category
echo("You have selected <a href=\"./?p=tutorials&cat=".$cat."\">$cat</a> tutorials");
echo("<br><br>");
echo("<a href=\"./?p=tutorials&cat=".$cat."&id=".$id."\">$tname</a> - $tdesc");

} else if ($_GET['p']=="$tutorial") {	// If the action is a tutoril, show the tutorial
echo("<a href=\"./?p=tutorials&cat=".$cat."\">$cat</a> - $tutorial");

echo("<br><br>");
echo("$tutorial");

} else {($num_rows > 0) {	// If the rows in the database are more than 0, show a list

echo("<a href=\"./?p=tutorials&cat=".$cat."\">$cat</a>");
echo("<br><br>");
echo("<a href=\"./?p=tutorials&cat=".$cat."&id=".$id."\">$tname</a> - $tdesc");
echo("<br><br>");

}}
mysql_close(); 	// Close the MySQL connection to the database
?>
feraira is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to Professional help needed :p
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.08027 seconds with 12 queries