Jump to content


  • Posts

  • Joined

  • Last visited

WebDeveloperMike's Achievements


Newbie (1/14)



  1. I found the problem...and im not sure why it was a problem at all... I had to change this code: while($row = mysql_fetch_array($get_all, $con)) to this code: while($row = mysql_fetch_array($get_all)) So i took out the $con variable which was my connection. not sure why it made a difference?
  2. Yes, i use a db_connect.php as a php include file: <?php $con = mysql_connect('localhost','mikesp5_test','reggie88'); if (!$con) { die("Could not connect to MySQL Server" . mysql_error()); } // echo "Successfully connected to MySQL Server!"; $my_db = mysql_select_db("mikesp5_killer"); if (!$my_db) { die("Could not connect to database" . mysql_error()); } // echo "Successfully connected to Database!"; ?> when i remove the comment tags before the echo's they both show up. and i am able to insert data into the database. just not display it for some reason. also, the SQL does actually select items from the database because when I LIMIT 5 and go to www.ijournalsometimes.com i see 5 empty blog entry templates, so its not getting the the actual text from the database... i hope that makes sense. visit ijournalsometimes.com and you will see it there is as many empty blog entry templates as i wish using LIMIT in my SQL code. Thank you Ben for the reply
  3. At this point, I have my domain (www.ijournalsometimes.com) pointing to http://www.mikespot.net/alex/'>http://www.mikespot.net/alex/ if you type in http://www.mikespot.net/alex/ - the blog works 100%. if you type in www.ijournalsometimes.com - it does not work. ?????????????????????????????????????????
  4. I built a website at www.mikespot.net/alex/ that uses php and mysql to store and display blog entries. It works 100%. I purchased a new domain (www.ijournalsometimes.com) and added an 'addon domain' to my current web hosting package - so the root folder is for my new site is public_html/ijournalsometimes.com I copy and pasted all of my files from public_html/alex/ to public_html/ijournalsometimes.com... I can connect to the MySQL server and database successfully. I can ADD blog entries successfully (Inserting data into the database)... ..but when i try to select and display data from database...NOTHING. basically, the sites are coded the exact same but are in different locations and now i cant select and display data from the database. here is my php code for the index page: <?php $sql = "SELECT * FROM blog ORDER BY id DESC LIMIT 5"; $get_all = mysql_query($sql); $blog_entry; while($row = mysql_fetch_array($get_all, $con)) { $blog_entry = $blog_entry . "<div class='blog_entry'> <div class='blog_title'>{$row['title']}</div><!-- end title --> <div class='blog_date_time'>{$row['date']} <font style='color:#abf7fb'>/</font> {$row['time']} <font style='color:#abf7fb'>/</font> Posted by: <a href='mailto:schultza6537@my.uwstout.edu'>Alex</a></div><!-- end date time --> <div class='blog_mess'><p>{$row['body']}</p> </div> <!-- end blog body --> <div class='blog_bottom'></div><!-- end blog bottom --> </div><!-- end entry -->"; } ?> <?php here are the links to the 2 sites (same exact code - but one site works and one doesnt) http://www.mikespot.net/alex/ - this displays blog entries correctly http://www.ijournalsometimes.com - this one does not thank you in advance for your help! Mike
  5. Hi everybody, I would like to show a total dollar amount to customers with 2 decimal places, my php code is rendering things like this: $19.4 when I want it to show something like this: $19.40 - so basically just need to know how to extend it to 2 decimal places. Its probably pretty simple but i have been unsuccessful in my findings! Thanks! Mike
  6. all of the code below the header does in fact work. ive used the shopping cart with paypal sandbox and live on paypal and it works exactly the same as before I put the header function code in. Its doing what i want it to do, so im glad it works, but im just confused because i thought for sure if I put the header code in there it wouldnt work - but it did. now im curious as to why.
  7. Here is my question: Since the php engine reads code from top to bottom, why does the code below the header redirect continue to process once it has navigated away from the page? Here is my code: <?php require_once '../functions/functions.php'; header('Location: http://www.mikespot.net/PaypalShoppingCart/html/viewCart.php'); $shopping_cart = get_shopping_cart(); echo render_header(); $product_id = $_REQUEST['id']; if (product_exists($product_id)) $shopping_cart->AddItem($product_id); set_shopping_cart($shopping_cart); echo render_paypal_checkout($shopping_cart); echo render_footer(); END OF CODE ----------------------------------------------------------------------------------------- Thanks, Mike
  8. Ben - thanks for the reply. How would I go about doing that? Sorry, Im still new to the game!
  9. I noticed that it only adds more items when the browser is refreshed right after an item is added to the cart because the browser's url text area says "...addToCart.php?id=TOMATOSOUP" so I believe its adding it because of that 'id=TOMATOSOUP' because when i click 'view cart' and the url is just "...addToCart.php" and I refresh the browser it does not add additional items to the cart. Just thought id post a little more to make it easier for help. thanks guys! Mike
  10. Hi everybody, I was able to complete the php shopping cart tutorial by Jon Lebensold with no problems, however, I do notice that after you add an item to your shopping cart - if you refresh the browser - it adds the item again. and if you refresh a 2nd, 3rd, or 4th time it keeps adding items to your shopping cart. Is there any way to stop it from adding items to your shopping cart when the page is refreshed? Here is a link to the finished shopping cart: http://www.mikespot.net/PaypalShoppingCart/html/index.php Thank in advance for help. Mike Bostone
  • Create New...