Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2003
    Posts
    2

    Red face Unanswered: Y Wont This Php Script Work???? :'(

    hi can ne1 help me here, i'm trying 2 display all the records in a table where X = ????

    i can display all the records in the table but i need the specific 1's

    it comes up with and error on line 24 which is where i make the table to display the results

    its the same code as i've used b4 to display all the records and it works 4 th@ but cant figure aout y this dont wana work

    i'm using MySQL as my Database if th@ helps??

    PHP CODE:

    <HTML>

    <Body bgcolor='#000000'><font face= "verdana" color= "ff0000">

    <Body>

    <center>
    <h1>Action DVDs</h1>

    <?php

    $db_name="bv";

    $table_name="DVDs";

    $connection=mysql_connect("localhost","root","") or die ("connect fail");

    $db=mysql_select_db($db_name,$connection) or die("dbselect fail");

    $sql="select * from $table_name where $Filmgenera=\"Action\"";";"; //<---- SQL Statement i'm tryin 2 use

    $rst=mysql_query($sql, $connection);

    echo "<table border=1 width='100%'>"; //<---- PHP Says error on this line????

    echo "<tr><td><font color='#FF0000'><b>Film ID</b></td>";

    echo "<td><font color='#FF0000'><b>Title</b></td>";

    echo "<td><font color='#FF0000'><b>Type</b></td>";

    echo "<td><font color='#FF0000'><b>Genera</b></td>";

    echo "<td><font color='#FF0000'><b>Rating</b></td>";

    echo "<td><font color='#FF0000'><b>Price</b></td>";

    echo "<td><font color='#FF0000'><b>Quantity</b></td></tr>";

    While($row=mysql_fetch_array($rst))

    {
    $Filmid = $row[Filmid];
    echo "<tr><td><font color='#FF0000'>$Filmid</td>";

    $Filmname = $row[Filmname];
    echo "<td><font color='#FF0000'>$Filmname</td>";

    $Filmtype = $row[Filmtype];
    echo "<td><font color='#FF0000'>$Filmtype</td>";

    $Filmgenera = $row[Filmgenera];
    echo "<td><font color='#FF0000'>$Filmgenera</td>";

    $Filmprice = $row[Filmprice];
    echo "<td><font color='#FF0000'>$Filmprice</td>";

    $Filmrating = $row[Filmrating];
    echo "<td><font color='#FF0000'>$Filmrating</td>";

    $Filmqty = $row[Filmqty];
    echo "<td><font color='#FF0000'>$Filmqty</td>";

    echo "</tr>";
    }

    echo"</table>";

    ?>

    </Body>

    </HTML>

  2. #2
    Join Date
    Feb 2002
    Location
    North Wales, UK
    Posts
    114
    PHP Code:
    Try replacing the following line:

    $rst=mysql_query($sql$connection);

    With this line:

    $rst=mysql_query($sql$db); 
    J^ - web | email
    newsASP Developer

  3. #3
    Join Date
    Jul 2003
    Posts
    2

    Talking Thanx but guess what?? :)

    i still worked @ it, and got it working,

    i was just stating the statement in the wrong way!

    but thank you very much 4 helping

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •