By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,408 Members | 1,840 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,408 IT Pros & Developers. It's quick & easy.

Query failed with error: Unknown column 'bernard' in 'where clause'

P: n/a
Query failed with error: Unknown column 'bernard' in 'where clause'

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. session_start();
  3. ob_start();
  4. $host="localhost";
  5. $user="bernard";
  6. $pass="bernard";
  7. $dbase="myproj";
  8. mysql_connect($host,$user,$pass);
  9. mysql_select_db($dbase) or die("Failed to connect".mysql_error());
  10.  
  11. $limit=$_SESSION['user'];
  12.  
  13. $sql = "SELECT * from user where user = '$limit'";
  14. $sql2 = mysql_query($sql);
  15.  
  16. while($res = mysql_fetch_array($sql2))
  17. {
  18.  
  19. $fname=$res['fname'];
  20. $add=$res['add'];
  21. $country=$res['country'];
  22. $mm=$res['mm'];
  23. $dd=$res['dd'];
  24. $yy=$res['yy'];
  25. $date=$res['today'];
  26. }
  27.  
  28.  
  29.  
  30.  
  31. ?>
  32. <html>
  33. <head><title>•• POST A QUESTION & FOLLOW - Bernardo Cunanan ••</title></head>
  34. <body vlink="black" alink="black" link="black" background="bg.jpg">
  35. <font face=Arial size=3>
  36. <center>
  37. <table border=0>
  38.     <tr>
  39.     <td colspan=3><img src="logo.png"></td>
  40.     </tr>
  41.     <tr>
  42.     <td colspan=3> 
  43.         <link href="style.css" rel="stylesheet" type="text/css" />   
  44.                <div id="navigation">
  45.         <ul>
  46.                 <li><a href="home.php">HOME</a></li>
  47.                 <li><a href="about-sign.php">ABOUT</a></li>
  48.                 <li><a href="post-sign.php">POST</a></li>
  49.             <li><a href="members-sign.php">MEMBERS</a></li>
  50.                 <li><a href="logout.php">LOG-OUT</a></li>
  51.         <li><a href="contact-sign.php">CONTACT US</a></li>
  52.  
  53.  
  54.         </ul>
  55.     </div>  </td>
  56.     </tr>
  57.     <tr>
  58.     <td background="body.png" height=491 width=883>
  59.         <center>
  60.         <table>
  61.         <tr>
  62.         <td width=200 align=left><center><font color=#696969><img src="pic.jpg" border=4><br>
  63.         <a href="">(change avatar)</a></font></center></td>
  64.         <td width=400><font face=Arial size=4><ul>
  65.         <li>Name: <?php echo $fname; ?></li>
  66.         <li>Birthday: <?php echo $mm; ?>&nbsp;<?php echo $dd; ?>&nbsp;<?php echo $yy; ?></li>
  67.         <li>Address: <?php echo $add; ?>, <?php echo $country; ?></li>
  68.         <li>Member Since: <?php echo $date; ?></li>
  69.         <ul>
  70.         </td>
  71.         <td valign=top width=150 align=right>
  72.          <a href=""><font face=Arial size=4>Edit Profile</font></a>
  73.         </td>
  74.         </tr>
  75.         <tr>
  76.         <td>
  77.         <form>
  78.         <center>
  79.         <a href="new-post.php"><BUTTON name="submit" type="submit" size=5 style=width:150px>
  80.                 <font face=Arial size=4>New Post</font></BUTTON></a><br>
  81.                 <BUTTON name="reset" type="reset" style=width:150px>
  82.             <font face=Arial size=4>Edit Post</font></BUTTON><br>
  83.         <BUTTON name="reset" type="reset" style=width:150px>
  84.             <font face=Arial size=4>Delete Post</font></BUTTON>
  85.         </center>
  86.         </form>
  87.         </td>
  88.         <td><font face=Arial size=5><i>YOUR POST(s):</i></font>
  89.         <ul><font face=Arial size=4>
  90.  
  91.         <?php
  92.  
  93.  
  94.         $querydisplay = "SELECT * from post where user=$limit";
  95.         $result1 = mysql_query($querydisplay) or die("Query failed with error: ".mysql_error());
  96.  
  97.  
  98.         while($topic=mysql_fetch_array($result1))
  99.         {
  100.  
  101.         echo "<li>";
  102.         echo "<a href=post-view.php>". $topic['topicname']. "</a></li>";
  103.  
  104.         }
  105.  
  106.         ?>    
  107.         </font>
  108.         </ul>
  109.         </td>
  110.         </tr>
  111.         <tr>
  112.         <td colspan=2 valign=bottom align=left height=50><font face=Arial size=4>Other Information: I am techie critic, I love hot trivias about I.T.</td>
  113.         </tr>
  114.         </table>
  115.         </center>
  116.     </td>
  117.     </tr>
  118. <table>
  119. Copyright 2010<br>
  120. <a href="">College of Information and Communications Technology<br>
  121. Holy Angel University, Angeles City</a>
  122. </center>
  123. </font>
  124. </body>
  125. </html>
Oct 7 '10 #1
Share this Question
Share on Google+
1 Reply


code green
Expert 100+
P: 1,726
String values need wrapping in quotes
Oct 7 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.