Jump to content

remybink

Members
  • Posts

    40
  • Joined

  • Last visited

    Never

Everything posted by remybink

  1. Can't hide the span content, I have done this many times no problem, now, it's a problem <div id="nav"> <ul> <li class="fountains"><a href='category_select.php?id=fountains'>fountains <span><?php require('req/nav_select.php'); ?></span></a></li> <li><a href='category_select.php?id=bird'>bird baths</a></li> <li><a href='category_select.php?id=planters'>planters</a></li> <li><a href='category_select.php?id=statues'>statues</a></li> <li><a href='category_select.php?id=tables'>tables</a></li> </ul> </div> I added color just to see if css was being processed, works fine. #nav a{ color: red; } #nav ul li.fountains a { color: blue; } #nav ul li a span { display: none; }
  2. $id = $_GET['id']; if($id == "all"){ $records = "SELECT * FROM (fountains)"; }else if($id == "garden"){ $records = "SELECT * FROM (fountains) WHERE wall='no'"; }else{ $records = "SELECT * FROM (fountains) WHERE wall='yes'"; } hahaha -- you rock!!!!
  3. this is my nav menu code <ul> <li><a href='fountains_page.php?id=all'>all fountains</a></li> <li><a href='fountains_page.php?id=garden'>garden fountains</a></li> <li><a href='fountains_page.php?id=wall'>wall fountains</a></li> </ul> this is my script require('dbconnect.php'); $id = $_GET['id']; if($id = all){ $records = "SELECT * FROM (fountains)"; }else{ if ($id = garden){ $records = "SELECT * FROM (fountains) WHERE wall='no'"; }else{ if($id = wall){ $records = "SELECT * FROM (fountains) WHERE wall='yes'"; } } } $query_records = mysql_query($records); $num_records = mysql_num_rows($query_records); if ($num_records == 0) { echo "The menu is closed for now."; } else{ $i=1; } echo 'We have'.' '.$num_records.' '.'fountains for your consideration<br />Please visit our store to view hundreds of styles.<br />'; echo $id; $errors = array(); // initialize error array Here is the link http://www.mywebsitepaid.com/stonemans/fountains_page.php I can't get the 'id' to pass. What am I doing wrong? I did another site fine, but here I messed something up.
  4. validate your code for errors, or send link for website
  5. time to update your html to compliance, as in xhtml <br> ? old <br /> new <img src="#"> ? old <img src="#" alt="#" /> new update your entire website apply the correct doctype, in your case transitional and try again, run w3c validator, i am sure you are just full of errors IE 9 interprets compliant code just fine
  6. helloise, the days of coding for IE versions are gone unless you are accounting for ie7 as cssfreakie said -- to be written properly, the css will work in all current browsers
  7. a link to the website would be nice too
  8. That was also part of my question. Because I wanted to grab each feature and apply tags for other purposes this was the only way i thought of doing it and not repeating the data. so i put one feature in each field and the entire column is applied with category to which these features belong this is one table is only for features and nothing else i wanted to use 1 field for common features, 1 field for extra features and apply relation to each category, but i was not sure how to use the explode feature to extract the data. i assume i would need some separator other than space to signal between the key words to which explode would reference as features are not typically one worded. If i knew what i was doing I would not be using this forum i have separate tables for login, items, category, features
  9. it makes no difference how you set up your style use the method which you like the best and can read easier. in your one example I layout like so to show relevance for me, also I separate with comments or symbols if code gets too messed up from constant changes to each his/her own function whatever () { // stuff if (whatever) { //whatever }else if { // whatever } }
  10. I do have a separate table for features. I understand normalization. This is a small db so i use unique terms for primary and foreign keys. my question is can the explode function be used to turn the content in table field into an array and then output the result with added <li> tags? Or is there a better method? Or am i stuck entering features field by field?
  11. <input type="image" src="images/submit1c.png" class="submit" name="submit" value="submit" /> make sure src points to the image with correct path id and class is for styling
  12. That doesn't make sense by using //close whatever this will display on the web page unless you are in php for html <div id="wrapper"> <div id="nav"> </div><!-- end nav --> </div><!-- end wrapper --> <!-- space must be used after the (--) and then the (word) followed by space then (--)> to be compliant with w3c validator You can also download PSPAD and when you click a div tag the opposing div tag will highlight
  13. My products based on category share common features, then I have products where all features are different. right now I have the following code for the features -- in the table is (id, category, feature1, feature2, feature3, ...... feature15) <?php $records = "SELECT * FROM (features) WHERE category='$cat'"; $query_records = mysql_query($records); $num_records = mysql_num_rows($query_records); if ($num_records == 0) { return FALSE; } while($row = mysql_fetch_assoc($query_records)){ echo '<ul class="list">'; $feature = $row['feature1']; if ($feature){ echo '<li>'.$feature.'</li>';} $feature = $row['feature2']; if ($feature){ echo '<li>'.$feature.'</li>';} $feature = $row['feature3']; if ($feature){ echo '<li>'.$feature.'</li>';} $feature = $row['feature4']; if ($feature){ echo '<li>'.$feature.'</li>';} $feature = $row['feature5']; if ($feature){ echo '<li>'.$feature.'</li>';} $feature = $row['feature6']; if ($feature){ echo '<li>'.$feature.'</li>';} $feature = $row['feature7']; if ($feature){ echo '<li>'.$feature.'</li>';} $feature = $row['feature8']; if ($feature){ echo '<li>'.$feature.'</li>';} $feature = $row['feature9']; if ($feature){ echo '<li>'.$feature.'</li>';} $feature = $row['feature10']; if ($feature){ echo '<li>'.$feature.'</li>';} $feature = $row['feature11']; if ($feature){ echo '<li>'.$feature.'</li>';} $feature = $row['feature12']; if ($feature){ echo '<li>'.$feature.'</li>';} $feature = $row['feature13']; if ($feature){ echo '<li>'.$feature.'</li>';} $feature = $row['feature14']; if ($feature){ echo '<li>'.$feature.'</li>';} $feature = $row['feature15']; if ($feature){ echo '<li>'.$feature.'</li>';} echo '</ul>'; } ?> this format is just not suitable. how can i make this easier and versatile for some products i think i will add a "model" to the table and pull data based on "model" on some products. I don't want to have to rewrite the common features for each product, yet, i need to add additional special features. So, can I just add common features into 1 field labeled "common-features" and have additional fields for "additional-features" and then call the field and pass it through "explode" function? Will i be able to add "<li></li>" tags in the output?
  14. Thanks Marcus I should have taken a break a bit ago, had a different array problem and I fixed it, and fixed all the other errors prior, thanks for your help, I got it.
  15. I realize I butchered this form by now, but I must have spent a few hours already, and at some point it worked, now it doesn't, just says array this section is separate file <?php //check for submit insert form in installed by us if(isset($_POST['submit'])){ $errors = array(); // initialize error array //extract content from form //public name section---------------------------------------------------- if(empty($_POST['prod_name'])){ $errors[] = 'no name'; }else{ $pname = trim($_POST['prod_name']); } //test for only alpha if(!preg_match('/^[a-zA-Z ]+$/', $pname)){ $errors[]='bad name'; } //dropdown menu select $cat = $_POST['category_select']; //comment section------------------------------------------------- if(empty($_POST['prod_descrip'])){ $errors[] = 'no description'; }else{ $pdescrip=$_POST['prod_descrip'];} //remove all characters except alpha numerics // $new_pdescrip = preg_replace("/[^a-zA-Z0-9\s]/", "", $pdescrip); //state bad words // $bad_words = array("sex", "fuck", "porn", "ass", "dick", "cunt", "whore", "stupid", "cum", "bitch", "bastard", "loser", "gay", "pornography", "nude", "shit", "cock", "suck", "penis", "vagina", "sex", "suck", "fukk", "dik", "dumb", "retard", "idiot", "butt", "clit", "kill", "www", "http", "dck", "naked", "milf"); //remove bad words and replace with **** // $new_pdescrip = str_replace($bad_words, " ", $new_pdescrip); //comment section------------------------------------------------- if(empty($_POST['installer_view'])){ $errors[] = 'no tech view'; }else{ $installer=$_POST['installer_view'];} //remove all characters except alpha numerics // $new_pdescrip = preg_replace("/[^a-zA-Z0-9\s]/", "", $pdescrip); //state bad words // $bad_words = array("sex", "fuck", "porn", "ass", "dick", "cunt", "whore", "stupid", "cum", "bitch", "bastard", "loser", "gay", "pornography", "nude", "shit", "cock", "suck", "penis", "vagina", "sex", "suck", "fukk", "dik", "dumb", "retard", "idiot", "butt", "clit", "kill", "www", "http", "dck", "naked", "milf"); //remove bad words and replace with **** // $new_pdescrip = str_replace($bad_words, " ", $new_pdescrip); //images section if(!empty($_POST['prod_img1'])){ $img1 = $_POST['prod_img1'];} if(!empty($_POST['prod_img1a'])){ $img1a = $_POST['prod_img1a'];} if(!empty($_POST['prod_img2'])){ $img2 = trim($_POST['prod_img2']);} if(!empty($_POST['prod_img2a'])){ $img2a = trim($_POST['prod_img2a']);} if(!empty($_POST['prod_img3'])){ $img3 = trim($_POST['prod_img3']);} if(!empty($_POST['prod_img3a'])){ $img3a = trim($_POST['prod_img3a']);} if(!empty($_POST['prod_img4'])){ $img4 = trim($_POST['prod_img4']);} if(!empty($_POST['prod_img4a'])){ $img4a = trim($_POST['prod_img4a']);} $msrp = $_POST['prod_msrp']; $sale = $_POST['prod_sale']; if(!empty($_POST['active'])){ $active = $_POST['active']; }else{ $errors[] = 'active not selected';} if(empty($errors)){ require('../scripts/dbconnect.php'); mysql_query("INSERT INTO items (prod_name, prod_cat, prod_descrip, installer_view, prod_img1, img1a, prod_img2, img2a, prod_img3, img3a, prod_img4, img4a, prod_msrp, prod_sale, prod_active) VALUES ('{$pname}', '{$cat}', '{$pdescrip}', '{$installer}', '{$img1}', '{$img1a}', '{$img2}', '{$img2a}', '{$img3}', '{$img3a}', '{$img4}', '{$img4a}', '{$msrp}', '{$sale}', '{$active}' )"); //$url = 'http://www.installedbyus.com'; }else{ // $url = 'http://www.installedbyus.com/insert.php'; echo $errors; } // header("location: $url"); exit(); } ?> I turned off much of the script looking for issues however i suspect the following to be an issue I tried to make the drop down menu in the form to extract categories from my db <?php require('scripts/dbconnect.php'); ?> <?php require('req/header.php'); ?> <body> <div id="wrapper-wrap"> <div id="wrapper"> <?php require('req/banner.php'); ?> <?php require('req/nav.php'); ?> <div class="clear"></div> <!-- end searches --> <div id="body"> <?php $records = "SELECT * FROM (categories)"; $query_records = mysql_query($records); $num_records = mysql_num_rows($query_records); if ($num_records == 0) { echo "nothing found."; }else{ echo "Database is open";} ?> <form action="scripts/insert_item.php" method="post" id="insert_form"> <p>prod_name <input type="text" name="prod_name" value="" /></p> <!-- category select --> <p>prod_cat <select name="category_select"> <?php while($row = mysql_fetch_assoc($query_records)){ $dbcategory = ($row['category']); echo '<option value="'.$dbcategory.'">'.$dbcategory.'</option>'; } ?> </select> </p> page link http://www.installedbyus.com/insert.php I am going to step away from this for 5 minutes. I think I will start cleaning it up and see what i come across, any pointers to improve this code is extremely appreciated
  16. $width = ($row['width']); if ($width == NULL){ $width = "Call"; }else { $width = $width .' '.'in.'; } What would be a simpler way to write this? Or should I say better? I am not ready for the "switch" method, would prefer the longer form. This script works. However, i want to get no output if the result is empty or NULL. The reason I chose a string was that I had issues and placing a string seemed to fix it.
  17. First, thank you everyone for helping me previously. Your help allowed me to manipulate that knowledge into other parts of my website. I need each product to list features of that product, each category shares "common features" - these common features I was hoping to enter into one table row however I need to extract these items and nest them within <li></li> tags. What would be the best entry into a table for my purpose? So, alarms have features ... a,b,c,d,e,f alarm/starts have features ... a,b,c,d,e,f is this where and array() is used?
  18. Thank you very much. The pointer on speed of rand() is appreciated. This db will be just for my very small business. I won't have more than 100 products between all categories. But it's great advice while I learn PHP/MySQL I wish I was strong in it like I am in CSS -- thanks again
  19. On the side menu I would like to use my rand() function, but the side menu is just extra products, the main part of the page has a product which i do not want in the side menu rand() function so, does the $_GET['id'] come to play here too? also, i am calling "select..... and mysql_query twice on this page, once for main part of page and second for side menu, i dont know if it can be merged, but for my sanity i prefer to keep them separate. plus it allows me to add this menu in other pages easier. I would like to try it myself first if someone can give me a hint -- $records = "SELECT * FROM (items) ORDER BY RAND() LIMIT 3";
  20. Thank you very much. I'll try this later. Seems too involved for right now. would require me to move too many items around. I have my echo's as the last instructions. I'll try it tonight.
  21. I don't want to pass it to the next page I want the result on the same page so line 1) 5 products line 2) break of some sort line 3) 5 more products etc Thank you for your input, I will practice with the limit function anyway
  22. I see so much about pagination, but what is it called or what is the function to create a "break" after "x" amount of results? I am going to sit here until this website is complete, times are tough and I must launch a better website. Thank you for any help you guys can and did offer.
×
×
  • 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.