开发者

Php , my sql and jquery [closed]

开发者 https://www.devze.com 2023-03-08 02:36 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be r开发者_如何学Ceasonably answered in its current form.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be r开发者_如何学Ceasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I have a table in my MySQL database called studentname.

I made an array in Javascript as var array1=["john","sam","peter","kelvin"];

I populated a select box with these array values.

If the table studentname contains names like "sam" and "peter", now I want to populate the select box with the values "john" and "kelvin" only, because "sam" and "peter" are already present in the database table.

How am I supposed to do this?


This is a three-step process:

  1. Modify your PHP script to connect to the database and retrieve the names from the 'studentname' table.
  2. Output the names as a separate Javascript array.
  3. When you create your select in Javascript, compare the values of array1 to the array created by your PHP code, and output only the elements that are unique.
0

精彩评论

暂无评论...
验证码 换一张
取 消