Help - Search - Members - Calendar
Full Version: Whats The Problem With My Sql Query
Zymic Webmaster Forums > Zymic Free Web Hosting > Zymic Free Web Hosting - General Discussion & Help
janu121
Dear Administrator

Very happy and satisfied from your service but i m stucked at a point that my following query is not showing any result. I have run this query on phpmyadmin it is working fine and showing db records.
Please help me

CODE
<?php
include("header.php");
mysql_connect("localhost", "123", "123" ) or die (mysql_error());
mysql_select_db ("mydb");
$city = $_POST['city'];   // getting from other page..

$message = "";

$result = mysql_query("SELECT * FROM 'plot' WHERE city LIKE '$city'");
?>

<div align="center" id="table">
    <h2>Search Results for Plot</h2>
<?php

if($result) {
    
  
    echo '<table width="100%" border="0" cellspacing="1" cellpadding="5>';
  
    echo '<tr class="loginfield">';

    echo '<td> <strong>UserName</strong></td>';
    echo '<td><strong>City </strong></td>';
    echo '<td><strong>Location </strong></td>';
    echo '<td><strong>Price </strong></td>';
    echo '<td><strong>Description </strong></td>';
      
    echo '</tr>';
    
    while ($row = mysql_fetch_assoc($result)) {
         echo '<tr bgcolor="#FFFFFF" class="loginfield">';
         echo '<td align="left" >'.$row['username'] .
         '</td><td align="center">' .$row['city'].
         '</td><td align="center">'.$row['location'].
         '</td><td align="center">'.$row['price'].
         '</td><td align="center">'.$row['description'].
         '</td>';
         echo '</tr>';
        
    }
}


else { "No record Found!"; }

    
    
    
    echo '</table>';

?>
</div>            
<font color="#D4E6F4"><?php include("footer.php"); ?></font>


Dave

I'm not a PHP coder, but perhaps you are entering your database details incorrectly.

DB name and username should be in the format: DOMAIN_DBUSER
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.