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

Javascript can link to mysql?

65
<head>
<script type="text/javascript">
function delete_confirm()
{
var r=confirm("Are you sure you want to delete this record?")
if (r==true)
{
<!--start to link to mysql to delete the particular record-->
}
}
</script>
</head>

my question is how to connect to mysql using the javascript if the user press button ok or true to comfirm he/she want to delete the record?

if i open the php tag in between like this

if (r==true)
{
<?
mysql_connect("localhost","student","123") or die (mysql_error());
...
?>
}
it is look like cant work after i tested..

Someone can guide me to complete my confuse...
May 29 '07 #1
4 2101
dmjpro
2,476 2GB
did u hear the term AJAX.
it is the soultion of ur Q.
mind it in JS it is not valid to connect with DataBase directly.
in AJAX u can make client fool that ur page accessing DataBase through JS.

kind regards.
dmjpro.
May 29 '07 #2
r035198x
13,262 8TB
<head>
<script type="text/javascript">
function delete_confirm()
{
var r=confirm("Are you sure you want to delete this record?")
if (r==true)
{
<!--start to link to mysql to delete the particular record-->
}
}
</script>
</head>

my question is how to connect to mysql using the javascript if the user press button ok or true to comfirm he/she want to delete the record?

if i open the php tag in between like this

if (r==true)
{
<?
mysql_connect("localhost","student","123") or die (mysql_error());
...
?>
}
it is look like cant work after i tested..

Someone can guide me to complete my confuse...
Javascript is client side and does not connect to databases. You need a server side language to do that. You may use ajax to call the server side script that connects to the database.
May 29 '07 #3
wish
65
i never heard AJAX before...and i also dun know how to use it.

can u guide me?
May 29 '07 #4
acoder
16,027 Expert Mod 8TB
i never heard AJAX before...and i also dun know how to use it.

can u guide me?
See the tutorials in the Offsite Links thread.
May 29 '07 #5

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

Similar topics

2
by: Jackson Yap | last post by:
can someone kind enough to help me look at the attached html and js file? Why is it that the javascript menu could not work at www.apchosting.net but could work at...
1
by: Jackson Yap | last post by:
can someone kind enough to help me look at the attached html and js file? Why is it that the javascript menu could not work at www.apchosting.net but could work at...
1
by: Satish.Talyan | last post by:
hi, i want to create a dynamic tree hierarchy in javascript.there are two parts in tree, group & user.when we click on group then users come under that's tree category will be opened.problem is...
10
by: IchBin | last post by:
I am trying to set the state of a radio button. I do not see what I am doing wrong. Sorry, I am new at this.. I need another set of eyes to look at this snip of code. I am trying to set the radio...
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
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...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
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...

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.