473,388 Members | 1,552 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,388 software developers and data experts.

Undefined variable: con Call to a member function query() on a non-object

pleas help me in resolving error in this part

Expand|Select|Wrap|Line Numbers
  1. <div class="output"> <?php $sql ="SELECT * FROM posts";
  2. global $conn;
  3. $result= $conn->query($sql);
  4. $result=mysql_query("SELECT * FROM posts WHERE name='$name' and msg='$msg' ");
  5. if(isset($_POST['name'])&&isset($_POST['msg']))
  6. {
  7.  
  8. $uname=($_POST['name']);
  9. $msg=($_POST['msg']);
  10. }
  11. if($result->num_rows>0) 
  12. while($row = $result->fetch_assoc()){
  13. echo "".$row["name"]." "."::" . $row["msg"]."--" .$row["date"]. "<br>";
  14. }
  15. else{
  16. echo "0 results";
  17. }
  18. $conn->close();
  19. ?> </div>
Aug 11 '18 #1
1 2232
zmbd
5,501 Expert Mod 4TB
You simply MUST tell us
- What is the error you are receiving
- What you wanted it to do
- What it is doing
-!- What YOU have already tried to fix the problem

Please use the [CODE/] formatting tool to format your script when posting :)

We cannot compile the code for you to troubleshoot
While many of us will review code, it's not really reasonable to just dump the code without explanation and expect us to read your mind.
Aug 11 '18 #2

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

Similar topics

37
by: Ben | last post by:
Hi, there. Recently I was working on a problem where we want to save generic closures in a data structure (a vector). The closure should work for any data type and any method with pre-defined...
2
by: dmitry.freitor | last post by:
Why would someone call a non-static provate member function from another non-static member function of the same class via the this pointer? Thanks. DF
1
by: muelli75 | last post by:
Hi! Im getting insane by solving a problem .... I try to define a function which uses a code-snippet from another file. My base are the codes from the great book "WebDataBase-Book by H....
8
by: nsharma78 | last post by:
Hi, I have a code as follows: class A { public: void print(){cout << "Magic" << endl;} };
18
by: tbringley | last post by:
I am a c++ newbie, so please excuse the ignorance of this question. I am interested in a way of having a class call a general member function of another class. Specifically, I am trying to...
2
by: mahesh | last post by:
Can anyone direct me to the place where i find the solution for the error message "cannot call member function 'X' without object"??? thanks in advance
2
by: Elliott | last post by:
Hello Everyone, I have a function in a header (KeyDialog.h) as such: void setKey(Key&); The function implementation is as such (KeyDialog.cpp): void KeyDialog::setKey(Key& k1) {
2
by: church7 | last post by:
Hello, I wrote the following class: In this case, the error message was
10
by: randysimes | last post by:
I am trying to pass uid and pwd to the function CheckPW of the class PWServer. I receive the error pwclient.cpp:41: error: cannot call member function âint PWServer::CheckPW(const char*, char*)â...
8
by: kkshansid | last post by:
I again started working on php after 4 years but now when i run any php project it gives following error which was fine 4 years back.I am using wamp 2.2 ( ! ) Notice: Undefined variable: PDF in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.