I have a table where is a row called ID and I want to save that ID to variable that I can use later on the same PHP file. How can I do it?
<?php
include 'config.php';
// Connect to server and select databse.
mysql_connect("$dbhost", "$dbuser", "$dbpass")or die("cannot connect");
mysql_select_db("$dbname")or die("cannot select DB");
$result = mysql_query("SELECT * auto_matkat");
$row = mysql_fetch_array($result)
$IND = $row['IND'];
echo $IND;
}
mysql_close($con);
?>
In case CoDe ADDict’s code is a bit complex for you this one may be a bit simpler:
Here is a great website for beginners learning PHP & MySQL connections: http://www.freewebmasterhelp.com/tutorials/phpmysql