Jump to content
Larry Ullman's Book Forums

swgj19

Members
  • Posts

    16
  • Joined

  • Last visited

swgj19's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Thank you Larry and Jonathan. I do not understand the following: Cannot get my header.html style to work on shop/sales and shop/goodies. include ('./includes/header.html'); I am using exactly what is in the book on page 211 which is my coding above which is relative path. An example of absolute path would be include('http://www.phppond.com/includes/header.html'); Is this right?
  2. That was the trick. All the pages are at least showing content on the pages now. Thank you. Questions: 1. Can you please explain: How did Options -MultiViews cause the pages to be displayed? 2. Cannot get my header.html style to work on shop/sales and shop/goodies. include ('./includes/header.html'); 3. Still searching for parameter 1 error solution as stated above. Here is the site now with the newly implemented solutions you recommended. http://www.phppond.com
  3. Sorry for the delay. My root .htaccess is below: <IfModule mod_rewrite.c> RewriteEngine on # For sales: RewriteRule ^shop/sales/?$ sales.php # For the primary categories: RewriteRule ^shop/([A-Za-z\+]+)/?$ shop.php?type=$1 </IfModule>
  4. I started with Bravenet, but their server seemed to have problems from time to time. My number one choice is Godaddy.com. I have used their hosting and mysql database for 4 years now. The only thing I wish Godaddy would improve on is a toll free number instead of long distance, even though their tech support is 24/7.
  5. I just changed the .htaccess root file to what you said above and no changes took place. The links are still the same. Thanks for the tip on the stored procedures, I have read countless threads on this and really need to take some time and understand how to fix that deathly parameter 1 error. I remember I got frustrated last time with another project and just switched mysqli to mysql and it worked.
  6. I changed the root .htaccess file to what you told me above. I also fixed the mysql error on the index.php page. Now if you go to this link http://www.phppond.com you will see that the index.php page is now showing fully, except that the sale item links are not working. Only the wishlist and cart links are showing with an array error: An error occurred in script '/home/content/68/7344768/html/cart.php' on line 81: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given If you go to http://www.phppond.com/test/ the home page is showing with an array error and no style. So, it seems like .htaccess privileges are granted.
  7. The .htaccess is in the root directory. I have gotten rid of all subdirectories. I do not know much about the .htaccess file or how to change the file except for the explanation in your book. The .htaccess file in my root directory is in my post #3 above. I also have an .htaccess file in the includes folder. The code for that .htaccess file is in post #4 above.
  8. update: I just uploaded the files in the html directory to my root domain phppond.com. I also moved mysql.inc.php to root. I changed the config to: define ('BASE_URI', '/home/content/68/7344768/html/'); define ('BASE_URL', 'http://www.phppond.com/'); define ('MYSQL', BASE_URI . 'mysql.inc.php'); Based on everything I did above the wishlist and cart links are showing now but with an error: An error occurred in script '/home/content/68/7344768/html/cart.php' on line 81: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given The coffee, goodies, and sales links are still not working http://www.phppond.com/shop/coffee/.
  9. I understand what your saying. So if I upload the files in the html directory and just have www.phppond.com/wishlist.php isn't the mysql.inc.php script located outside the html directory, so how would the files work? Would I need to move the mysql.inc.php script inside the root directory?
  10. Thanks for the response, it will not happen again. I got rid of the subdirectory and just uploaded everything in the subdirectory such as html, private, mysql.inc.php. My menu links in the header.html is as follows: <!-- MENU --> <li><a href="<?php echo BASE_URL; ?>shop/coffee/">Coffee</a></li> <li><a href="<?php echo BASE_URL; ?>shop/goodies/">Goodies</a></li> <li><a href="<?php echo BASE_URL; ?>shop/sales/">Sales</a></li> <li><a href="<?php echo BASE_URL; ?>wishlist.php">Wish List</a></li> <li><a href="<?php echo BASE_URL; ?>cart.php">Cart</a></li> <!-- END MENU --> I also changed my config to // Determine location of files and the URL of the site: define ('BASE_URI', '/home/content/68/7344768/html/'); define ('BASE_URL', 'http://www.phppond.com/html/'); define ('MYSQL', BASE_URI . 'mysql.inc.php'); The links are still not working at http://www.phppond.com/html/
  11. I would also add that major websites use a lot of services through the use of XML and JSON. For example, look at how google uses google maps api (application programming interface). Also, Facebook has many complicated components. For example, it sounds easy to have a site that uploads videos, but one would have to have a conversion script or engine for almost every video format that users upload. Also, sites like facebook and linkedin have that registration form on the front page where user selects Country, Province/State, and City. Scripts like that can cost up to $300 for a sql database file of like 86,000 cities. If you do not use a sql file, you would have to manually code every state and city in php files. I think my point is that trying to build the best website would one be very expensive and very very time consuming and not to mention the maintenance. I would recommend to focus on a few niches. I like to focus on e-commerce using ipn with Paypal and eventually learn how to write custom ipn scripts to fit my sites. I would also recommend learning to build content management systems from scratch. This is my favorite hobby. My middle name is CRUD. Just a joke. Hope this helps.
  12. Here is what you do. 1. Set your MySQL tables: For example, see my table below that I used in this site http://www.heartpond...store/index.php Here is the link to an image of my table setup in MySQL http://www.heartpond...tore/table.html You will see two images. The first is an image of the products table fields. The next is an image of the id, product_name, price, details, category, subcategory, date_added. As you can see, you can put whatever name for category and subcategory in the values. You can put in Tim's Coffee for category and put in black coffee for subcategory. Remember the category and subcategory names for the html form you will have on your products page with the drop down list. Once you have your table setup, that is category and a subcategory, you will need to think of what info you want to be displayed on the first page. For example, you could have a drop down list of Tim's Coffee Megan's Coffee Ryan's Coffee Because the idea is to have the user choose a category. Now based on what category they choose, the next page the user will be taken to is the page of the subcategories of that category the user chose. Hope this makes sense. So how do we display this info. Well, pull the info from the MySQL table. Look at the website example http://www.heartpond...store/index.php again. We will use the Ford and Dodge example. Know that Trucks and Cars are the main categories. Basically, set a variable equal to nothing. Then select all from your table that houses the category and subcategory fields which is products in this case. Next, count the rows returned. Next do a mysql_fetch_array and make an array of the values set to a variable which is then set to a variable $dynamicList .. include "storescripts/connect_to_mysql.php"; $dynamicList = ""; $sql = mysql_query("SELECT * FROM products ORDER BY date_added DESC LIMIT 6"); $productCount = mysql_num_rows($sql); // count the output amount if ($productCount > 0) { while($row = mysql_fetch_array($sql)){ $id = $row["id"]; $product_name = $row["product_name"]; $price = $row["price"]; $price = formatMoney($price); $date_added = strftime("%b %d, %Y", strtotime($row["date_added"])); $dynamicList .= '<table width="95%" border="0" cellspacing="0" cellpadding="6"> <tr> <td width="17%" valign="top"><a href="product.php?id=' . $id . '"><img style="border:#666 1px solid;" src="inventory_images/' . $id . '.jpg" alt="' . $product_name . '" width="127" height="102" border="1" /></a></td> <td width="83%" valign="top">' . $product_name . '<br /> $' . $price . '<br /> <a href="product.php?id=' . $id . '" style="color:#99BB00">View Product Details</a></td> </tr> </table>'; } } else { $dynamicList = "We have no products listed in our store yet"; } mysql_close(); ?> Now we have all of our info pulled and ready to use dynamically. Now we need to do something with the data from the tables. Create a form on the page that you want your products shown. This page is my index.php page which displays all the products, so you would have to adjust your select all from whatever in your MySQL query. Select Make: <form method="post" action="" > <select name="category"> <option value="">select</option> <option value="Trucks">Trucks</option> <option value="Cars">Cars</option> </select> <br/> <input type="submit" value="change" name="Submit"/> </form> Use the jquery to do the magic below: <script type="text/javascript"> $(document).ready(function() { $(':submit').bind("click", function(e){ e.preventDefault(); var make = $("select").val(); window.location = "/develop php-online store/" + make.toLowerCase() + ".php"; }); }); </script> So this will get you started. Oh, don't forget to echo your $dynamiclist in the html body to show your mysql queried data. So on the index page, you will have the categories to choose from. Next make a page of your option value such as trucks.php. On trucks.php, it will have select name category. Hope you get the picture. Then create a page ford.php and it will be the subcategories. You can see how the pages will add up after a while with a big inventory. For right now I am learning and this is the only way I know how to accomplish what you are asking. Please everyone, suggest better ways of accomplishing the same task with less pages and coding.
  13. I still have not been able to solve this issue. I would greatly apprecciate any assistance.
  14. Also, this is my .htaccess file in my includes folder: # Disable directory browsing: Options All -Indexes # Prevent folder listing: IndexIgnore * # Prevent access to any file: <FilesMatch "^.*$"> Order Allow,Deny Deny from all </FilesMatch>
  15. This is my .htaccess file in my html root directory: <IfModule mod_rewrite.c> RewriteEngine on # For sales: RewriteRule ^shop/sales/?$ sales.php # For the primary categories: RewriteRule ^shop/([A-Za-z\+]+)/?$ shop.php?type=$1 # For specific products: RewriteRule ^browse/([A-Za-z\+\-]+)/([A-Za-z\+\-]+)/([0-9]+)$ browse.php?type=$1&category=$2&id=$3 # For HTTPS pages: RewriteCond %{HTTPS} off RewriteRule ^(checkout\.php|billing\.php|final\.php|admin/(.*))$ https://%{HTTP_HOST}/$1 [R=301,L] </IfModule> I think it is correct just as on page 176 in the book. Maybe something is wrong somewhere else. Thanks for your response Craig.
×
×
  • Create New...