SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    exit();
    Join Date
    Jul 2000
    Posts
    759
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <?php
    
    // MySQL Variables
    
    $host = "localhost";
    
    $user = "root";
    
    $pass = "pw";
    
    $dbcnx = @mysql_connect("$host", "$user", "$pass");
    
    mysql_select_db('db');
    
    $result = mysql_query("SELECT serverid, tech1_name FROM customers LIKE %'$search'%");
    
    while ( $row = mysql_fetch_array($result) ) {
    $serverid = $row["serverid"];
    $tech1_name = $row["tech1_name"];
    
    echo("$serverid owned by $tech1_name"); 
    
    }
    
    ?>
    I get an error on this line:

    while ( $row = mysql_fetch_array($result) ) {

    Any ideas? Thanks.

  2. #2
    SitePoint Enthusiast
    Join Date
    Nov 2000
    Location
    Allentown PA
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Should be:

    $result = mysql_query("SELECT serverid, tech1_name FROM customers LIKE '%$search%'");

    The %s are just wildcard characters and should be treated like they're part of the string.

  3. #3
    exit();
    Join Date
    Jul 2000
    Posts
    759
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the fast reply Ed..

    Actually I did this though:

    Code:
    $result = mysql_query("SELECT serverid, tech1_name FROM customers WHERE serverid LIKE '%$search%'");
    ..thanks to robp



Bookmarks

Posting Permissions

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