Jump to content

zeusthegreat

Member
  • Posts

    86
  • Joined

  • Last visited

Everything posted by zeusthegreat

  1. I have sorted the price showing but the below is an error for the date_added ( ! ) Notice: Undefined index: date_added in C:\wamp\www\myNewweb\storeadmin\inventory_list.php on line 63 this is what error the browser returns Call Stack # Time Memory Function Location 1 0.0026 400776 {main}( ) ..\inventory_list.php:0 the date returns but it is wrong
  2. $product_list .= "$id-$product_name - $price - $date_added <a href='#'>edit</a> •<a href='#'> delete</a><br/>"; ( ! ) Notice: Undefined index: date_added in C:\wamp\www\myNewweb\storeadmin\inventory_list.php on line 62 Call Stack # Time Memory Function Location 1 0.0008 401312 {main}( ) ..\inventory_list.php:0 Home Web Design Web Development E Commerce Pricing Web Design Graphic Design Pay Monthly Pricing Template Contact +Add New Inventory Item Inventory List 9-hat - 10 - Jan 01, 1970 edit • delete but there is still an error am i going of track. it returns the date (the date is wrong though) --------------------------------------------------------------------------------
  3. well everything was going sweet until i typed $date_added = strftime("%b %d, %Y", strtotime($row["date_added"])); then it returned below ( ! ) Notice: Undefined variable: date_added in C:\wamp\www\myNewweb\storeadmin\inventory_list.php on line 61 Call Stack # Time Memory Function Location 1 0.0023 399928 {main}( ) ..\inventory_list.php:0 what code do i have to put on what line as basically all was going fine until i typed the above on line 61 <?php session_start(); if(!isset($_SESSION["manager"])){ header("location: admin_login.php"); exit(); } // Be sure to check that this manager SESSION value is in fact in the database $managerID = preg_replace('#[^0-9]#i','', $_SESSION["id"]); //filter everyhting but numbers and letters $manager = preg_replace('#[^A-Za-z0-9]#i','', $_SESSION["manager"]); //filter everything but numbers and letters $password = preg_replace('#[^A-Za-z0-9]#i','', $_SESSION["password"]); //filter everything but numbers and letters //Run mySQL query to be sure that this person is an admin and that their password session varequals the database information //Connect to the MySQL database include "../storescripts/connect_to_mysql.php"; $sql= mysql_query("SELECT * FROM admin WHERE id= '$managerID' AND username= '$manager' AND password= '$password' LIMIT 1"); //query the person --make sure person exists in database---- $existCount= mysql_num_rows($sql); //count the row nums if($existCount == 0){ //evaluate the count header("location: ../index.php"); exit(); } ?> <?php //error reporting error_reporting(E_ALL); ini_set('Display_errors', '1'); ?> <?php //parse the form data and add inventory item to the system if (isset($_POST['Product_name'])){ $product_name = mysql_real_escape_string($_POST['product_name']); $price = mysql_real_escape_string($_POST['price']); $category = mysql_real_escape_string($_POST['category']); $subcategory = mysql_real_escape_string($_POST['subcategory']); $details = mysql_real_escape_string($_POST['details']); //see if that product name is an identical match to another product in the system $sql = mysql_query("SELECT id FROM Products WHERE product_name='$product_name' LIMIT 1"); $productMatch = mysql_num_rows ($sql); //count the output ammount if ($productMatch > 0){ echo 'Sorry you tried to place a duplicate "Product Name" into the system, <a href="inventory_list.php">click here</a>'; exit(); } //Add this product into the database now $sql = mysql_query("INSERT INTO products (product_name, Price, details, category, subcategory, date_added) VALUES('$product_name','$price','$details','$category','$subcategory',now())") or die (mysql_error()); //now adds todays date $id = mysql_insert_id(); //place image in the folder $newname = "$pid.jpg"; move_uploaded_file($_FILES['filefield']['tmp_name'], "../inventory_images/$newname"); } ?> <?php //This block grabs the whole list for viewing $product_list = ""; $sql = mysql_query("SELECT * FROM products"); $productCount = mysql_num_rows($sql);//count the the output ammount if ($productCount > 0){ while($row = mysql_fetch_array($sql)){ $id = $row["id"]; $product_name = $row["product_name"]; $date_added = strftime("%b %d, %Y", strtotime($date_added)); $product_list .= "$id-$product_name <a href='#'>edit</a> •<a href='#'> delete</a><br/>"; } }else{ $product_list = "You have no products listed in your store Yet"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Inventory list</title> <link rel="stylesheet" href="../style/style.css" type="text/css" media="screen" /> <style type="text/css"> body { background-color: #FFF; } </style> </head> <body> <div align="center"></div> <div align="center" id="mainWrapper"> <?php include_once("../template_header.php"); ?> <?php include_once("../template_sidebar.php"); ?> <div align="left" id="pageContent"> <div align="right" style="margin-right:32px"><a href="inventory_list.php#inventoryForm">+Add New Inventory Item</a></div> <div align="left" style="margin-left:24px;"> <h2>Inventory List</h2> <?php echo $product_list; ?> </div> <hr /> <div> <a name="inventoryForm" id="inventoryForm"></a> <h3 align="center"> ↓ Add New Inventory Item Form ↓ </h3> </div> <form action="inventory_list.php" enctype="multipart/form-data" name="myForm" id="myform" method="post"> <table width="90%" border="0" cellspacing="0" cellpadding="6"> <tr> <td width="20%" align="right">Product Name</td> <td width="80%"><label> <input name="product_name" type="text" id="product_name" size="64" /> </label></td> </tr> <tr> <td align="right">Product Price</td> <td><label> £ <input name="price" type="text" id="price" size="12" /> </label></td> </tr> <tr> <td align="right">Category</td> <td><label> <select name="category" id="category"> <option value="Clothing">Clothing</option> </select> </label></td> </tr> <tr> <td align="right">Subcategory</td> <td><select name="subcategory" id="subcategory"> <option value=""></option> <option value="Hats">Hats</option> <option value="Pants">Pants</option> <option value="Shirts">Shirts</option> </select></td> </tr> <tr> <td align="right">Product Details</td> <td><label> <textarea name="details" id="details" cols="64" rows="5"></textarea> </label></td> </tr> <tr> <td align="right">Product Image</td> <td><label> <input type="file" name="fileField" id="fileField" /> </label></td> </tr> <tr> <td> </td> <td><label> <input type="submit" name="button" id="button" value="Add This Item Now" /> </label></td> </tr> </table> </form> <br/> <br/> </div> <?php include_once("../template_footer.php"); ?> </div> </body> </html> i am struggling to know what to type and where and as for the $price i thought i had done that also. where have i failed with price i have tryed this but still an error ?php //This block grabs the whole list for viewing $product_list = ""; $sql = mysql_query("SELECT * FROM products"); $productCount = mysql_num_rows($sql);//count the the output ammount if ($productCount > 0){ while($row = mysql_fetch_array($sql)){ $id = $row["id"]; $price = $row["price"]; $product_name = $row["product_name"]; $date_added = strftime("%b %d, %Y", strtotime($row["date_added"])); $product_list .= "$id-$product_name <a href='#'>edit</a> •<a href='#'> delete</a><br/>"; } }else{ $product_list = "You have no products listed in your store Yet"; } ?> ( ! ) Notice: Undefined index: date_added in C:\wamp\www\myNewweb\storeadmin\inventory_list.php on line 62 Call Stack # Time Memory Function Location 1 0.0026 400360 {main}( ) ..\inventory_list.php:0
  4. messed around with it for a while but still getting Notice: Undefined index: date_added in C:\wamp\www\myNewweb\storeadmin\inventory_list.php on line 65 Call Stack # Time Memory Function Location 1 0.0015 399112 {main}( ) ..\inventory_list.php:0
  5. inventory.php ?php session_start(); if(!isset($_SESSION["manager"])){ header("location: admin_login.php"); exit(); } // Be sure to check that this manager SESSION value is in fact in the database $managerID = preg_replace('#[^0-9]#i','', $_SESSION["id"]); //filter everyhting but numbers and letters $manager = preg_replace('#[^A-Za-z0-9]#i','', $_SESSION["manager"]); //filter everything but numbers and letters $password = preg_replace('#[^A-Za-z0-9]#i','', $_SESSION["password"]); //filter everything but numbers and letters //Run mySQL query to be sure that this person is an admin and that their password session varequals the database information //Connect to the MySQL database include "../storescripts/connect_to_mysql.php"; $sql= mysql_query("SELECT * FROM admin WHERE id= '$managerID' AND username= '$manager' AND password= '$password' LIMIT 1"); //query the person --make sure person exists in database---- $existCount= mysql_num_rows($sql); //count the row nums if($existCount == 0){ //evaluate the count header("location: ../index.php"); exit(); } ?> <?php //Error reporting show errors in your scripts error_reporting(E_ALL); ini_set('display_errors', '1'); ?> <?php // Parse the form data and add inventory item to the system if (isset($_POST['product_name'])) { $product_name = mysql_real_escape_string($_POST['product_name']); $price = mysql_real_escape_string($_POST['price']); $category = mysql_real_escape_string($_POST['category']); $subcategory = mysql_real_escape_string($_POST['subcategory']); $details = mysql_real_escape_string($_POST['details']); // See if that product name is an identical match to another product in the system $sql = mysql_query("SELECT id FROM products WHERE product_name='$product_name' LIMIT 1"); $productMatch = mysql_num_rows($sql); // count the output amount if ($productMatch > 0) { echo 'Sorry you tried to place a duplicate "Product Name" into the system, <a href="inventory_list.php">click here</a>'; exit(); } // Add this product into the database now $sql = mysql_query("INSERT INTO products (product_name, price, details, category, subcategory, date_added) VALUES('$product_name','$price','$details','$category','$subcategory',now())") or die (mysql_error()); //now adds todays date to whatever you are doing $pid = mysql_insert_id(); // Place image in the folder $newname = "$pid.jpg"; move_uploaded_file( $_FILES['fileField']['tmp_name'], "../inventory_images/$newname"); header("location: inventory_list.php"); exit(); } ?> <?php //This block grabs the whole list for viewing $product_list = ""; $sql = mysql_query("SELECT * FROM products"); $productCount = mysql_num_rows($sql); //count the output ammount if ($productCount > 0){ while($row =mysql_fetch_array($sql)){//loops will interate over an array of data $id = $row["id"]; $product_name = $row["product_name"]; $product_list .= "Product ID: $id - <strong>$product_name</strong> - $$price - <em>Added $date_added</em> <a href='inventory_edit.php?pid=$id'>edit</a> • <a href='inventory_list.php?deleteid=$id'>delete</a><br />"; } }else{ $product_list = "You have no products listed in your store yet"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Inventory list</title> <link rel="stylesheet" href="../style/style.css" type="text/css" media="screen" /> </head> <body> <div align="center"></div> <div align="center" id="mainWrapper"> <?php include_once("../template_header.php"); ?> <?php include_once("../template_sidebar.php"); ?> <div align="left" id="pageContent"><br /> <div align="right" style="margin-right:32px;"><a href="inventory_list.php#inventoryForm">+Add New inventory Item</a></div> <div align="left" style="margin-left:24px;"> <h2>Inventory list</h2> <?php echo $product_list; ?> </div> <hr /> <a name="inventoryForm" id="inventoryForm"></a> <h3 align="center"> ↓ Add New Inventory Item Form ↓ <a name="inventoryForm" id="inventoryForm"></a> </h3> <form action="inventory_list.php" enctype="multipart/form-data" name="myForm" id="myform" method="post"> <table width="90%" border="0" cellspacing="0" cellpadding="6"> <tr> <td width="20%" align="right">Product Name</td> <td width="80%"><label> black hat </label></td> </tr> <tr> <td align="right">Product Price</td> <td><label> £ 20 </label></td> </tr> <tr> <td align="right">Category</td> <td><label> <select name="category" id="category"> <option value="Clothing">Clothing</option> <option value="Electronics">Electronics</option> </select> </label></td> </tr> <tr> <td align="right">Subcategory</td> <td><select name="subcategory" id="subcategory"> <option value=""></option> <option value="Hats">Hats</option> <option value="Pants">Pants</option> <option value="Shirts">Shirts</option> </select></td> </tr> <tr> <td align="right">Product Details</td> <td><label> <textarea name="details" id="details" cols="64" rows="5"></textarea> </label></td> </tr> <tr> <td align="right">Product Image</td> <td><label> <input type="file" name="fileField" id="fileField" /> </label></td> </tr> <tr> <td> </td> <td><label> <input type="submit" name="button" id="button" value="Add This Item Now" /> </label></td> </tr> </table> </form> </div> <?php include_once("../template_footer.php"); ?> </div> </body> </html> have loaded in an item just to see if it works and after imputting in all the fields and submitting this error shows ! ) Notice: Undefined variable: price in C:\wamp\www\myNewweb\storeadmin\inventory_list.php on line 64 Call Stack # Time Memory Function Location 1 0.0024 397104 {main}( ) ..\inventory_list.php:0 ( ! ) Notice: Undefined variable: date_added in C:\wamp\www\myNewweb\storeadmin\inventory_list.php on line 64 Call Stack # Time Memory Function Location 1 0.0024 397104 {main}( ) ..\inventory_list.php:0 I have no idea does it mean that it does not recognize the price the date added i thought this came from a server anyway! am i on the right track!
  6. thanks ben that was it i could not see!
  7. "SELECT id FROM admin WHERE username= '$manager' AND $password= '$password' LIMIT 1") admin_login.php index.php SELECT * FROM admin WHERE id= '$managerID' AND username= '$manager' AND password= '$password' LIMIT 1" sorry for this ben but i seem to be following what you say but with no luck!
  8. Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\wamp\www\myNewweb\storeadmin\admin_login.php on line 18 Call Stack # Time Memory Function Location 1 0.0008 380400 {main}( ) ..\admin_login.php:0 2 0.0143 387880 mysql_num_rows ( ) ..\admin_login.php:18
  9. "SELECT * FROM admin WHERE id = '$managerID 'AND username = '$manager' AND password = '$password' LIMIT 1"); for the index page "SELECT id FROM admin WHERE username = '$manager 'AND $password = '$password' LIMIT 1"); the above is for the login page stll no joy Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\wamp\www\myNewweb\storeadmin\admin_login.php on line 18
  10. but when i log in the admin name and password i get ( ! ) Notice: Undefined variable: passord in C:\wamp\www\myNewweb\storeadmin\admin_login.php on line 17 Call Stack # Time Memory Function Location 1 0.0007 380416 {main}( ) ..\admin_login.php:0 ( ! ) Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\wamp\www\myNewweb\storeadmin\admin_login.php on line 18 Call Stack # Time Memory Function Location 1 0.0007 380416 {main}( ) ..\admin_login.php:0 2 0.0188 388200 mysql_num_rows ( ) ..\admin_login.php:18 That information is incorrect. try againClick Here what i notice straight away is the name passord instead of password resolved the password issue but still have ! ) Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\wamp\www\myNewweb\storeadmin\admin_login.php on line 18 Call Stack does it have a problem with while($row = mysql_fetch_array($sql)){ as i cannot see anything else
  11. I have an admin index page index.php <?php session_start(); if(!isset($_SESSION["manager"])){ header("location: admin_login.php"); exit(); } // Be sure to check that this manager SESSION value is in fact in the database $managerID = preg_replace('#[^0-9]#i',"",$_SESSION["id"]); //filter everyhting but numbers and letters $manager = preg_replace('#[^A_Za-z0-9]#i',"",$_SESSION["manager"]); //filter everything but numbers and letters $password = preg_replace('#[^A_Za-z0-9]#i',"",$_SESSION["password"]); //filter everything but numbers and letters //Run mySQL query to be sure that this person is an admin and that their password session varequals the database information //Connect to the MySQL database include "../storescripts/connect_to_mysql.php"; $sql= mysql_query("SELECT * FROM admin WHERE id='$managerID'AND username='$manager' AND password='$password' LIMIT 1"); //query the person --make sure person exists in database---- $existCount= mysql_num_rows($sql); //count the row nums if($existCount==0){ //evaluate the count header("location: ../index.php"); exit(); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'>http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">'>http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Store Admin Area</title> <link rel="stylesheet" href="../style/style.css" type="text/css" media="screen" /> <style type="text/css"> body { background-color: #FFF; } </style> </head> <body> <div align="center"></div> <div align="center" id="mainWrapper"> <?php include_once("../template_header.php"); ?> <?php include_once("../template_sidebar.php"); ?> <div align="left" id="pageContent"> <div align="left" style="margin-left:24px;"> <p>Hello store manager, what would you like to do today?</p> <p><a href="inventory_list.php">Manage Inventory</a></p> <p><a href="#">Manage Blah Blah</a></p> <p><br> </p> </div> </div> <?php include_once("../template_footer.php"); ?> </div> </body> </html> and an adminlogin page also admin_login.php <?php session_start(); if(!isset($_SESSION["manager"])){ header("location: index.php"); exit(); } ?> <?php // parse the log in form if the user has filled it out and pressed "Log in" if (isset($_POST["username"])&& isset($_POST["password"])){ //remeber 2 double quotes ,"",$_POST["username"] and the same on password line. $manager = preg_replace('#[^A_Za-z0-9]#i',"",$_POST["username"]); //filter everything but numbers and letters $password = preg_replace('#[^A_Za-z0-9]#i',"",$_POST["password"]); //filter everything but numbers and letters //Connect to the MySQL database include "../storescripts/connect_to_mysql.php"; $sql= mysql_query("SELECT id FROM admin WHERE username='$manager'AND $passord='$password' LIMIT 1"); //query the person --make sure person exists in database---- $existCount= mysql_num_rows($sql); //count the row nums if($existCount==1){ //evaluate the count while($row =mysql_fetch_array($sql)){ $id=$row["id"]; } $_SESSION["id"]=$id; $_SESSION["manager"]=$manager; $_SESSION["password"]=$password; header("location: index.php"); exit(); }else{ echo 'That information is incorrect. try again<a href="index.php">Click Here</a>'; exit(); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Admin Log In</title> <link rel="stylesheet" href="../style/style.css" type="text/css" media="screen" /> <style type="text/css"> body { background-color: #FFF; } </style> </head> <body> <div align="center" id="mainWrapper"> <?php include_once("../template_header.php"); ?> <?php include_once("../template_sidebar.php"); ?> <div align="left" id="pageContent"> <div align="left" style="margin-left:24px;"> <h2>Please Log In To Manage the Store</h2> <form id="form1" name="form1" method="post" action="admin_login.php"> User Name:<br /> <input name="username" type="text" id="username" size="40" /> <br /><br /> Password:<br /> <input name="password" type="password" id="password" size="40" /> <br /> <br /> <br /> <input type="submit" name="button" id="button" value="Log In" /> </form> </div> </div> <?php include_once("../template_footer.php"); ?> </div> </body> </html> and the result of my two pages returns Parse error: syntax error, unexpected $end in C:\wamp\www\myNewweb\storeadmin\admin_login.php on line 51
  12. Dreamweaver says there is a problem with line 73 cannot see it i have codeblock, my mind is cabbaged. some one just clear this up for me please thankyou in advance <?php session_start(); if(!isset($_SESSION["manager"])){ header("location: index.php"); exit(); } // parse the log in form if the user has filled it out and pressed "Log in" if (isset($_POST["username"])&& isset($_POST["password"])){ //remeber 2 double quotes ,"",$_POST["username"] and the same on password line. $manager = preg_replace('#[^A_Za-z0-9]#i',"",$_POST["username"]); //filter everything but numbers and letters $password = preg_replace('#[^A_Za-z0-9]#i',"",$_POST["password"]); //filter everything but numbers and letters //Connect to the MySQL database include "../storescripts/connect_to_mysql.php"; $sql= mysql_query("SELECT * FROM admin WHERE id='$manager'AND $passord='$password' LIMIT 1"); //query the person --make sure person exists in database---- $existCount= mysql_num_rows($sql); //count the row nums if($existCount==1){ //evaluate the count while($row =mysql_fetch_array($sql)){ $id=$row["id"]; } $_SESSION["id"]=$id; $_SESSION["manager"]=$manager; $_SESSION["password"]=$password; header("location: index.php"); exit(); }else{ echo 'That information is incorrect. try again<a href="index.php">Click Here</a>'; exit(); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>astore admin area</title> <link rel="stylesheet" href="../sytle/style.css" type="text/css" media="screen" /> <style type="text/css"> a:link { text-decoration: none; } a:visited { text-decoration: none; } a:hover { text-decoration: none; } a:active { text-decoration: none; } </style> </head> <body> <div align="center" id="mainwrapper"> <?php include_once("../template-header.php"); ?> </div> <div id="pagesidebar"> <div align="center">TEST</div> </div> <div id="pagecontent"> <div align="center"> <div align="left" style="margin-left:24px;"> <h2>Hello store manager, what would you like to do today?</h2> <p><a href="inventory_list.php">Manage Inventory</a></p> <p><a href="#">Manage Blah Blah Blah</a></p> </div> TEST</div> </div> <div align="center"> <?php include_once("../template-footer.php"); ?> </div> </div> </body> </html>
  13. but as i am coding i keep getting errors in my page highlightinging the code in red the editor i am using is dreamweaver and the page that i have done 3 times now all with the same results is as follows i have called the page admin_login.php <?php session_start(); if(!isset($_SESSION["manager"])){ header("location: admin_login.php"); exit(); } // Be sure to check that this manager SESSION value is in fact in the database $managerID = preg_replace('#[^0-9]#i',",$_SESSION["id"]); //filter everyhting but numbers and letters $manager = preg_replace('#[^A_Za-z0-9]#i',",$_SESSION["manager"]); //filter everything but numbers and letters $password = preg_replace('#[^A_Za-z0-9]#i',",$_SESSION["password"]); //filter everything but numbers and letters //Run mySQL query to be sure that this person is an admin and that their password session varequals the database information //Connect to the MySQL database include "../storescripts/connect_to_mysql.php"; $sql= mysql_query("SELECT * FROM admin WHERE id='$managerID'AND username='$manager' AND password='$password' LIMIT 1"); //query the person --make sure person exists in database---- $existCount= mysql_num_rows($sql); //count the row nums if($existCount==0){ //evaluate the count header("location: ../index.php); exit(); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>astore admin area</title> <link rel="stylesheet" href="../sytle/style.css" type="text/css" media="screen" /> <style type="text/css"> a:link { text-decoration: none; } a:visited { text-decoration: none; } a:hover { text-decoration: none; } a:active { text-decoration: none; } </style> </head> <body> <div align="center" id="mainwrapper"> <?php include_once("../template-header.php"); ?> </div> <div id="pagesidebar"> <div align="center">TEST</div> </div> <div id="pagecontent"> <div align="center"> <div align="left" style="margin-left:24px;"> <h2>Hello store manager, what would you like to do today?</h2> <p><a href="inventory_list.php">Manage Inventory</a></p> <p><a href="#">Manage Blah Blah Blah</a></p> </div> TEST</div> </div> <div align="center"> <?php include_once("../template-footer.php"); ?> </div> </div> </body> </html>
  14. Something that displays the number of users currently online within the website so visitors can see it too? google
  15. have a website but wish to see how many people are visiting my site just want a simple script could do with a calendar aswell one that goes over a 12 month period thankyou lots of the freebies are crap out there.
  16. zeusthegreat

    lesson 5

    index.php <?php define('APPLICATION_PATH', realpath('../')); $paths = array( APPLICATION_PATH, get_include_path() ); set_include_path(implode(PATH_SEPARATOR, $paths)); function __autoload($className) { $filename = str_replace('\\', '/', $className) . '.php'; require_once $filename; return; } use \com\killerphp\models as models; $User = new models\user(); //echo $User->getName(); $User->setAddress("eiffel Tower"); echo $User->XYZgetAddress(); ?> user.php namespace com\killerphp\models; class User { protected $address; protected $firstName; protected $lastName; protected $email; public function setAddress($address) { $this->address = $address; } public function __call($name, $args) { $methodprefix = substr($name, 0, 3); $methodproperty = substr($name, 4); echo $methodproperty; } } ?> test.php <?php namespace com\killerphp\controllers; class test { public function __construct() { echo "I'm a test class in controllers!"; } } ?> and i return etAddress and what i should return is ddress can not see what i have done wrong, probably something really easy.. have i got to move xyz
  17. zeusthegreat

    video 3

    sussed it what a bifo i am sometimes!!!! thanks anyway
  18. zeusthegreat

    video 3

    i have a folder called killerphp in this folder is a folder called public also in the killerphp folder is a folder called com in the public folder is a file called index.php <?php define('APPLICATION_PATH', realpath('../')); $paths = array( APPLICATION_PATH, get_include_path() ); set_include_path(implode(PATH_SEPARATOR, $paths)); function __autoload($className) { $filename = str_replace('\\', '/', $className) . '.php'; require_once $filename; return; } //use \com\killerphp\models as models; //var_dump(get_include_path()); //require_once ('user.php'); $User = new \com\killerphp\models\User(); echo $User->getName(); ?> in the folder called com i have a folder called killerphp and in the folder called killerphp i have a folder called models and in the folder called models i have a file called user.php <?php namespace com\killerphp\models; class User { public function getName() { return "John smith"; } } ?> am i doing it wrong placing the killerphp folder inside the com folder
  19. zeusthegreat

    video 3

    done that sorry and i return the below error Warning: require_once(com/killerphp/models/User.php) [function.require-once]: failed to open stream: No such file or directory in C:\wamp\www\killerphp\public\video2\video3\index.php on line 15 Fatal error: require_once() [function.require]: Failed opening required 'com/killerphp/models/User.php' (include_path='C:\wamp\www\killerphp\public\video2;C:\wamp\www\killerphp\public\video2/com;.;C:\php5\pear') in C:\wamp\www\killerphp\public\video2\video3\index.php on line 15
  20. zeusthegreat

    video 3

    index .php <?php define('APPLICATION_PATH', realpath('../')); $paths = array( APPLICATION_PATH, APPLICATION_PATH . '/com', get_include_path() ); set_include_path(implode(PATH_SEPARATOR, $paths)); function _autoload($className) { $filename =str_replace('\\', '/' ,$className) . '.php'; require_once $filename; } //use \com\killerphp\models as models; $User = new \com\killerphp\models\User(); echo $User->getName(); User.php (this being the class page) <?php namespace com\killerphp\models; class User { public function getName() { return "John smith"; } } ?> returns from browser Fatal error: Class 'com\killerphp\models\User' not found in C:\wamp\www\killerphp\public\index.php on line 21 this is probably something really easy i hope!!!
  21. what do you mean ben i have tryed below <?php define('APPLICATION_PATH', realpath('../')); $paths = array( APPLICATION_PATH, get_include_path() ); set_include_path(implode(PATH_SEPARATOR, $paths)); function _"autoload($className) { require_once $className . '.php'; return; } //var_dump(get_include_path()); //require_once ('user.php'); $User = new User(); echo $User->getName(); and <?php define('APPLICATION_PATH', realpath('../')); $paths = array( APPLICATION_PATH, get_include_path() ); set_include_path(implode(PATH_SEPARATOR, $paths)); function "_"autoload($className) { require_once $className . '.php'; return; } //var_dump(get_include_path()); //require_once ('user.php'); $User = new User(); echo $User->getName(); error Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting T_STRING or '(' in C:\wamp\www\coedelobster\video2\index.php on line 10 just where has it got to go I think the "autoload" function needs two "_" before the function name, not one: http://php.net/manua...5.autoload.php. Try that and see if it fixes things have had a look on http://uk.php.net/autoload and what i have written looks fine, but i am no expert at all thanks for your help ben do not want to go on until i have mastered everything, and i will not let it beat me, done the lesson twice now with exact same result.
  22. index_auto.php <?php define('APPLICATION_PATH', realpath('../')); $paths = array( APPLICATION_PATH, get_include_path() ); set_include_path(implode(PATH_SEPARATOR, $paths)); function _autoload($className) { require_once $className .'.php'; return; } //var_dump(get_include_path()); //require_once ('user.php'); $User = new User(); echo $User->getName(); class.php<?php class User { public function getName() { return "John smith"; } } ?> methodically went through video and only came across problems towards the end. when i wrote this code and viewed it would not work require_once $className .'.php'; return; it returns from browser Fatal error: Class 'User' not found in C:\wamp\www\coedelobster\video2\index_auto.php on line 19 have no ideas perhaps i have been doing too much and brain scrambled!!!!
  23. thanks ben you are $top_man = ben print ben is a welcome member of the greek gods.... anyway enough of my insanity, thanks alot ben.
×
×
  • Create New...