Jump to content

scuttzz

Members
  • Posts

    17
  • Joined

  • Last visited

Everything posted by scuttzz

  1. The project says that all the blog must be hosted under the same domain, so yes I believe that they are in the same location I can make a CMS for each of them. That's no problem whats so ever. My question is: Is there an easier more logical way of going about it with out complex queries and settings for each blog. My php level is fairly alright, I'm so far from being a Pro but I'm working towards such things. Thanks for the reply's.
  2. Good day, I have a task at hand, I was given an project where I need to combine 3 blogs into on site. I understand the simplistic answer to this but the doing is a bit confusing at this point and would like to get some input from a community. Is there software I can use for this, except for wordpress? Or is it best to design and develop each cms for each blog into a main CMS page. MAIN CMS PAGE -> Blog 1, blog 2, blog 3 and then settings for each blogs and add/edit and delete pages etc. The second problem is that I have briefly dealt with themes before and have found them to be a pain when it comes to trying to select a theme from a list of 3. I got fairly tilted results as some elements confused each other.. Is this fairly normal? Does php have a weakness towards themes? Any software suggestions and guidance would be so appreciated. Thanks in advance
  3. hey all, I've finally took a leap towards the brighter side of coding.. and Ive started to convert my code from php to opp pdo ect.. However the errors Ive been through my cms's and well anything to do with inserting into a database is rather confusing.. ERRORS such as invalid parameter number,. What does this mean? Here's the code that im getting the error from: <?php //if form has been submitted process it if(isset($_POST['submit'])){ $_POST = array_map( 'stripslashes', $_POST ); //collect form data extract($_POST); //very basic validation if($title ==''){ $error[] = 'Please enter the title.'; } if($short_desc ==''){ $error[] = 'Please enter a short description.'; } if($full_desc ==''){ $error[] = 'Please enter a full description.'; } if(!isset($error)){ try { //insert into database $stmt = $handler->prepare('INSERT INTO calendar_event (title,short_desc,full_desc,date) VALUES (:title, :short_desc, :full_desc, :date)') ; $stmt->execute(array( ':title' => $title, ':short_desc' => $short_desc, ':ful_desc' => $full_desc, ':date' => date('Y-m-d') )); //redirect to index page header('Location: index.php?action=added'); exit; } catch(PDOException $e) { echo $e->getMessage(); } } } //check for any errors if(isset($error)){ foreach($error as $error){ echo '<p class="error">'.$error.'</p>'; } } ?> <form action='' method='post'> <table class="admin_table_defaults"> <tr> <th width="10px">Title</th> <th width="200px">Date</th> <th width="200px"> </th> <th></th> </tr> <tr> <td><input type='text' name='title' value='<?php if(isset($error)){ echo $_POST['title'];}?>'></td> <td><input type='date' name='date' value='<?php if(isset($error)){ echo $_POST['date'];}?>'></td> <td><td> </tr> </table> <table class="admin_table_defaults"> <tr> <th style="text-align:left;"> Short Description <span class="small_text"> : NB - Please avoid using images, align properties, stick to text format. <br/><b style="background:#fff;font-size:14px;">Note : There's a character max of 100 characters for this field</b></span></th> </tr> <tr> <td><textarea name='short_desc' cols='60' rows='10' ><?php if(isset($error)){ echo $_POST['short_desc'];}?></textarea></td> </tr> <tr> </table> <table class="admin_table_defaults"> <tr> <th style="text-align:left;"> Full Description: <span class="small_text"></th> </tr> <tr> <td><textarea name='full_desc' cols='60' rows='10'><?php if(isset($error)){ echo $_POST['full_desc'];}?></textarea></td> </tr> <tr> <td><input class="admin_submit_btn"type='submit' name='submit' value='Submit'></td> </tr> <tr> </table> </tr> </table> </form> Any help will be greatly appreciated Thanks in advance..
  4. Thank you very much for the sharp eyes.. It works now..
  5. hi all, Firstly I am new to the php language, hopefully this is not a silly question or a no brainer. I have looked over my code.. and for some reason when I insert data from a cms into a mySql database thers two fields that swop around.. HERES THE CODE IM WORKING WITH : <?php //if form has been submitted process it if(isset($_POST['submit'])){ $_POST = array_map( 'stripslashes', $_POST ); //collect form data extract($_POST); //very basic validation if($title ==''){ $error[] = 'Please enter the title.'; } if(!isset($error)){ try { //insert into database $stmt = $handler->prepare('INSERT INTO event_calendar (title,event_date,description) VALUES (:title, :description, :event_date)') ; $stmt->execute(array( ':title' => $title, ':description' => $description, ':event_date' => date('Y-m-d') )); //redirect to index page header('Location: index.php?action=added'); exit; } catch(PDOException $e) { echo $e->getMessage(); } } } //check for any errors if(isset($error)){ foreach($error as $error){ echo '<p class="error">'.$error.'</p>'; } } ?> <form action='' method='post'> <p><label>Title</label> <input type='text' name='title' value='<?php if(isset($error)){ echo $_POST['title'];}?>'></p> <p><label>Description</label><br /> <textarea name='description' cols='50' rows='5'><?php if(isset($error)){ echo $_POST['description'];}?></textarea></p> <p><label>Date of Event : (y-m-d) :</label><input name="event_date" type="date" value='<?php if(isset($error)){ echo $_POST['event_date'];}?>'></p> <p><input type='submit' name='submit' value='Submit'></p> </form> Could anyone please just look through it.. My database structure is simple.. id, title, description, event_date Thanks in advance
  6. Hi all, Im a bit new to this forum so sorry if I ask rather silly questions.. Anyways I got given a project with entails making a simple php calendar, with hover effects to show the daily events ect.. I would use the source I was given but its making nearly no sense to me at this point.. Anyone know of a tutorial or vid I could read/watch to get a grip of what is needed.. Or maybe a snippet and/or advice how to tackle it Thanks in advance
  7. hi, First off this cart mentioned below is for a online cart and works perfectly on a local server such as xammp, how ever when i up load it to a live server it all the variables in the cart out throws errors. Has anyone encounter this problem? Heres my code for the cart render: <?php $cartOutput = ""; $cartTotal = ""; $pp_checkout_btn = ''; $product_id_array = ''; if (!isset($_SESSION["cart_array"]) || count($_SESSION["cart_array"]) < 1) { $cartOutput = "<h2 align='center'>Your shopping cart is empty</h2>"; } else { // Start PayPal Checkout Button $pp_checkout_btn .= '<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_cart"> <input type="hidden" name="upload" value="1"> <input type="hidden" name="business" value="you@youremail.com">'; // Start the For Each loop $i = 0; foreach ($_SESSION["cart_array"] as $each_item) { $item_id = $each_item['item_id']; $sql = mysql_query("SELECT * FROM products WHERE id='$item_id' LIMIT 1"); while ($row = mysql_fetch_array($sql)) { $product_name = $row["product_name"]; $price = $row["price"]; } $pricetotal = $price * $each_item['quantity']; $cartTotal = $pricetotal + $cartTotal; $pricetotal = $pricetotal; // Dynamic Checkout Btn Assembly $x = $i + 1; $pp_checkout_btn .= '<input type="hidden" name="item_name_' . $x . '" value="' . $product_name . '"> <input type="hidden" name="amount_' . $x . '" value="' . $price . '"> <input type="hidden" name="quantity_' . $x . '" value="' . $each_item['quantity'] . '"> '; // Create the product array variable $product_id_array .= "$item_id-".$each_item['quantity'].","; // Dynamic table row assembly $cartOutput .= ' <div style="width:46%;border:1px solid #99FFFF;background:#99FFFF;float:left;margin-top:10px;margin-left:9px;margin-right:5px;border-radius:10px;padding:5px;"> <div style="float:left;width:90%;font:bold 16px Arial;">' . $product_name . '</div> <div style="float:left;width:5%;font:bold 16px Arial;float:right;"> <form action="cart.php" method="post"><input style="border:none;background:none;font-size:15px;" name="deleteBtn' . $item_id . '" type="submit" value="X" /><input name="index_to_remove" type="hidden" value="' . $i . '" /></form> </div> <h4 style="margin-top:5px;"><u>Purchase Details</u></h4> <table style="margin-top:5px;width:90%;"> <tr> <td width="40%">Unit Price: </td> <td>R' . $price . '</td> </tr> <tr> <td width:60%;height:20px;border:1px solid black;>Quantity</td> <td> <form action="cart.php" method="post"> <input name="quantity" type="text" value="' . $each_item['quantity'] . '" size="1" maxlength="2" /> <input name="adjustBtn' . $item_id . '" type="submit" value="change" /> <input name="item_to_adjust" type="hidden" value="' . $item_id . '" /> </form> </td> </tr> <tr> <td width:60%;height:20px;border:1px solid black;>Total</td> <td>R' . $pricetotal . '</td> </tr> </table> </div> '; $i++; } $cartTotal = $cartTotal; // Finish the Paypal Checkout Btn $pp_checkout_btn .= '<input type="hidden" name="custom" value="' . $product_id_array . '"> <input type="hidden" name="notify_url" value="https://www.yoursite.com/storescripts/my_ipn.php"> <input type="hidden" name="return" value="https://www.yoursite.com/checkout_complete.php"> <input type="hidden" name="rm" value="2"> <input type="hidden" name="cbt" value="Return to The Store"> <input type="hidden" name="cancel_return" value="https://www.yoursite.com/paypal_cancel.php"> <input type="hidden" name="lc" value="US"> <input type="hidden" name="currency_code" value="USD"> <input type="image" src="http://www.paypal.com/en_US/i/btn/x-click-but01.gif" name="submit" alt="Make payments with PayPal - its fast, free and secure!"> </form>'; }?> This script obviously contains a paypal check out system so ignore it if it makes it easier.. Thanks in advance
  8. reason for inline styling is becasue when i uploaded it to a live server it didnt pick up on the class for some strange reason.. the original cart was done in oop and that didnt work either.. very strange, that nothing really worked... hmmm.. Okay changed the code to the above.. Im getting these two errors now: Notice: Undefined index: cart_array in line 102 Warning: Invalid argument supplied for foreach() line 102 This is the line with the error : foreach ($_SESSION["cart_array"] as $each_item) {
  9. Hi all, So first off i would like to say this is my first shopping cart in the making. Ive been playing around with a few ways to build one and choose a rather simple way to make it all work.. How ever Im getting the dreaded undefined var error in a few places of my code.. If anyone wouldnt mind reading through my code.. And just btw this specific render is for a mini cart display and not the main cart before the check out. <?php //RENDERING CART % Display Settings $cartOutput = ""; $cartTotal = ""; $pp_checkout_btn = ''; $product_id_array = ''; if (!isset($_SESSION["cart_array"]) || count($_SESSION["cart_array"]) < 1) { $cartOutput = "<h2 align='center'>Your shopping cart is empty</h2>"; } else { // Start PayPal Checkout Button $pp_checkout_btn .= '<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_cart"> <input type="hidden" name="upload" value="1"> <input type="hidden" name="business" value="you@youremail.com">'; // Start the For Each loop $i = 0; foreach ($_SESSION["cart_array"] as $each_item) { $item_id = $each_item['item_id']; $sql = mysql_query("SELECT * FROM products WHERE id='$item_id' LIMIT 1"); while ($row = mysql_fetch_array($sql)) { $product_name = $row["product_name"]; } // Dynamic Checkout Btn Assembly $x = $i + 1; $pp_checkout_btn .= '<input type="hidden" name="item_name_' . $x . '" value="' . $product_name . '"> //ERROR HERE FOR PRODUCT NAME <input type="hidden" name="amount_' . $x . '" value="' . $price . '"> //ERROR HERE WITH PRICE VAR <input type="hidden" name="quantity_' . $x . '" value="' . $each_item['quantity'] . '"> '; // Create the product array variable $product_id_array .= "$item_id-".$each_item['quantity'].","; // Dynamic table row assembly $cartOutput .= '<div style="float:left;width:89%"> <form action="view_cart.php" method="post"> <input name="quantity" type="text" value="' . $each_item['quantity'] . '" size="1" maxlength="2" /> <input name="adjustBtn' . $item_id . '" type="submit" value="change" /> <input name="item_to_adjust" type="hidden" value="' . $item_id . '" /> </form> X <span>' . $product_name . '</span> //ERROR HERE FOR PRODCT NAME VAR </div> <div style="float:right;width:10%;text-align:center;"> <form action="cart.php" method="post"><input name="deleteBtn' . $item_id . '" type="submit" value="X" /><input name="index_to_remove" type="hidden" value="' . $i . '" /></form> </div> '; $i++; } // Finish the Paypal Checkout Btn $pp_checkout_btn .= '<input type="hidden" name="custom" value="' . $product_id_array . '"> <input type="hidden" name="notify_url" value="https://www.yoursite.com/storescripts/my_ipn.php"> <input type="hidden" name="return" value="https://www.yoursite.com/checkout_complete.php"> <input type="hidden" name="rm" value="2"> <input type="hidden" name="cbt" value="Return to The Store"> <input type="hidden" name="cancel_return" value="https://www.yoursite.com/paypal_cancel.php"> <input type="hidden" name="lc" value="US"> <input type="hidden" name="currency_code" value="USD"> <input type="image" src="http://www.paypal.com/en_US/i/btn/x-click-but01.gif" name="submit" alt="Make payments with PayPal - its fast, free and secure!"> </form>'; } ?> Ive commented the lines that hold errors, i have checked the var list, just really doesnt make much sense to me. Any help would be appreciated.. Thanks in advance.
  10. Hi all Im run across an error that i cant figure out a solution to.. I get this error "Warning: Illegal string offset 'quantity' when I try echo the value for quantity. This is obviously for a online cart.. <div class="cartWrapper"> <?php if(isset($_POST['submit'])){ foreach ($_POST['quantity'] as $key => $value){ if($val==0){ unset($_SESSION['cart'][$key]); }else{ $_SESSION['cart'][$key]['quantity']=$val; } } } ?> <table class="cartTable"> <tr style="text-align:left;"> <th width="20%">Product Name</th> <th width="10%">Quantity</th> <th width="15%">Unit Price</th> <th width="20%">Total</th> </tr> <?php $sql = "SELECT * FROM products WHERE id IN("; foreach ($_SESSION['cart'] as $id => $value){ $sql.=$id.","; } $sql=substr($sql, 0, -1). ") ORDER BY product_name ASC"; $query=mysql_query($sql); $totalprice=0; while($row=mysql_fetch_array($query)){ $subtotal=$_SESSION['cart'][$row['id']]['quantity']*$row['price']; $totalprice+=$subtotal; ?> <tr> <td><?php echo $row['product_name'];?></td> <td><?php echo $row['id']['quantity']?></td> //ERROR IN THIS LINE <td>R<?php echo $row['price'];?></td> <td>R<?php echo $_SESSION['cart'] [$row['id']]['quantity']* $row['price'];?></td> </tr> <?php } ?> <tr> <td>Cart Total : <?php echo $totalprice; ?> </tr> </table> <br/> <button type="submit" name="submit">Update Cart</button> </div> Have I made an error somewhere that I haven't seen. Thanks in advance
  11. Have you thought about instead of hiding the form replace it with text that says something like logged in(as this may be unclear to the user) or a unordered list with user accounts settings and logout links ect.. This can be easily achieve by making a global function for the logged in session, something along the lines of this function logged_in() { return (isset($_SESSION['user_id'])) ? true : false; } I personally make the login form within a include php file, and then within that file I reference to files, loggedin.php(holds the div that has user settings and logout functionality) and login.php that obviously holds the login form and other php scripts for the login itself. The file that will hold all those included files is normally the same that checks the session. Ill give an example using the logged_in function included.. <div class="login"> <?php if (logged_in() == true) { include 'includes/loggedin.php'; } else { include 'includes/login_form.php'; } ?> </div> This is a very simple example so excuse me if its very roughly drafted. Hope this helps
  12. The format is also separated by comma's, the first table has 3 headings (Typical nutritional values, per 100g, per 20g serving ), and the information within it is numbers and a few letters.. How ever for this specific row theres a total of 3 tables, but im sure that when i've figured out out to import the one the rest are simple. Thanks for the article ill give it a read... And to do with the format, its was originally a excel(.xls) file that I converted into a CSV through excel 2007. Does that answer all your questions?
  13. Hi all, I have a little bit of a problem that I've been trying to solve for days now. Wonder if anyone could help. I have a table(named 'products') within this table the headers are as follows id, product_name,price, long_desc, short_desc, date_added, product_spec, directions, nut_info. I have a CSV file with colums ranging from 2 columns to 4, so a total of 3 tables.. Is there a way to import them to only the nut_info column in my Mysql table? Thanks in advance
  14. Understandable, so ill only store information in the database, and call it where see fit. think im going to change my thoughts with this one, as getting a link to change depending on the image id and to make it link to a external page is a little out of my understanding at this point. Ill just store more information on the database and call it on the products.php? page. sorry for wasting your time.
  15. Yes that's the jist of it.. The database has no information about the image in it, its just a table with 2 columns (id, image). I've created pages for each image that are not connected to the database itself. Do you think it would be a better option to add information to the database and not show it, and when the user chicks the link have the page change to the one with all the information instead? The reason why I'm going this route is the information about the image is rather long with jquery tabs involved.
  16. Hi all, Need some guide line, im outputing images from a databse on a page, ive gotten to the point that the images show as i want them to however Im putting a link under each image. so my question is, is there a way to have a image link change depending on the image id, but that page that it points to is a separate page that is not connected to a database. The thought process is as follows: admin uploades the image => image shows in a page with a link =>User clicks the link and it directs them to a page(example www.mysite.com/image_information/image1.php) again the links p[age is completely seperate, the image has an id. Heres the code id have so far PHP: $uploadedImage = ""; $sql = mysql_query("SELECT * FROM products"); $imageCount = mysql_num_rows($sql); // count the output amount if ($imageCount > 0) { while($row = mysql_fetch_array($sql)){ $id = $row["id"]; $date_added = strftime("%b %d, %Y", strtotime($row["date_added"])); $dynamicList .= ' <div class="itemWrapper"> <a id="inventoryImage" href="product.php?id =' . $id .'"><img src="uploaded_images/' . $id . '.jpg"></a> <div id="imageInfo"> <ul border="1"> <li><span>Date Added : ' . $date_added . '</span></li> <li><a href="">Read more about this image</a></li> </ul> </div> <div class="clear"></div> </div> '; } } else { uploadedImage = "We have no images uploaded yet"; }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.