fireslug Posted January 15, 2007 Share Posted January 15, 2007 I am trying to develop a DB drivin site and have received help from a local guy (Robert), but he has since got too busy to help. The site is being hosted by friend (Steve) who is also too damned busy to assist in developing the site, so I'm thinking maybe I should try to do it myself, with a bit of outside help. If anyone is interested and has the time, I would really really appreciate the input. Rob created index, login, register etc, pages that were working, until the server was reset and the database was lost. Nysql and phpmyadmin are installed on the server, I think I can create the necessary tables, but I have no idea of how to access the information stored in those tables.I would like to know where in the included index.php code, is the information that allows me to connect to the database. I noticed that there is no mention of: $dbhost = ""; //Your database host $dbname = ""; //Your database name $dbpass = ""; //Your database password etc in the index page created by Rob, and would like to know how did he access the database with the aforementioned lines? Based on the search queries, what tables do I need to create? Here is the page created by Robert: <?php require 'mysite.php'; set_error_handler("errHandler"); $db = connectdb(); // Category list - template includes link to select each category $categories = categorylist( "<ul>", "</ul>", "<li><a href=\"" . $_SERVER['PHP_SELF'] . "?category=%catid%\">%cattitle%</a></li>", isset($_GET['category']) ? $_GET['category'] : null, $db ); // Only the newest X specials, with pictures, are shown as featured specials. The rest are just listed. See configuration for value of X. $supplierlinks = ""; $speciallinks = ""; // Specials are shown by... if ( isset($_GET['category']) ) { // ... category selected from the list $selectedspecials = "Latest top specials in <strong>" . getcategorytitle($_GET['category'],$db) . "</strong>"; $specials = specialsbycategory( $specialmarkup['general'], $_GET['category'], "", $db ); $supplierlinks = supplierlistonly($listmarkup['supplier'],$notfoundmarkup,$db,$_GET['category']); $speciallinks = speciallistonly($listmarkup['special'],"",$db,$_GET['category']); } elseif ( isset($_GET['search']) ) { // ... a text search $selectedspecials = "Specials matching search for '<em>" . $_GET['search'] . "</em>'"; $specials = specialsbysearch( $specialmarkup['general'], $_GET['search'], "", $db ); $supplierlinks = specialsbysearch($listmarkup['supplier'],$_GET['search'],$notfoundmarkup,$db,true,true); $speciallinks = specialsbysearch($listmarkup['special'],$_GET['search'],"",$db,true); } elseif ( isset($_GET['supplier']) ) { // ... link to a specific supplier $selectedspecials = "Current specials at <em>" . getsuppliername($_GET['supplier'],$db) . "</em>"; $specials = getsupplierinfo($_GET['supplier'],$db) . specialsbysupplier( $specialmarkup['supplier'], $_GET['supplier'], $notfoundmarkup, $db ); } elseif ( isset($_GET['special']) ) { // ... link to a single/specific special $specials = specialsbyspecial( $specialmarkup['special'], $_GET['special'], "Sorry, the special you selected has just expired!", $db ); $catlist = specialcategories( ",%title%", $_GET['special'], "", $db ); $specials = $specials . "<p>Categories: " . substr($catlist,1,strlen($catlist)-1) . "</p>"; $selectedspecials = ""; } else { // ... by default, the latest (i.e. furthest from expiry) specials $selectedspecials = "The latest top specials on mysite.co.nz"; $specials = specialsbylatest( $specialmarkup['general'], "", $db ); $supplierlinks = supplierlistonly($listmarkup['supplier'],$notfoundmarkup,$db); $speciallinks = speciallistonly($listmarkup['special'],"",$db); } // Add headings and list tags for supplier and special lists if ( strlen($supplierlinks) > 0 ) { $supplierlinks = "<p class=\"header\">Suppliers</p><ul>" . $supplierlinks . "</ul>"; $speciallinks = "<p class=\"header\">Specials</p><ul>" . $speciallinks . "</ul>"; } mysql_close($db); restore_error_handler();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <meta name="description" content="mysite contains the latest specials." /> <meta name="author" content="Charles Jamieson" /> <title>mysite.co.nz</title> <link rel="stylesheet" type="text/css" href="mysite.css" /> </head> <body> <div class="header"> <h1>mysite.co.nz</h1> </div> <div class="search"> <form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <p>Search: <input type="text" name="search" value="<?php echo isset($_GET['search']) ? $_GET['search'] : ""; ?>" /> <input type="submit" value="Go" /> </form> </div> <hr class="pageanchor" /> <div class="maincontent"> <div class="speciallist"> <p class="selectedspecials"><?php echo $selectedspecials; ?></p> <?php echo $specials; ?> </div> <hr class="pageanchor" /> <div class="supplierlinks"> <?php echo $supplierlinks; ?> </div> <div class="speciallinks"> <?php echo $speciallinks; ?> </div> </div> <div class="categorymenu"> <h4>Browse</h4> <?php echo $categories; ?> <p class="link"><a href="supplier.php"><font face="Arial, Helvetica, sans-serif" size="2">Supplier login</font></a></p> <p class="link"><font face="Arial, Helvetica, sans-serif" size="2"><a href="register.php">New supplier registration</a></font></p> <p class="link"><font face="Arial, Helvetica, sans-serif" size="2"><a href="about.html">About mysite</a></font></p> </div> <hr class="pageanchor" /> <p class="legal"><font size="2" face="Arial, Helvetica, sans-serif">All prices $NZ including GST, subject to change without notice.<br /> Supplier names, logos, products and images copyright of their respective owners.<br /> Site design © mysite.co.nz, 2006.</font></p> </body></html>------------------------------------------------------------------------------------------------To recap: what tables need to be created. how to access the info in those tablesI'm totally new to php and coding, and have no idea how to proceed from here. I hope someone can spare me a little time and help. Ric Quote Link to comment Share on other sites More sharing options...
trq Posted January 15, 2007 Share Posted January 15, 2007 You password and setting are more than likely in the include 'mysite.php'. As for finding out what tables you need, its hard to say, all the queries seem to be wrapped within individual functions, so it all going to be pretty difficult to track down.Id'e suggest you start [url=http://hudzilla.org/phpwiki/index.php?title=Main_Page]here[/url] and post back when you have a more specific issue. Quote Link to comment Share on other sites More sharing options...
fireslug Posted January 15, 2007 Author Share Posted January 15, 2007 Thanks Thorpe for your note. Oh well, I guess I need to look at it in a different manner. Is there a way for me to obtain a script that will allow me to extract and display details from say, tables such as: supplierscategoriesspecialsetcIf I can get one sample, I think I might be able to work out out to extract data from the others and display them (most probably wishful thinking).cheersRic Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.