473,800 Members | 2,342 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to check in the databse

142 New Member
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 1016
pbmods
5,821 Recognized Expert Expert
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
5195
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
1748
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. An example is: 1.1|9|11|95|1pter-p36.13|CCV|P|Cataract, congenital, Volkmann type||115665|Fd|linked to Rh in Scottish family||Cataract, congenital, Volkmann type (2)| | || 1.2|9|25|01|1pter-p36.13|ENO1, PPH, MPB1|C|Enolase-1, alpha||172430|S,
0
1343
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. so once I log into mysql, using mysql -u root, how would I go about deleting whole databases?
11
1639
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 application or a databse application. But I dont want that. My aim, is read some input file, extract certain valeus and write into the database. I want to connect to access or some database, there is no particular need in this.ALl i will need in this...
2
3272
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 property in Access 2000. Is it possible to check if the databse is .mde in 2000 other than extracting the .mde part from the name (is risky AFAIC). Thanks,
2
1239
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
1684
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 under button_Click
1
1281
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 databse and calculate time different. See below my code. I hope somebody can fix the problem for me. <?php
2
1550
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 it what's the problem in that code. <?php $host="localhost"; // Host name $username="root"; // Mysql username $password=" "; // Mysql password
11
4646
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. category which comes from database 2. brand which comes from databse according to content of first dropdown . and 3. price which is static. when i am doing these things without ajax on every onChange() thw whole page is refreshing that i do not...
0
10505
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10253
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10035
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9090
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7580
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6813
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5471
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.