Jump to content

jigsawsoul

Members
  • Posts

    137
  • Joined

  • Last visited

Everything posted by jigsawsoul

  1. Ah, sorry dude, this doesn't really mean anything to me.. little help lol
  2. Hey Guys I'm not really sure where to start, but i have a number of products within my products table, which all fall under different types of categories. So i have two tables, products and categories which both have a relationship, so I can tell which products below in which categorie. So i want to display a navigation of the categories and how many products are in that categorie. e.g. Apple Laptops (3) Apple Desktops (9) PC Laptops (4) Etc... does anyone have an idea on where to start, or how this would be created. Anything would be a good help.. Thanks. p.s. anymore information needed just ask.. [attachment deleted by admin]
  3. my while loop is only displaying one database result, but i don't see why... any help guys? $result = "SELECT * FROM products LIMIT 0, 4"; $result = mysql_query ($result) or die (mysql_error()); $i=0; while($row = mysql_fetch_assoc($result)) { if($i%2) $divclass = 'otherbox'; else $divclass = 'otherbox MRright'; $products = ' <div class="'.$divclass.'"> <div class="productName">'.$row['title'].'</div> <div class="productDetails"> <div class="smallPic"><img src="_img/products/'.$row['image1'].'" alt="" width="122" height="81" /></div> <div class="smallPicDetails"> <h2>Product Descirption</h2> <p>'.substr($row['description'], 0, 35).'... <a href="product.php?id='.$row['id'].'">read more</a></p> </div> <div class="spayholder"> <a href="#">Add to Cart</a> <p>£ '.$row['price'].'</p> </div> </div> </div> '; $i++; }
  4. Work's perfect and displays all the products, but i need the div class, productDetailsPH to change to productDetailsPH-1 on every other result. to end up with this result, grey background white background grey background white background etc... I'm quite new to php and i'm unsure how i would go about creating something like this, any help guys.. ? $result = "SELECT * FROM products"; $result = mysql_query ($result) or die (mysql_error()); while($row = mysql_fetch_assoc($result)) { $products .= ' <div class="postHoplder"> <div class="productName">'.$row['title'].'</div> <div class="productDetailsPH"> <div class="fltlft"><img src="_img/products/'.$row['image1'].'" alt="" width="122" height="81" /></div> <div class="PicDetailsPH"> <p>'.substr($row['description'], 0, 230).'... <a href="product.php?id='.$row['id'].'">read more</a></p> </div> <div class="payholderPH"> <a href="#">Add to Cart</a> <p>£ '.$row['price'].'</p> </div> </div> </div> '; }
  5. error Parse error: syntax error, unexpected '.' in /home/jigsaws2/public_html/project/resources/_library/template.php on line 7 i've rewritten the code <?php function template ($content) { echo ' '.include($config["paths"]["resources"] . '_template/header.php');.' <div id="header"> <div class="innerwaraper"> '.include($config["paths"]["resources"] . '_template/top.cart.php');.' '.include($config["paths"]["resources"] . '_template/nav.menu.php');.' </div> </div> <div class="bodybg"> <div id="containner"> <div id="leftbar"> '.include($config["paths"]["resources"] . '_template/search.php');.' '.include($config["paths"]["resources"] . '_template/nav.categories.php');.' '.include($config["paths"]["resources"] . '_template/drop.manufacturers.php');.' '.include($config["paths"]["resources"] . '_template/left.boxs.php');.' </div> '.include($config["paths"]["resources"] . '_template/content.php');.' <div id="rightbar"> '.include($config["paths"]["resources"] . '_template/nav.specials.php');.' '.include($config["paths"]["resources"] . '_template/drop.reviews.php');.' '.include($config["paths"]["resources"] . '_template/popular.tags.php');.' '.include($config["paths"]["resources"] . '_template/right.boxs.php');.' </div> <div class="clear"> </div> </div> '.include($config["paths"]["resources"] . '_template/footer.php');.' </div> </body> </html> '; } ?>
  6. it contains errors, so i know i haven't included the html right, or within the functions, how would it be written correctly? is what i'm looking for thanks,
  7. Whats would be the correct way to write this function? any help please thanks <?php function template ($content) { <?php include($config["paths"]["resources"] . '_template/header.php'); ?> <div id="header"> <div class="innerwaraper"> <?php include($config["paths"]["resources"] . '_template/top.cart.php'); ?> <?php include($config["paths"]["resources"] . '_template/nav.menu.php'); ?> </div> </div> <div class="bodybg"> <div id="containner"> <div id="leftbar"> <?php include($config["paths"]["resources"] . '_template/search.php'); ?> <?php include($config["paths"]["resources"] . '_template/nav.categories.php'); ?> <?php include($config["paths"]["resources"] . '_template/drop.manufacturers.php'); ?> <?php include($config["paths"]["resources"] . '_template/left.boxs.php'); ?> </div> <?php include($config["paths"]["resources"] . '_template/content.php'); ?> <div id="rightbar"> <?php include($config["paths"]["resources"] . '_template/nav.specials.php'); ?> <?php include($config["paths"]["resources"] . '_template/drop.reviews.php'); ?> <?php include($config["paths"]["resources"] . '_template/popular.tags.php'); ?> <?php include($config["paths"]["resources"] . '_template/right.boxs.php'); ?> </div> <div class="clear"> </div> </div> <?php include($config["paths"]["resources"] . '_template/footer.php'); ?> </div> </body> </html> } ?>
  8. thanks but but say if message was filled in then it wouldn't redirect and show me the errors for the other two which aren't, how do i get around this?
  9. Here is my page, which checks to see if the email and password fileds are empty which works fine. so what it does is check the username and returns to register.php is its blank. but i want it to check all fields then return which ones are blank. so if both are blank, ill get a message somewhat like; A email address is required. A password is required. Anyhelp would be great thanks <?php session_start(); ob_start(); include('../../resources/config.php'); include($config["paths"]["resources"] . 'opendb.php'); include($config["paths"]["resources"] . '_library/login.php'); $email = mysql_real_escape_string($_POST['email']); $password = mysql_real_escape_string($_POST['password']); if(empty($_POST['email'])){ $_SESSION["message"] = 'A email address is required.'; header ('Location: register.php'); exit(); } if(empty($_POST['password'])){ $_SESSION["message"] = 'A password is required.'; header ('Location: register.php'); exit(); } $result = mysql_query("SELECT email FROM projectlogin WHERE email = '$email'"); $emailcheck = mysql_num_rows($result) or die(mysql_error()); if($emailcheck > 0){ $_SESSION["message"] = 'This email address is already registered with us. Having trouble, you can <a href="recover.php">reset your password here</a>.'; header ('Location: register.php'); exit(); } include($config["paths"]["resources"] . 'closedb.php'); ?>
  10. I'm getting this error message and im not sure why [codeWarning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/jigsaws2/public_html/project/public/_login/reg2.php on line 14 <?php session_start(); ob_start(); include('../../resources/config.php'); include($config["paths"]["resources"] . 'opendb.php'); include($config["paths"]["resources"] . '_library/login.php'); $email = mysql_real_escape_string($_POST['email']); $password = mysql_real_escape_string($_POST['password']); $result = mysql_query("SELECT email FROM productlogin WHERE email = '$email'"); $emailcheck = mysql_num_rows($result); if($emailcheck > 0){ $_SESSION["message"] = 'This email address is already registered with us. Having trouble, you can <a href="recover.php">reset your password here</a>.'; header ('Location: register.php'); exit(); } include($config["paths"]["resources"] . 'closedb.php'); ?>
  11. @scvinodkumar I've place it here.. <?php session_start(); ob_start(); include('../../resources/config.php'); include($config["paths"]["resources"] . 'opendb.php'); include($config["paths"]["resources"] . '_library/login.php'); $email = mysql_real_escape_string($_POST['email']); $password = mysql_real_escape_string($_POST['password']); authenticateUser ($email, $password); include($config["paths"]["resources"] . 'closedb.php'); ?> Now everything seems to work just fine? but i would like to understand what this peace of code is doing? any help there?
  12. sorry do you mean on resources/_library/login.php call it on this page? after the function? im new to php
  13. Can any one help, i can't see where i have gone wrong if you need anymore information please let me know thanks.. Error Message: Warning: Cannot modify header information - headers already sent by (output started at /home/jigsaws2/public_html/project/resources/opendb.php:13) in /home/jigsaws2/public_html/project/resources/_library/login.php on line 12 Error Displayed Login2.php <?php session_start(); include('../../resources/config.php'); include($config["paths"]["resources"] . 'opendb.php'); include($config["paths"]["resources"] . '_library/login.php'); $email = mysql_real_escape_string($_POST['email']); $password = mysql_real_escape_string($_POST['password']); authenticateUser ($email, $password); include($config["paths"]["resources"] . 'closedb.php'); ?> resources/_library/login.php <?php function authenticateUser ($email, $password) { $result = "SELECT * FROM projectlogin WHERE email = '$email' AND password = '$password'"; $result = mysql_query ($result) or die (mysql_error()); $row = mysql_fetch_assoc ($result); if (mysql_num_rows($result) == 1){ $_SESSION['user'] = true; $_SESSION['userid'] = $row['id']; $_SESSION['email'] = $row['email']; header ('Location: ../index.php'); } else { $_SESSION["message"] = 'Login failed. Please try again or <a href="recover.php">reset your password</a>.'; header ('Location: login.php'); } } ?> opendb.php <?php $connection = mysql_connect ( $config["db"]["host"], $config["db"]["username"], $config["db"]["password"] ) or die ('Error connecting to mysql'); mysql_select_db ( $config["db"]["dbname"] ); ?> config.php <?php $config = array( "db" => array( "dbname" => "jigsaws2_uni", "username" => "jigsaws2_jigsaw", "password" => "jigsaw", "host" => "localhost" ), "urls" => array( "baseURL" => "http://shop.jigsawsoulmedia.com" ), "paths" => array( "resources" => $_SERVER["DOCUMENT_ROOT"] . "/project/resources/", "images" => array( "content" => $_SERVER["DOCUMENT_ROOT"] . "/project/public/_img/content/", "layout" => $_SERVER["DOCUMENT_ROOT"] . "/project/public/_img/layout/" ) ) ); ?>
  14. Hey, experts... Thought I would try and pick your brain's; I have to compared PHP to SharePoint for the development of web-based enterprise system for my coursework for my Uni. project, I'm not very clued up or do I have a great understanding of SharePoint. So for those who are familiar with SharePoint and PHP, if you had to compare them what would be the advantages and disadvantages of both methods... ? Thanks You..
  15. http://www.ministryofsound.com/ Is there a plugin to create something similar to the flash content box displaying video and pictures with icons the side but in jquery or something similar, it doesn't have to display video just pictures. any help please ?
  16. the query is $query = "INSERT INTO web_roles (occurrence_id, staff_id, role) VALUES ('$occurrenceid', '$staff_id', 'Staff')"; :'(
  17. the problem is in this part of the code without this part of the code it works fine and i can echo out the ideas. once hitting this part of the code it stops looping ?? but i can't see anything wrong, i can have foreach with a if statement inside and an if statement inside that statement right? if (mysql_query ($query)) { $result = "SELECT * FROM web_login LEFT JOIN web_staff ON web_login.login_id=web_staff.login_id WHERE web_staff.staff_id = $staff_id"; $result = mysql_query ($result) or die (mysql_error()); $row = mysql_fetch_assoc($result); $email = $row['email']; $subject = "Meeting System, Meeting Notification" ; $message = "You have a new meeting you are required to attend"; mail("$email", "$subject", $message, "From: noreply@meeting.com" ); }
  18. Here's a smaller version on the form i selected the person with the staff_id which equals 8, on the next page i do print_r($_POST["selectedstaff"]) it shows me the array with the staff_id 8 my code <?php session_start(); include '../../_library/opendb.php'; include '../../_functions/login.php'; include '../../_functions/nav-admin.php'; $result = "SELECT * FROM web_staff LEFT JOIN web_login ON web_staff.login_id=web_login.login_id WHERE userlevel = '2' ORDER BY firstname ASC"; $result = mysql_query($result) or die( mysql_error() ); while($row = mysql_fetch_assoc($result)) { if (isset($_POST["selectedstaff"])) { foreach($_POST["selectedstaff"] as $staff_id) { if ( $staff_id == $row['staff_id'] ) { $occurrenceid = $_SESSION['occurrenceid']; echo $staff_id; } else { $_SESSION['message'] = " <div class='notification error png_bg'> <a href='#' class='close'><img src='[url=http://stuweb.cms.gre.ac.uk/~hr728/_web/_resources/images/icons/cross_grey_small.png']http://stuweb.cms.gre.ac.uk/~hr728/_web/_resources/images/icons/cross_grey_small.png'[/url] title='Close this notification' alt='close' /></a> <div> Error. please can't admin <> <>"; header('Location: list.php'); } } } } ?> just goes straight to the else [attachment deleted by admin]
  19. redirect i have taken out... there is still a problem the problem is i have in this example 3 staff members checked/selected and but in the array but the foreach still doesn't loop and add them all to the database. <?php session_start(); include '../../_library/opendb.php'; include '../../_functions/login.php'; include '../../_functions/nav-admin.php'; $result = "SELECT * FROM web_staff LEFT JOIN web_login ON web_staff.login_id=web_login.login_id WHERE userlevel = '2' ORDER BY firstname ASC"; $result = mysql_query($result) or die( mysql_error() ); while($row = mysql_fetch_assoc($result)) { if (isset($_POST["selectedstaff"])) { foreach($_POST["selectedstaff"] as $staff_id) { if ( $staff_id == $row['staff_id'] ) { $occurrenceid = $_SESSION['occurrenceid']; $query = "INSERT INTO web_roles (occurrence_id, staff_id, role) VALUES ('$occurrenceid', '$staff_id', 'Staff')"; if (mysql_query ($query)) { $result = "SELECT * FROM web_login LEFT JOIN web_staff ON web_login.login_id=web_staff.login_id WHERE web_staff.staff_id = $staff_id"; $result = mysql_query ($result) or die (mysql_error()); $row = mysql_fetch_assoc($result); $email = $row['email']; $subject = "Meeting System, Meeting Notification" ; $message = "You have a new meeting you are required to attend"; mail("$email", "$subject", $message, "From: noreply@meeting.com" ); print_r($_POST["selectedstaff"]); } else { $_SESSION['message'] = " <div class='notification error png_bg'> <a href='#' class='close'><img src='http://stuweb.cms.gre.ac.uk/~hr728/_web/_resources/images/icons/cross_grey_small.png' title='Close this notification' alt='close' /></a> <div> Error. please can't admin </div> </div>"; header('Location: list.php'); } } } } } ?> echo print_r displays Array ( [0] => 2 [1] => 8 [2] => 7 )
  20. can anyone see a problem which the below could and why it could not be looping. the array has multi number of results but seems as if the foreach only works once <?php session_start(); include '../../_library/opendb.php'; include '../../_functions/login.php'; include '../../_functions/nav-admin.php'; $result = "SELECT * FROM web_staff LEFT JOIN web_login ON web_staff.login_id=web_login.login_id WHERE userlevel = '2' ORDER BY firstname ASC"; $result = mysql_query($result) or die( mysql_error() ); while($row = mysql_fetch_assoc($result)) { if (isset($_POST["selectedstaff"])) { foreach($_POST["selectedstaff"] as $staff_id) { if ( $staff_id == $row['staff_id'] ) { $occurrenceid = $_SESSION['occurrenceid']; $query = "INSERT INTO web_roles (occurrence_id, staff_id, role) VALUES ('$occurrenceid', '$staff_id', 'Staff')"; if (mysql_query ($query)) { $result = "SELECT * FROM web_login LEFT JOIN web_staff ON web_login.login_id=web_staff.login_id WHERE web_staff.staff_id = $staff_id"; $result = mysql_query ($result) or die (mysql_error()); $row = mysql_fetch_assoc($result); $email = $row['email']; $subject = "Meeting System, Meeting Notification" ; $message = "You have a new meeting you are required to attend"; mail("$email", "$subject", $message, "From: noreply@meeting.com" ); $_SESSION['message'] = " <div class='notification success png_bg'> <a href='#' class='close'><img src='http://stuweb.cms.gre.ac.uk/~hr728/_web/_resources/images/icons/cross_grey_small.png' title='Close this notification' alt='close' /></a> <div> Meeting has been created and all staff have been informed </div> </div>"; header("Location: list.php"); } else { $_SESSION['message'] = " <div class='notification error png_bg'> <a href='#' class='close'><img src='http://stuweb.cms.gre.ac.uk/~hr728/_web/_resources/images/icons/cross_grey_small.png' title='Close this notification' alt='close' /></a> <div> Error. please can't admin </div> </div>"; header('Location: list.php'); } } } } } ?>
  21. if(trim($row['role']) == 'Secretary') && ($row['staff_id']) == $staffid) { $secretarybook = "Minutes Not Published"; } else { $secretarybook = 'cock'; } How comes the && doesn't work here am i using it in the wrong place ?
  22. as you guys can see it relates to right data in the web_roles table, in the image [attachment deleted by admin]
×
×
  • 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.