Jump to content

spoofer26

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Posts posted by spoofer26

  1. Hiya,

    Your right about the $row variable. Since you haven't defined it earlier in the script it will just be empty and print nothing. You assigned teh "numer of rows" to $numrows, so just use that.

    Also, You need to use {fancy brackets} around any variables you want inside of your SQL queries, otherwise it will search for a date > "$lastdate" (ie, including the dollar sign).


    Lastly: "Select count(*)" will return a single row containing information on how many rows would have been selected in a full query......that means mysql_num_rows()==1 all the time for that query.

    You forgot to end your line starting "mysql_query()" with a semicolon....thats whats making your T-String error .

    Try This:
    <?php

    $first_date_opened=$_GET['first_date_opened'];
    $second_date_opened=$_GET['second_date_opened'];

    $conn = @mysql_connect("","","")or die("sorry - could not connect to mysql");
    $rs = @mysql_select_db("",$conn) or die("problem with database");

    $result= mysql_query("SELECT * FROM fault WHERE date_opened > '{$first_date_opened}' AND date_opened < '{$second_date_opened}'");

    $query=$_GET['Query'];
    $num_rows = mysql_num_rows($result);

    if ($query=="Click to count")
    {
    echo "The number of faults is: ";
    echo ($num_rows) . " ";
    echo "<br><br>";
    }

    ?>
  2. Hi, im not technically a novice at PHP but since my problem involves printing to the browser i guess this is the place.

    can anyone explain why this:
    [code]
    <?php

    $test="img_id=2";

    echo  "<a href='http://gamersphere.com/topclans/index.php?vote=418' target='_blank'><img src='http://gamersphere.com/topclans/index.php?".$test."&img=418' border='0'></a>";


    ?>
    [/code]

    Outputs this:
    [code]
    <a href='http://gamersphere.com/topclans/index.php?vote=418' target="_blank">                                                                                 </a>
    [/code]
    (ie, for some reason the <img> tag is being turned to whitespace by the php parser).


    Is this expected behavior? it makes absolutely no sense to me.
×
×
  • 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.