php does not loop through mysql results -


the form have created not receive entries.

here index.html:

<html> <body> <iframe name = "main_frame" src = "http://stelucir.com/entry_ac.php" style = "position:absolute; width:80%; height:70%; left:10%; top:12%;"> </iframe> <form name="form1" method="post" action="http://stelucir.com/entry_ac.php" target = "main_frame"> <div style = "position:absolute; width:80%; height:5%; left:0%; top:84%;">image:</div> <input type="text" name="one" id="one" style = "position:absolute; width:80%; height:5%; left:10%; top:83%;"><br> <div style = "position:absolute; width:80%; height:5%; left:0%; top:89%;">part descr:</div><input type="text" name="two" id="two" style = "position:absolute; width:80%; height:5%; left:10%; top:88%;"><br> <div style = "position:absolute; width:80%; height:5%; left:0%; top:94%;">email:</div>  <input type="text" name="three" id="three" style = "position:absolute; width:80%; height:5%; left:10%; top:93%;"> <input type="submit"  name="submit" value="submit" style = "position:absolute; height:5%; left:90%; top:93%;"> </form> </body> </html>  

here entry_ac.php:

<?php  $host="mysql7.namesco.net"; // host name $username="djangofawkes"; // mysql username $password="mypass"; // mysql password $db_name="ph392701_corpses"; // database name $tbl_name="part"; // table name  // connect server , select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select db");  // values form $one=$_post['one']; $two=$_post['two']; $three=$_post['three'];  // insert data mysql $sql="insert $tbl_name(one, two, three)values('$one', '$two', '$three')"; $result = mysql_query("select one, two, 3 part");  //loops through results echo "<table border='1'>";  while ($row = mysql_fetch_array($result, mysql_assoc)) {     echo "<tr><td>";     echo $row['one'];     echo "</td><td>";     echo $row['two'];     echo "</td><td>";     echo $row['three'];     echo "</td></tr>";  } echo "</table>";  mysql_free_result($result); ?>  <?php // close connection mysql_close(); ?> 

in phpmyadmin in mysql database input:

create table `test_mysql` ( `id` int(4) not null auto_increment, `one` varchar(65) not null default '', `two varchar(65) not null default '', `three` varchar(65) not null default '', primary key (`id`) ) engine=myisam auto_increment=0 ; 

when input form not display results of database, problem seems not go database @ loop seems work. go database on localhost , works partially. on localhost, loop works well. plz help.

you put sql query $sql, haven't run query...

look here: http://www.w3schools.com/php/php_mysql_insert.asp


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -