Jump to content

purpleshadez

Members
  • Posts

    38
  • Joined

  • Last visited

    Never

Everything posted by purpleshadez

  1. I'm at work at the moment but will be happy to take a look when I finish.(busy day today)
  2. Nope......and with the examples I gave and the responses you have, I would assume that you are way to intelligent for this simple question from this simple person. Were you always so articulate? Do you hang around forums alot waiting for those not at your level of expertise, to keep mentioning throughout threads how knowledgeable you are and others aren't? heres an idea, post ALL the relevant code!!! I have read this from start to finish and I'm also not sure I follow what you are going on about. But I'll give it a shot. Are you typing the statement into the textarea box, then saving it to the database in hope that it will be sparsed on a different page which runs a query to get said data from database and display it on another page? kinda like a blog but one that lets you run php code? If so then what is the database query you are using to both store this data and then retrieve it again? Please be sure to include any and all sanitation & validation you are using to store and retrieve the data in the database.
  3. This would be a slight mod of your SQL statement $sql = "SELECT * FROM `winelist`, `winemakers` WHERE (`winelist`.`winemakerid` = `winemakers`.`id`) GROUP BY fieldName ORDER BY winecountry, winetype, winename_sub, wineyear ";
  4. both have their benefits. http://css-tricks.com/the-difference-between-id-and-class/ http://www.tizag.com/cssT/cssid.php Some useful info in those links about ids and classes and google as always has the answers As a general rule I use IDs for main sections (nav, head, footer, content) and forms need them if you use labels then classes for most of the rest. This is a bit out of scope for this forum tho mate so we might get shot
  5. Only had a quick look but I think you are correct with it being a CSS problem. You're using floats which might be whats messing your layout up as I can't see a tag to clear them before your footer. Okay div tags, I count 1 opened in the header and 4 in the content. But you only have 3 closing tags all in the footer. So you're missing two closing tags. I'd personally make sure that any divs you open in your header are closed in the footer and all content divs are closed on the same page you opened them. Easier to keep track.
  6. Yes. Another good point! I'm not sure what I had in my mind but no, I retract my lazy statement. *Considers himself duely corrected*
  7. No I don't explicitly convert each type always I only do it when required. But in the context of the if statement (which was what I was commenting on) I would always write it as if(count($num) > 0) { // do someting } just as I would also write if(isset($var)) { // do something } instead of if($var) { // so something } My apologies if my light hearted and perhaps vague comment has caused offence as that wasn't my intention.
  8. 0 evaluates to false in a boolean context, any other integer evaluate to true. PHP is weakly typed language. Good point, my bad. IMO its a bit lazy though
  9. if(count($info['results'])) if what? is $info['results'] meant to equal a certain amount, be less than or more than a certain amount? Also use curly brackets with if statements it makes the code easier to read print '<div align="center" class="info"><b>'.$info['total_results_count'].'</b> results found, page '.$info['curpage'].' from '.$info['total_pages'].'</div>'; This seems fine to me but what is the rest of the code doing? what line is the error on? Look at the code from the error UP as the fault will most likely be on the line(s) above it. Have you checked for a missing semi colon? Seeing the full script would help. What is createBar() doing?
  10. Where ever you use include you are basically saying that all the code in the included file goes where the include statement is. I'd suggest writing a single page with both the header and footer code in them then once you have the layout as you want it split it up once you are happy with the layout.
  11. Only issue with eregi is that it is depreciated as of PHP 5.3.0. with ereg I used this and never had any issues: <?php function check_email($email) { // First, we check that there's one @ symbol, and that the lengths are right if ( ! ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) { // Email invalid because wrong number of characters in one section, or wrong number of @ symbols. return FALSE; } // Split it into sections to make life easier $email_array = explode("@", $email); $local_array = explode(".", $email_array[0]); for ($i = 0; $i < sizeof($local_array); $i++) { if ( ! ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) { return FALSE; } } if ( ! ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name $domain_array = explode(".", $email_array[1]); if (sizeof($domain_array) < 2) { return FALSE; // Not enough parts to domain } for ($i = 0; $i < sizeof($domain_array); $i++) { if ( ! ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) { return FALSE; } } } return TRUE; } // End check_email?> To be honest though, using the built in filter_var() function is a good idea if you're on php 5.3.0 <?php if(filter_var($email, FILTER_VALIDATE_EMAIL) === TRUE) { // valid } else { // not valid }
  12. This would just show the last record in the database. There are a few problems with this script. Firstly you are re-building the form with each loop. I'm quessing that if anything, it is only displaying one record. Most likely the last one in the database. This is because you have wrapped the form in a div with an ID. As far as I'm aware you can only have one instance of an ID per page. I'm willing to bet if you are getting any results and you remove the ID's or change them to classes you'll have one page with a list of forms one for each record. There are a few ways to get what you want but I'd suggest looking into pagination. there are a number of tutorials on it if you google it.http://www.google.co.uk/search?hl=en&rlz=1T4ADSA_enGB333GB333&q=pagination+in+PHP&meta=&aq=f&oq=
  13. No probs, there is a typo in my code though. $a = 0; $b = 0; $c - 0; where i have a minus sign for $c it should be an equals sign $c = 0;
  14. This is a quick and untested answer and I'm sure there's a better way, but something like this should work. <?php // process.php $a = 0; $b = 0; $c - 0; foreach($_POST as $data) { if($data == 1) { $a++; } elseif($data == 2) { $b++; } elseif($data == 3) { $c++; } } if($a > $b && $a > $c) { echo 'you answered mostly A'; } elseif($b > $a && $b > $c) { echo 'you answered mostly B'; } else { echo 'you answered mostly C'; } ?>
  15. as the previous comment, you are using the post method on your form. Also in your switch you are using $act which means you have register globals on. I recommend turning this off and use $_GET['act'] instead. You either need to change your method in user.php to get or use $_POST['txtFNm']
×
×
  • 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.