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

Matching a textbox value with column value using php

Hie programmers.I am still new to web development. I am trying to match a textbox value to the one in the database. Here is my script below :


Expand|Select|Wrap|Line Numbers
  1. //Payments verification
  2.  
  3. $sql = "SELECT Econet_num FROM ecocash";
  4.  
  5. $result = $conn->query($sql);
  6.  
  7. if ($result->num_rows > 0) {
  8.  
  9.     while($row = $result->fetch_assoc()) {
  10.         if($myecocash ==$row['Econet_num']{
  11.          die("found");
  12.  
  13.         }
  14.  
  15.  
  16.  $conn->close();
  17.  
  18.  
  19. ?>
Nov 21 '15 #1
3 2449
RonB
589 Expert Mod 512MB
Expand|Select|Wrap|Line Numbers
  1. $sql = "SELECT count(Econet_num) FROM ecocash where Econet_num = $myecocash";
  2.  
  3. $result = $conn->query($sql);
  4.  
  5. if ($result->num_rows > 0) {
  6.     die("found");
  7. }
Nov 21 '15 #2
Okay I have tried your but it is giving this notice below

Notice: Trying to get property of non-object in C:\xampp\htdocs\adslonline\reg.php on line 48
Line 48 is where the if construct is located
Nov 21 '15 #3
RonB
589 Expert Mod 512MB
Did you get that error before making the change?

If the query is successful, $result will be an object, but if it fails it won't be defined and would be the cause of the error message.

What datatype is Econet_num configured as? Is it an int or varchar?

Try adding single quotes around $myecocash in the query.
Nov 21 '15 #4

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

Similar topics

4
by: Chumley the Walrus | last post by:
I'm using this sql parameter: MyCommand.Parameters("@Sport").value = Server.HtmlEncode(sport) to get a value from a textbox control: <asp:TextBox Name="sport" id="sport"...
2
by: dskillingstad | last post by:
I'm trying to assign a custom value to a textbox. Here's what I have. I've created a module and "default value" code for a textbox which generates a custom auto-number (yyyy-0000) when a New...
2
by: rockdale | last post by:
Hi, All: I have a datagrid that embedded 3 textbox using TemplateColumn. When the user key in value in the first textbox, I need to check to see if this value is between the the values in other...
30
by: SSG001 | last post by:
Hi, I'm using scriptaculous autocomplete for my text box and it works perfectly ok i have made server.php for fetching the values in the ul list and it is shown correctly on the main form but after...
1
by: tina2626 | last post by:
how can i pass textbox value to gridview using C#.net at runtime not using database values. i m hving textbox1 and gridview1. can anyone suggest me to do this coding in ASP.NET(C# language).
0
by: baburmm | last post by:
Hai, I want to get the footer textbox value in gridview using javascript any one help me Regards, Babu.K
10
by: Vivekneo | last post by:
Hi I am very new to web programming, trying to achieve a task, I have a form with 3 dropdown box and a text field(which is readonly). My problem now is, after selecting the above 3 dropdown boxes,...
12
by: pooja8389 | last post by:
good evening... how can store the text value of dynamically created textbox in database. using System; using System.Data; using System.Configuration; using System.Collections; ...
1
by: ram1592 | last post by:
how to get grid last column value using c#
1
by: kinjalkhamar | last post by:
I needed to validate textbox value from database using ajax call. i have inluded below in jsp file <script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script> i have...
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:
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.