(adsbygoogle = window.adsbygoogle || []).push({});
This tutorial is not for PHP newbs, it is not advanced either. With this you would be able to call the content in specific rows in your MySQL table. I'm not going to go into depth about this.
First off you want to make your MySQL connection (Yes, I'm using the old mysql functions.):
<?php
mysql_connect("localhost", "db_user", "db_user_password");
mysql_select_db("your_db_name");
?>
Now you're gonna start your query, to call everything from the table you use the asterisk (*):
<?php
$query = "SELECT * FROM table_name";
$result = mysql_query($query);
?>
And now comes the part where you will call the row you want to echo out:
<?php
while($row=mysql_fetch_array($result))
{
$title = $row['title'];
$name = $row['body'];
}
?>
To call the row you want, as you can see you use the while function and declare $row variable. The mysql_fetch array function returns an array of strings that corresponds to the fetched row. Within the while loop you define which rows you want to fetch, you can name the variables anything you want, but when setting them you will need to use the variable you used as $row. When you want to echo the contents of the row in some HTML, it would look like so:
<html>
<body>
<?php echo $title . "<br>" . $name; // For the variables to be echo'd you have to concatenate them.
</body>
</html>
Thanks for taking the time to read my short tutorial. Sorry if I missed explaining something or I didn't go into detail enough for you to understand it. I have a hard time with explaining things and hope to get better when making future tutorials. :y: