473,405 Members | 2,294 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,405 software developers and data experts.

how to check in the databse

142 100+
Hi,

I have 1 field where you enter a username and then it post to the next page, get mysql data and do what ever.

It there a small script or a sort code that I can add, for if someone types in a username and the username does not exist in mysql the page echo out "user does not exists, please click back")?

So anything that I can put on the page after someone submitted something that checks will be great, thanks.

Kind Regards
Louwrens
Nov 6 '07 #1
1 1004
pbmods
5,821 Expert 4TB
Heya, Louwrens.

Expand|Select|Wrap|Line Numbers
  1. $__sql = "
  2. SELECT
  3.         1
  4.     FROM
  5.         `table`
  6.     WHERE
  7.         `username` = '{$__escapedUsername}'
  8.     LIMIT 1";
  9.  
  10. $__res = mysql_query($__sql);
  11.  
  12. if( mysql_num_rows($__res) > 0 )
  13. {
  14.     // User exists.
  15. }
  16. else
  17. {
  18.     // User does not exist.
  19. }
  20. mysql_free_result($__res);
  21.  
Nov 6 '07 #2

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

Similar topics

7
by: Stefan Richter | last post by:
Hi, I am looking for a good function to check if a entered value is a money value - meaning it's a decimal with no more then 2 digits after the point. Thanks, Stefan
0
by: Jeroen Van Goey | last post by:
Hi, I want to put the OMIM databse locally on my computer. I downloaded the file genemap from ftp://ftp.ncbi.nih.gov/repository/OMIM/ It contains a list of fields, separated by the '|' character....
0
by: Exit12 | last post by:
Hi all I'm new to mysql so easy! I use PHPMyadmin as a front end to administering my databases but my simple question is how do I, from the command line (winxp prompt) drop a certain databse....
11
by: sreenivasan alakappan | last post by:
Hello, I want to create a database applciation in C++. I am using VC++ 6.0 as the deevelopment environment. When I ever i createa project, it only allows me to create a form based normal...
2
by: insomniux | last post by:
Hi, I need to check if a database is an .mde version (end user gets other menus's). In previous access versions the CurrentDB.properties("MDE") property seemed to work, but I clould not find this...
2
by: vadiraj86 | last post by:
how to check database is present or not before opening a connection I want to know how to check is databse present or not
3
by: JJ297 | last post by:
I need some assistance with a check box question. I have two check boxes on a page: <asp:CheckBox ID="ChkYes" runat="server" Text="Yes" / ID="ChkNo" runat="server" Text="No" /> This is...
1
by: Bakarre | last post by:
To display a field from databse and calculate time different -------------------------------------------------------------------------------- Good day, i have problem to display a field from...
2
by: deepika1 | last post by:
hi , i wrote a code for to delete the particular rows in a table using check boxes.But in that i select the particular rows and click on the delete button these rows didn't delete.plz check...
11
by: tokcy | last post by:
Hi everyone, I am new in php and ajax, i am facing the prob while i click on element of first drop down then in second dropdown all element showl come from database. I mean i have three dropdown 1....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.