You could write this into a query function, and then use multiple SQL queries.
I find this to be a more secure and robust implementation. It’s definitely more dynamic. Not knocking the author’s code, it’s two years old, and I am sure this was just a starting point.
You can store Login Details Like Username & Password in different file and then include it into above page instead of directly specified.Something like following
<?php
include "secure.php"; // include file for i.e username & password
$db = mysql_connect(HOSTNAME, USERNAME, PASSWORD) or die ('I cannot connect to MySQL.');
mysql_select_db(DATABASE_NAME);
$query = "SELECT testimonial,author FROM recommendations WHERE 1 ORDER by rand() LIMIT 1";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result))
{
echo "" , ($row['testimonial']) , " \n –" , nl2br($row['author']) , "";
}
mysql_free_result($result);
mysql_close();
?>
Just an FYI for newcomers. I suggest using the new php syntax. This is deprecated. You should be using prepared statements and mysqli connection, otherwise you’re vulnerable to sql injection.
Sweet!
Not the basic only. I liked it.
Thanks.
You are most welcome!
Hey friend
we guys are creating social networking site in aspx can u please give me some important tricks how i can make it more attractive
we want to create in semi flash mode can u help me
Thanks
Ambu
Hi, this script can only be implemented for a single table. Do you have any other script that works for more than one table.
Thank you.
You could write this into a query function, and then use multiple SQL queries.
I find this to be a more secure and robust implementation. It’s definitely more dynamic. Not knocking the author’s code, it’s two years old, and I am sure this was just a starting point.
Check out this class:
https://github.com/ajillion/PHP-MySQLi-Database-Class/blob/master/MysqliDb.php
You can store Login Details Like Username & Password in different file and then include it into above page instead of directly specified.Something like following
——–
and secure.php contains following data.
—
It is very secure method than above one.
Just an FYI for newcomers. I suggest using the new php syntax. This is deprecated. You should be using prepared statements and mysqli connection, otherwise you’re vulnerable to sql injection.
http://php.net/manual/en/book.mysqli.php