taking from the database
Posted: Sat Jun 14, 2003 3:10 pm
I'm trying to get column info from a database. There is only 1 row per table and all i want to do is put it on an html page. Here is my code so far:
After Store#: all it says shows is . Shouldnt it show the info in my database?
Is there something wrong with what I am doing, or is there an easier way or more complex way?
Thank you,
Outlaw
Code: Select all
<form method="post" action="<?php echo $_SERVERї'PHP_SELF']; ?>">
<input type="text" name="projectid">
</form>
<br>
<?php
if (!empty($_POSTї'projectid']) ) {
$projectid = $_POSTї'projectid'];
$storenumber = "SELECT storenumber FROM $projectid WHERE storenumber > 0";
$user = 'blahuser';
$pass = 'blahpass';
$db = 'projectsdb';
$link = mysql_connect('localhost', $user, $pass) or die('<p>Could not connect to MySQL server.</p>');
mysql_select_db($db) or die('<p>Could not select '.$db.' database');
}
?>
Store#:<?php echo $storenumber; ?>Code: Select all
SELECT storenumber FROM $projectid WHERE storenumber > 0Is there something wrong with what I am doing, or is there an easier way or more complex way?
Thank you,
Outlaw