Jump to content

Zane

Administrators
  • Posts

    4,362
  • Joined

  • Last visited

  • Days Won

    11

Posts posted by Zane

  1. [code]$error="";
           if (empty($section)){
            $error = "** You forgot to enter the section for the story! **<br>";
        }  else if (empty($added_by)){
            $error = "** Error: You forgot to who added the story! **<br>";
        }  else if (empty($headline)){
            $error = "** Error: You forgot to enter a headline for the story! **<br>";
        }  else if (empty($byline_name)){
            $error = "** Error: You forgot to enter a byline name for the story! **<br>";
        }  else if (empty($published)){
            $error = "** Error: You forgot to the date you wish to publish the story! **<br>";
        }  else if (empty($opening)){
            $error = "** Error: You forgot to the Opening Paragraph for the Indexes! **<br>";
        }  else if (empty($body_text)){
            $error = "** Error: You forgot to enter any body text! **<br>";}; [/code]

    [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]how do I get that message to appear...................IF all the fields are not filled[/quote]

    don't use else if
    just if

    and make $error an associative array
    like so
    [code]
    $error = array();
        if (empty($section))
            $error['section'] = "** You forgot to enter the section for the story! **<br>";
        if (empty($added_by))
            $error['added_by'] = "** Error: You forgot to who added the story! **<br>";
        if (empty($headline))
            $error['headline'] = "** Error: You forgot to enter a headline for the story! **<br>";
        if (empty($byline_name))
            $error['byline_name'] = "** Error: You forgot to enter a byline name for the story! **<br>";
        [/code]
  2. set the require statement outside of the class, at the top of the page
    then just call it like you would any other Class


    [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]But you can use the statement extends statement to "reuse" a class:[/quote]
    not a good idea
    you might not want one class to have the properties of another
    only use extends when you need to .....literally extend from it

    for instance if you made a Car class
    and you decided to make a Motorcycle class also....
    then you could logically EXTEND it onto CAR, maybe
  3. [!--coloro:#999999--][span style=\"color:#999999\"][!--/coloro--]Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/chris/public_html/index.php on line 199[!--colorc--][/span][!--/colorc--]
    Your mysql_num_rows obviously failed which, according to your code, would skip the $dates creation
    So you technically have no variable $dates if mysql_num_rows() failed explaining this error
    [!--coloro:#C0C0C0--][span style=\"color:#C0C0C0\"][!--/coloro--]Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253[!--colorc--][/span][!--/colorc--]

    which you posted ...... many many times in a row

    So the key is to fix your mysql_num_rows....

    check your MySQL result resource...which is $query_archives, AKA your query
    and make sure that your date field in your database is of the DATE/DATETIME datatype
  4. Here's some markup
    that may help
    [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
    // INSERT INTO cabinrates
    [!--coloro:#FF9966--][span style=\"color:#FF9966\"][!--/coloro--]$num = 0; //You don't need a counter for a FOREACH[!--colorc--][/span][!--/colorc--]
    foreach($cabins as $size => $cost){
    $query2 = "INSERT INTO cabinrates (cabinname, cabinprice, tourid) VALUES ('$size', '$cost', '$tourid')";
    $addcabins = sql($query2);
    [!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]//I don't see the point of this next line especially if you're supressing the errors, just take it out
    @mysql_affected_rows($addcabins);[!--colorc--][/span][!--/colorc--]
    //Try echo out every SQL statement that's made just to check you're doing all of them
    echo $query2 . "<br />\n";
    [!--coloro:#FF9966--][span style=\"color:#FF9966\"][!--/coloro--]$num = $num + 1;[!--colorc--][/span][!--/colorc--]
    }
    [/quote]

    another idea would be to put curly braces around you're variables when you use them in the query
    [!--coloro:#3333FF--][span style=\"color:#3333FF\"][!--/coloro--]$query2 = "INSERT INTO cabinrates (cabinname, cabinprice, tourid) VALUES ('{$size}', '{$cost}', '{$tourid}')";[!--colorc--][/span][!--/colorc--]
  5. Does anyone know of a good tutorial on how to set up a slash username system


    I'd hate to find out that it's actually done by creating folders for each user
    but assuming that's hopefully not the case

    is there a tutorial on this
    I would think that it involves editing the 404.shtml file to send the name of the invalid directory to your PHP file.....but if that was it........the address bar would change.


    Any clues?
  6. [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
    ....
    ....
    ....
    how deos everyone here get ahold of there photo's[/quote]
    was that whole post for that one question?

    well, you can always ask permission from someone to use their photo's for editing
    you don't necessarily have to buy all pics
    also they're a few websites out there that offer open source images so to speak

    I don't know any off hand
    just try googling around
  7. So apparently $pingtime is only an array if the ping was successful
    right?

    so set an IF statement, or my favorite a ternary statement that does this
    [code]echo is_array($pingtime)?"online":"offline";
    [/code]

    note that that would only display offline or online

    this is a 3rd party script
    it's being moved there

    please post in the correct forum
  8. set the name of the selection box to an array like

    <select name="names[]">
    ...
    </select>

    and put that along with your Create button in a form


    set the form to POST or GET to the same page

    then at the top of you're page check for that POST or GET value and create an array from that

    E.G
    [code]if(isset($_POST['names']))
       $names = $_POST['names'];
    [/code]
  9. [!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] *, substring(store,1,1) [color=green]AS[/color] first_letter, [color=blue]count[/color](*) [color=green]AS[/color] store_cnt [color=green]FROM[/color] [color=orange]stores[/color] GROUP BY first_letter [color=green]ORDER BY[/color] store; [!--sql2--][/div][!--sql3--]

    I'm not positive but I think if you put [b]SELECT [!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]*[!--colorc--][/span][!--/colorc--][/b]
    it just selects all the fields and ignores everything until the word FROM

    so try putting in all the fields you want
    along with the other to dynamic ones

    or at least trying doing just this and see what happens

    [!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] substring(store,1,1) [color=green]AS[/color] first_letter, [color=blue]count[/color](*) [color=green]AS[/color] store_cnt, name [color=green]FROM[/color] [color=orange]stores[/color] GROUP BY first_letter [color=green]ORDER BY[/color] store; [!--sql2--][/div][!--sql3--]
  10. PEAR DB is just a template system that uses PHP and MySQL
    it isn't a language

    you put in your MySQL server information
    you give it the HTML template you want

    and if you happen to know some more advanced coding strategies
    you can implement them with the existing templates

    I've only seen it once and as far as I know, it's probably easier to just not use it.
    but that's just my opinion
  11. PHP source code cannot be grabbed unless the creator makes in available in a php-source MIME type
    usually has the extension [b].phps[/b]

    PHP means Hypertext PreProcessor...so think of it as an HTML generator
    you make code to either logically make HTML code, or systematically make it.

    If someone did you a program to steal a PHP file
    like flashGet or getright
    all they would attain is the preprocessed HTML



    and as for your vocab questions
    1.INT = a number type
    2.NOT = self explanatory
    3.NULL = nothing
    4.AUTO INCREMENT = increment by one for every row
  12. Same here, although I'm like a grammar Nazi.

    I'm pretty considerate when it comes to someones question, I see no point in changing the subject to something stupid like a mispelled word rather than their main perogative.

    I speak both spanish and english so I know how hard it can be to sound...not foreign, in the spanish perspective for me.

    like ober said, if you can get [b]your[/b] idea of a [b]question across[/b] in whatever words it takes, it will be answered.
  13. you need to merge your background into one image

    you just need a line about 1024px wide
    and maybe 5px tall

    then you can do this

    [code]    body{
            font-family: Trebuchet MS, Lucida Sans Unicode, Arial, sans-serif;
            font-size:0.5em;
            margin:0px;
            padding:0px;
            text-align:center;
            background-image: url("background.jpg");
                    background-repeat: repeat-y;
            align:left;
        }[/code]
  14. you could much easier do the IF in the query itself like so
    [code]
    $sql = "
    IF ( SELECT name FROM bUser where name = '$name' IS NULL ) THEN
         INSERT INTO bUser Values ('$name','$mail');
    ELSE
         UPDATE bUser SET email = '$mail' where name = '$name';
    END IF;
    ";
    mysql_query($sql);[/code]

    I think that should work
  15. you can get a zip code database here

    [a href=\"http://civicspacelabs.org/home/releases/civicspace/civicspace-0.8.3.zip\" target=\"_blank\"]http://civicspacelabs.org/home/releases/ci...space-0.8.3.zip[/a]

    download it, extract it, and look through the folders for the zipcodes.sql file or something like that
    you'll have to INSERT them like 400 to 600 at a time on your MySQL server
    depending on your CPU speed.

    but that's a place to find the zipcodes

    and there a plenty of free script templates for distance
    most all free
    it's about 7 or so lines of code
  16. [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]do you mean creating a function on-the-fly???[/quote]
    I think he means that he wants to call functions from within a function

    just do it like you think you would
    [code]
    function Test() {
    return "function 1";
    }
    function Test2() {
    return "function 2";
    }

    function MainFunction() {
      $msg = Test();
      $msg .= Test2();
      return $msg;
    }

    echo Main();
    //returns function 1function2
    [/code]
×
×
  • 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.