Learning Mysql



Download 4.24 Mb.
View original pdf
Page364/366
Date04.08.2023
Size4.24 Mb.
#61806
1   ...   358   359   360   361   362   363   364   365   366
Learning MySQL
\n";
// Finish the row print "\n";
}
?>
406 | Chapter 13:
Web Database Applications


// ... and printout each of the columns foreach($row as $data)
print "\t
{$data}






// Set initial value for the variable
$Variable=110;
// Display the initial variable value.
echo "


";
// Pass the variable by value to the AddNineteen_value() function.
AddNineteen_value($Variable);
// Display the variable value after passing it by value.
echo "


";
// Pass the variable by reference to the AddNineteen_reference() function.
AddNineteen_reference($Variable);
// Display the variable value after passing it by reference.
echo "


";
// Function to add 19 to the received variable the function receives the variable value.
function AddNineteen_value($MyVariable)
{
$MyVariable+=19;
Language Basics | 425


}
// Function to add 19 to the received variable the function receives a reference to the variable (note the ampersand before the variable name).
function AddNineteen_reference(&$MyVariable)
{
$MyVariable+=19;
}
?>

Step

Variable Value
Initial value$Variable
After passing by value$Variable
After passing by reference$Variable

Artists







// Connect to the MySQL server if (!($connection = @ mysql_connect("localhost", "root",
"the_mysql_root_password")))
die("Cannot connect");
if (!(mysql_select_db("music", $connection)))
die("Couldn't select music database Run the query on the connection if (result = @ mysql_query("SELECT * FROM artist",
$connection)))
die("Couldn't run query Until there are no rows in the result set, fetch a row into the row array and while (row = @ mysql_fetch_array($result, MYSQL_ASSOC))
{
// Start a table row print "\n";
artist_idartist_name

Download 4.24 Mb.

Share with your friends:
1   ...   358   359   360   361   362   363   364   365   366




The database is protected by copyright ©ininet.org 2024
send message

    Main page