In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "what is the development of MySQL database under Linux". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
What is the development of MySQL database under Linux
Voidmain (intargc,charargv [])
{
/ / parse the user name and password submitted by the user and save them to variables username and password-usr
...
/ / create a socket with the native mSQL database system
Sock=msqlConnect (NULL)
/ / Select database test
If (msqlSelectDB (sock, "test") =-1)
{
/ / output database selection failure information
...
} else
{
Sprintf (buff, "selectfromregistered-userwhereusername='%s'", username)
/ / query the records in table registered-user with username
If (msqlQuery (sock,buff) =-1)
{
/ / output the error message of query failure
...
}
/ / Save the query results to the pointer variable res of type m-result
Res=msqlStoreResult ()
/ / the number of records obtained from the query result
Numrow=msqlNumRows (res)
If (numrow==1)
{
/ / get the current record, type: m_row
Row=msqlFetchRow (res)
/ / compare the password saved in the table with the password entered by the user
If (! strcmp (password_ur,row [2]))
{
/ / output registration success information
} else
{
/ / output the prompt that the password is incorrect
}
} else
{
/ / output user name input error message
}
}
/ / release the pointer to the query result
MsqlFreeResult (res)
/ / close the socket of the database system
MsqlClose (sock)
Return
}
What is the development of MySQL database under Linux
The above examples contain the main functions used to integrate MySQL into C language programs, which can basically meet the needs of the application. If the C-like language that w3-msql can explain is embedded into the html file, the same function can be achieved. Different from the CGI program written in C language, the script language does not need to be compiled. The script is interpreted and executed by the CGI program w3-msql provided by the MySQL database system. The main code snippets in the script are as follows:
The following is the referenced content:
< HTML >
< HEAD >
< METAHTTP-EQUIV= "Content-Type" CONTENT= "text/html;charset=iso-8859-1" >
< / HEAD >
< bodyTEXT= "# 000000" BACKGROUND= "/ icon/back.jpg" topmargin= "10" >
/ / parse the user name and password submitted by the user and
Save to variables username and password-usr
...
/ / create a socket with the native mSQL database system
$sock=msqlConnect ()
/ / Select database test
If (msqlSelectDB ($sock, "test") =-1)
{
/ / output database selection failure information
Fatal ("error: unable to connect to database n")
} else
{
$buff= "selectfromregistered-userwhereusername='$username'"
/ / query the records in table registered-user with username
If (msqlQuery ($sock,$buff) =-1)
{
/ / output the error message of query failure
Fatal ("query error n")
}
/ / Save the query result to the pointer variable res of the query result
$res=msqlStoreResult ()
/ / the number of records that got the query results
$numrow=msqlNumRows ($res)
If ($numrow==1)
{
/ / get the pointer to the current record
$row=msqlFetchRow ($res)
/ / compare the password saved in the table with the password entered by the user
If (! strcmp ($password-ur,$row [2]))
{
/ / output registration success information
Echo ("< center > registered successfully < / center >")
} else
{
/ / output the prompt that the password is incorrect
Echo ("< center > the password you entered is incorrect < / center >")
}
} else
{
/ / output user name input error message
Echo ("< center > the user name you entered is incorrect < / center >")
}
}
/ / release the memory occupied by the query results
MsqlFreeResult ($res)
/ / close the socket of the database system
MsqlClose ($sock)
>
< / BODY >
< / HTML >
This is the end of the content of "what is the development of MySQL database under Linux"? thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.