I want that mysql data will be in one row but it doesn't, in my case data echoes in a right down side :(
http://lashatt.comoj.com/php+mysql.php
[IMG]http://lashatt.comoj.com/mysqlproblem.JPG[/IMG]
<?php
$user="a7247794_a724779";
$password="";
$database="a7247794_testdb";
mysql_connect("mysql5.000webhost.com",$user,$password);
@mysql_select_db($database) or die( "Unable to select database");
if (isset($_POST['saxeli']))
echo "saxeli {$_POST['saxeli']}";
$a = $_POST['saxeli'];
$query = "INSERT INTO contacts1(saxeli) VALUES ('$a')";
mysql_query($query) or die("Query failed: " . mysql_error());
mysql_close();
?>
<?php
$user="a7247794_a724779";
$password="";
$database="a7247794_testdb";
mysql_connect("mysql5.000webhost.com",$user,$password);
@mysql_select_db($database) or die( "Unable to select database");
if (isset($_POST['saxeli1']))
echo "saxeli {$_POST['saxeli1']}";
$b = $_POST['saxeli1'];
$query = "INSERT INTO contacts1(saxeli1) VALUES ('$b')";
mysql_query($query) or die("Query failed: " . mysql_error());
mysql_close();
?>
<form method="post">
<input name="saxeli" type="text" />
<br>
<input name="saxeli1" type="text" />
<br>
<input type="submit" name="Submit" value="დაპოსტვა" >
</form>
<html><head><title>MySQL Table Viewer</title></head><body>
<?php
$db_host = 'mysql5.000webhost.com';
$db_user = 'a7247794_a724779';
$db_pwd = '';
$database = 'a7247794_testdb';
$table = 'contacts1';
if (!mysql_connect($db_host, $db_user, $db_pwd))
die("Can't connect to database");
if (!mysql_select_db($database))
die("Can't select database");
// sending query
$result = mysql_query("SELECT * FROM {$table}");
if (!$result) {
die("Query to show fields from table failed");
}
$fields_num = mysql_num_fields($result);
echo "<table border='1'><tr>";
// printing table headers
for($i=0; $i<$fields_num; $i++)
{
$field = mysql_fetch_field($result);
echo "<td>{$field->name}</td>";
}
echo "</tr>\n";
// printing table rows
while($row = mysql_fetch_row($result))
{
echo "<tr>";
// $row is array... foreach( .. ) puts every element
// of $row to $cell variable
foreach($row as $cell)
echo "<td>$cell</td>";
echo "</tr>\n";
}
mysql_free_result($result);
?>
</body></html>