-
Posts
322 -
Joined
-
Last visited
Everything posted by CyberShot
-
I have multiple <ul> lists in my code. I am hiding all of them using ("ul").hide(); What I want is to be able to show 2 of them at a time. I know I can do it using ("ul:eq(0)").show. That will show the first one, but how do I get it to show the first and second. which would be 0 and 1, and then 2 and 3 and so on?
-
Thanks for your help, I solved it using double quotes on the values and the backtick on the field names.
-
ok that worked, but now I am getting another error that says unknown column SQL query: -- -- Database: `bikesite` -- -- -------------------------------------------------------- -- -- Table structure for table `bike` -- -- -- Dumping data for table `bike` -- INSERT INTO bike( `pk_bikeID` , `model` , `year` , `size` , `rate` , `quantity` ) VALUES ( 1, `road` , `2009` , `40` , `15` , `40` ) , ( 2, `mountain bike` , `2009` , `30` , `15` , `20` ) , ( 3, `dirt bike` , `2010` , `10` , `15` , `30` ) ; MySQL said: #1054 - Unknown column 'road' in 'field list' I matched them up and don't see what the issue is
-
can you tell me what is wrong with this. When I try to import it into a table, I get this error SQL query: -- -- Dumping data for table `bike` -- INSERT INTO bike( 'pk_bikeID', 'model', 'year', 'size', 'rate', 'quantity' ) VALUES ( 1, 'road', '2009', '40', '15', '40' ) , ( 2, 'mountain bike', '2009', '30', '15', '20' ) , ( 3, 'dirt bike', '2010', '10', '15', '30' ) ; MySQL said: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''pk_bikeID','model','year','size','rate','quantity') VALUES (1,'road','2009','4' at line 3 I am importing the sql file, very short. I have attached the file for convienence [attachment deleted by admin]
-
I have downloaded a script for pagination. I have it up and running fine. You can view it here http://www.creativeeventsdesign.com/orange/portfolio.html if you click the number links on the bottom of the page, it will change the page and add four new blocks, I have titled these photo, site, car, homes, and building. Just for testing. On the right, I have a menu titled "Categories". What I would like is that you could click on the category and it will take you to that page in the pagination. I tried using named anchor links but it doesn't work. I do not know javascript. Can you help $(document).ready(function(){ var show_per_page = 4; //set the number of blocks to show var number_of_items = $('#pagination').children().size(); var number_of_pages = Math.ceil(number_of_items/show_per_page); var end = number_of_pages -1; $('#current_page').val(0); $('#show_per_page').val(show_per_page); var navigation_html = '<a href="javascript:go_to_page(0);">Begin</a>'; navigation_html += '<a href="javascript:nav(-1);">Prev</a>'; var current_link = 0; while(number_of_pages > current_link){ navigation_html += '<a class="page_link" href="javascript:go_to_page(' + current_link +')" longdesc="' + current_link +'">'+ (current_link + 1) +'</a>'; current_link++; } navigation_html += '<a href="javascript:nav(+1);">Next</a>'; navigation_html += '<a href="javascript:go_to_page(' + end +')"">End</a>'; $('#page_navigation').html(navigation_html); $('#page_navigation .page_link:first').addClass('active_page'); $('#pagination').children().css('display', 'none'); $('#pagination').children().slice(0, show_per_page).css('display', 'block'); }); function nav(dir){ if(dir==+1){ new_page = parseInt($('#current_page').val()) + 1; if($('.active_page').next('.page_link').length==true){ go_to_page(new_page); } }else if(dir==-1){ new_page = parseInt($('#current_page').val()) - 1; if($('.active_page').prev('.page_link').length==true){ go_to_page(new_page); } } } function go_to_page(page_num){ var show_per_page = parseInt($('#show_per_page').val()); start_from = page_num * show_per_page; end_on = start_from + show_per_page; $('#pagination').children().css('display', 'none').slice(start_from, end_on).css('display', 'block'); $('.page_link[longdesc=' + page_num +']').addClass('active_page').siblings('.active_page').removeClass('active_page'); $('#current_page').val(page_num); }
-
that's what I have been doing. I think it's just to long since I coded a page. My skills are getting cold. I was having trouble positioning the nav. I coulnd't figure out why padding was pushing the divs apart. Margin should do that but not padding. I ended up using relative positioning to put the nav in place #nav { background:url(../images/nav.png) repeat-x; height: 46px; width: 100%; } #nav ul li { position: relative; display: inline; list-style: none; font-weight: bold; list-style-position: inside; left: 30px; } #nav li a { position: relative; top: -20px; color: #fff; text-decoration: none; padding: 0 20px 0 20px; text-align: center; } <div id="header"> <div id="logo"> </div><!--END LOGO--> </div> <!--END HEADER--> <div id="nav"> <ul> <li><a href="index.html">Home</a></li> <li><img src="images/navLine.png" alt="" width="2" height="46" /></li> <li><a href="About.html">About</a></li> <li><img src="images/navLine.png" alt="" width="2" height="46" /></li> <li><a href="portfolio.html">Portfolio</a></li> <li><img src="images/navLine.png" alt="" width="2" height="46" /></li> <li><a href="services.html">Services</a></li> <li><img src="images/navLine.png" alt="" width="2" height="46" /></li> <li><a href="contact.html">Contact</a></li> </ul> </div><!--END NAV--> [code] firebug was showing the padding below the nav div which was pushing the content div down which allowed the white background from the browser to show. the padding made a space between the nav div and content div. couldn't figure out why
-
here is a different question you can answer why you are here. Why would padding push a nav div down? I am trying to get my links aranged and every time I put padding on the nav div, it pushed the div below it down which makes a white line. This should not happen
-
well, I thought about some of the explanations and realized that floating was the way to go. So I ended up doing that it and it's working fine. Now I am trying to figure out why my nav won't work.
-
I explained why in my post
-
I am building a site and ran into a problem. I have my header set up and the site wrapped with a wrapper. All is good. I needed to build 3 columns for the content and decided to do this using absolute positioning. I have them positioned exactly where I want, everything is good The problem is that the wrapper has colapsed under the absolute positioned columns. So any new content floats underneath the colums rather than below them as in normal flow of content. I know how to float the content and build the columns that way, but I was hoping for a solution to this so I could keep it this way since it's perfect. Any suggestions? my columns #content #column1 { margin-left: 15px; position: absolute; width: 300px; } #content #column2 { position: absolute; margin-left: 15px; width: 300px; left: 300px; } #content #column3 { position: absolute; margin-left: 15px; width: 400px; left: 600px; } I have position relative on the wrapper div
-
I just typed out a long reply and lost it. Let me try again. the slider is this one http://jqueryfordesigners.com/demo/coda-slider.html the code is arranged like this <div class="panel" id="blog"> <h2>Blog</h2> <?php include('blog.php'); ?> </div><!--END BLOG PANEL--> <div class="panel" id="services"> <?php include('services.php'); ?> </div><!--END SERVICES PANEL--> <div class="panel" id="testimonials"> <h2>Testimonials</h2> <?php include('testimonials.php'); ?> </div><!--END TESTIMONIALS PANEL--> <div class="panel" id="order"> <h2>Order</h2> <?php include('order.php'); ?> </div><!--END ORDER PANEL--> <div class="panel" id="contact"> <?php include('contact.php'); ?> </div><!--END CONTACT PANEL--> the idea is that when you push the button, the slider slides and loads the include. I want to be able to change the content of the sections below based on what include was loaded. Otherwise the page will be static. I am using includes to load the slider panels so that the code in the index page stays much cleaner.
-
I am not using GET
-
I am putting together a site. I have three sections on the site. A top section and a middle section and bottom section(footer) the top section has a slider that is part of the navigation. When you push about, instead of loading the about page, it loads the about.php as an include into that slider area. What I would like to know is if it is possible to write code that will recognize the fact that the about.php was included and then run different code for the middle section based on that. So if about.php was loaded, run this include else, run regular xhtml. I don't know how to write this code. I tried something like if(include() == "about.php") { do something }
-
it is. The idea is that if they type in the wrong thing that doesn't match $pattern, then they get the error. If they type in a name that does, then they are told it worked. The issue to start was that it was putting up the error when I load the page. No matter if I did something or not. I understand the && But I thought it would have still been dependent on what came before. I guess it's not. But still I don't see why it's not working based on what is there. if the button hasn't been pushed { then return } if the name field isn't empty && the name field matches $pattern{ then return $good } else { return bad } I see what you are saying. Why the error would display. Now that I just typed this out. So I see the need to split them up.
-
@AlexWD I see what you are saying in your code, but I still get nothing with that. No error message or success message.
-
@Nightslyr I kinda see what you are saying. But at this point, your sollution is over my head. As you suggested, it's a problem of oop design. I do need to learn that. At this point, I will settle for making the code work the way I can understand it. @AlexWD How does my code trigger the false statement. Here is the way I understand what I have in plain english. Tell me how this is wrong. if(isset($_POST['go']) To me means that if the submit button is pushed !empty($_POST['name'] To me means that if the textbox for the name isn't empty preg_match($pattern, $_POST['name'] Means that if if the name submitted by the form matches $pattern then run the first if which says good work, name has been entered The only way I think the error should be returned is if all the above turn out to be false. Which is happening, but how can they happen when the form is run the field is empty and the button has not been pushed, there is nothing to match the $pattern.
-
@killerb That sollution didn't work. It does nothing either way. No error message at all
-
that's what the $_POST['go'] is.
-
right, but I took that to mean that no error message would be displayed until it was submitted. I never pushed any buttons, all I did was load the page and the error was there
-
I set up a class as a trial. I have 7 files in my project right now. I want to make them into 2 files. an index file and a class_lib file. So I set up my first class as a trial and it seems to be working, but there is a problem in my code. I don't get any errors right now, but what I think should happen isn't happening. I have a form that asks your name, when you put it in and press submit, it ads the name to a list. All is good. So now I want to add some validation. So I set up an error class as a test run. class error { var $error = "You must put in a name"; var $good = "good work, name has been entered"; function myError(){ $pattern = '/[A-Za-z]+/'; if(isset($_POST['go']) && !empty($_POST['name']) && preg_match($pattern, $_POST['name'])) { return $this->good; } else { return $this->error; } } } my issue is that when I run the index page to view the form, the $error code is already visible in the div. It doesn't wait for me to put in a name or to match the $pattern. What is wrong with my logic here? I am calling the class in my index like this [code <div> <?php $errorCode = new error(); echo $errorCode->myError(); ?> </div> [/code] thanks for your help
-
while reading this stuff it usually always prompts a question. I was following a tutorial where it was being explained in a video. But they always leave something out which promtps the questions
-
yes, that works. but it defeats the purpose of the variable in the class. What I am trying to learn here is why the variables are assigned in the class. I thought it was because they were to be properties for the methods. $this only gives access to the method and not the class right?
-
I just tried a simple if statement without the strlen and it works fine if($message > '10') could that work?
-
class person { var $name = "Jimmy Goe"; function get_name(){ echo $this->name; } } I am playing with this very small script that I made using a tutorial. I can get the script to echo out the name using the code above. What I don't get is why I can't do this class person { var $name; function get_name(){ $name = "Jimmy Goe" echo $this->name; } } then of course in my index page, I am calling it like this $joe = new person(); $joe->get_name(); If you decide to answer this question, please be as detailed as possible, I am a newb as you can see and the more information you give or the simpler the explanation, the better. Thanks for helping
-
I do have a primay key set up. it gives the unique index. would you check against that the same way as smerny posteed? The first field is id with numbers set to auto incrment