473,386 Members | 1,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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

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
1 4250
code green
1,726 Expert 1GB
String values need wrapping in quotes
Oct 7 '10 #2

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

Similar topics

0
by: Jonas Gorauskas | last post by:
I am having this one problem on an app I am writing where it shows the following error on some error trapping that I did: Query failed: Error Number: 1064 Description: You have an error in...
3
by: shreedhar | last post by:
If I try to delete a record from my table which is giving following error Warning: PostgreSQL query failed: ERROR: pg_atoi: zero-length string in /xxx/database.inc on line 73 What might be...
2
by: Zygo Blaxell | last post by:
I have a table with a few million rows of temperature data keyed by timestamp. I want to group these rows by timestamp intervals (e.g. every 32 seconds), compute aggregate functions on the...
5
by: Larry in Honolulu | last post by:
I'm getting an error message that makes no sense to me. I have a table with a field named 'testkey' for a list of "keys" in the form of ABC10102. I have a php variable holding a specific key...
2
by: boa sema | last post by:
Way back when, and at least in version 7 IIRC, the query optimizer gave up when the where clause in a statement contained more than 4 search conditions. Does anyone know if such a limitation...
3
by: benicio | last post by:
Database query failed: Unknown column 'subj' in 'where clause' What does this error mean and how should it be fix?
3
nomad
by: nomad | last post by:
Hello everyone: I new to PHP and I'm reading a book on PHP Bibles 2nd edition. It has to deal with a user-rating system. There are 4 scripts to it. I'm getting an error Unknown column...
8
by: omar999 | last post by:
i can a max value of a single column with where clause like this select MAX(Price_Band_1) AS HighestPrice from UK_Specials where ID IN (1,3,5,7,9,10,13,15,17,19,21,23,25,27,29,31,33,35,37) ...
1
by: luke noob | last post by:
This acually happends to all fields, i have made sure that i have connected to the right database name, if i post my query (SELECT id, imagePath, titleOfTutorial, descriptionOfTutorial, tutorialBy...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.