Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Databases _ php and mysql

Posted by: sanjay akella Jul 16 2011, 05:27 AM

ive been working on registration page,with the help of html,php,mysql(wamp server) for over a day but cudnt figure it out..
please pull me out of this situation...im posting my code ova here..
im juz posting a small example over here(not the original one which i was working on)



test.html
<html>
<body>
<form action="new.php" method="post">
name:<input name="name" type="text" size="20" maxlength="10">
address:<input name="address" type="text" size="20" maxlength="10">
<input name="submit" type="submit" />
</form>
</body>
</html>



new.php
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$db = 'test';
$sql = "SELECT * FROM `testing_table` LIMIT 0, 30 ";
$conn = mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db = ($db);
$name=$_POST['name'];
$address=$_POST['address'];
$query="insert into testing_table('id','name','address') values(NULL,'$name','$address')";
$result=mysql_query($query);
echo $sql;
?>


here is the picture of structure of mysql table
IPB Image




Posted by: Mahdi Eftekhari Feb 20 2012, 08:22 PM

could not figure out what!? What is the problem? Are you getting error message? If yes what is the message?
You need to give more details of what you want to achieve.

Based on lack of details and your code I am guessing you are not getting your result back.

In your new.php code at the end after

CODE
$result=mysql_query($query);
you need to extract the result first. something like this
CODE
$resultSet = mysql_fetch_array($result)

and then go through the array.

if this was not your problem give more detail.

Thanks
Mahdi Eftekhari

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)