Right well all i want to do is get info from my SQL database and echo it onto my page, here's the code i have so far...
PHP Code:
<?php function contact() { include("../mysql.php"); $db2 = new db; $db2->connect(); $sql = "SELECT * FROM contact_page"; $return = $db2->query($sql); while ( $row = mysql_fetch_array($return) ) { ?> <p> <?php echo @$row[Address]; ?> </p> <?php } } ?>
And here's my database layout....
Code:
id title text active
1 Address 123 Test Drive 1
2 Phone 123456789 1
Basically i want my script to get the 'text' from the row i need it from, i.e. If i want to display my 'Address' it would display '123 Test Drive' where i placed the code similar to '<?php echo @$row[Address]; ?>'.
Hopefully i've explained what i'm after well enough.
|