+ 1

How to link Html input type to sql

17th Sep 2018, 3:05 PM
USAMA WIZARD
USAMA WIZARD - avatar
10 Answers
+ 1
This is the simplest way to insert data into a database... save it as PHP and run on a server for PHP to run <html> <form action="" method="POST" <input type="text" name="someText" id="someText> <input type="submit" value="insert"> <?PHP mysql_connect("host","user","password") or die (mysql_error()); mysql_select_db("database") or die(mysql_error()); if(isset($_POST['someText'])){ $someText=$_POST['someText']; $sql="INSERT INTO table VALUES($someText)"; $query=mysql_query($sql); if(!$query){ die(mysql_error());} else{ echo "data inserted successfully"; } ?> </form>
22nd Sep 2018, 5:57 PM
Jacob
Jacob - avatar
+ 1
send me code hisham
20th Sep 2018, 3:40 PM
USAMA WIZARD
USAMA WIZARD - avatar
+ 1
how to install PHP in windows
21st Sep 2018, 6:55 AM
USAMA WIZARD
USAMA WIZARD - avatar
+ 1
if you want to retrieve data from the database <?PHP $conn=mysql_connect("host", "user", "password", "db"); /* here I have combined both connection and database selection*/ /* the code */ $sql="SELECT * FROM table" /* this will select all data from the specified table */ $result=$conn->query($sql); if($result-> num_rows > 0){ /* this code will run until all the rows in the table are fetched and displayed */ while($row=$ result->fetch_assoc()){ echo $row[ "a row in your database"]} else{ echo "no result found. Table is empty"} $conn->close() ?>
22nd Sep 2018, 6:12 PM
Jacob
Jacob - avatar
0
you need php
17th Sep 2018, 4:10 PM
Leo Hisham
0
the code will depend upon the your forms, the databases that you used. so i cant send the code. reffer youtube for more information.
21st Sep 2018, 5:58 AM
Leo Hisham
0
send me any link
21st Sep 2018, 6:45 AM
USAMA WIZARD
USAMA WIZARD - avatar
0
you need php knowledge
21st Sep 2018, 11:48 AM
Jacob
Jacob - avatar
0
send me code
22nd Sep 2018, 3:38 PM
USAMA WIZARD
USAMA WIZARD - avatar