Jump to content

How to use Mysql(phpmyadmin) to print data title on page


ljzxtww

Recommended Posts

hi:

 

I want to create a URL into mysql data(phpmyadmin)

i want to put url into mysql data(phpmyadmin)

I want to print on page.

like title call  <?php bloginfo('name');  and this data is in phpmyadmin. and print name on php page call <title>PHP Freaks Forums </title>

how to print on page. and also other stuff. like I want to print URL, tilte, bbsurl

db_ceoemail

 

please help me

 

thank u

Larry

Are you familiar with using SELECT from mysql to grab a row from your database, and then how to successfully output it? If not, I'd suggest reading some tutorials.

 

yes I got it work. but I wrong messenge:

 

Parse error: syntax error, unexpected '<' in C:\www\test\hearder.php on line 2

code is:

 

<?php

<title>echo $rows['db_names']</title>

?>

 

 

<?php

echo "<title>$rows['db_names']</title>";

?>

 

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Program Files\www\hearder.php on line 2

 

problem again

 

 

You need to learn a few basics about outputting variables to the screen.

 

First off, when you are in between <?php and ?>, the only thing printed as html is that which is echo'd.

 

Secondly, You have to end any and every line with a semicolon. Example: echo "hello world!";

 

Thirdly, if you are using double quotes for your echo, using an array with a string as an index cannot be in a single quote. Example: echo "$row[variable]"; not echo "$row['variable']";

 

Fourthly, if you are using single quotes, the only way to display a variable is to temporarily end the quote, truncate the variables with periods(.'s) and then startthe quote again. Example: echo 'The value '.$variable.' has been set into a variable'; not echo 'The value $variable has been set into a variable';

 

So in summary. If you want some variable between title tags, you can do it a few different ways:

 

either: <?php echo "<title>$variable</title>"; ?>

 

or

 

<title><?php echo $variable; ?> </title>

 

and ther are other slight variations, but those are the main 2.

<?php
    echo '<title>'.$rows['db_names'].'</title>';
?>

or

 

<?php
echo "<title>{$rows['db_names']}</title>";
?>

 

I believe the second one is right.... berate me and call me a fool if not..

 

Nate

 

I believe they are both correct. Putting a variable in between curly braces is as if you ended the quote, truncated with dots, and then continued the quote afterwards. so it's be equivalent to <?php echo "<title>".$rows['db_names']."</title>"; ?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.