Jump to content

Problem with showing specific details.


aktell

Recommended Posts

Hi there,

 

A small problem I hope. I'm trying myself in different items out of books so I can learn more about Php and Mysql, and I came accross four different code snippets One is working and three have the same problem no correct readout.

 

<?
if ($artist_fn != "") {
$artist_fullname = trim("$artist_fn $artist_ln");

//************ error is in here - else - ??? ***************

$artist_fullname } else {
$artist_fullname = trim("$artist_ln");
}
//************************************************

if ($date_acq == "0000-00-00") {
$date_acq = "[unknown]";

$display_block .= "<P><strong>$title</strong> on $rec_label,
by $artist_fullname<br>
$my_notes <em>(acquired:$date_acq, format:$format)</em></P>";
}
?>

Thanks for any help aktell

Link to comment
Share on other sites

Look at the colored part,

the variable is just written outside any definition or echo and it misses the mandatory ;

 

 

if ($artist_fn != "") {

$artist_fullname = trim("$artist_fn $artist_ln");

 

//************ error is in here - else - ? ***************

$artist_fullname; } else {

$artist_fullname = trim("$artist_ln");

}

//************************************************

 

 


Look at this
<?php

if ($artist_fn != "") {
$artist_fullname = trim("$artist_fn $artist_ln");
}
else {
$artist_fullname = trim("$artist_ln");
}

if ($date_acq == "0000-00-00") {
$date_acq = "[unknown]";

$display_block .= "<P><strong>$title</strong> on $rec_label,
by $artist_fullname<br>
$my_notes <em>(acquired:$date_acq, format:$format)</em></P>";
}

?>

 

FYI: I was only fixing your problem, not made any other improvements or changes.

Link to comment
Share on other sites

Well this is  wrong:

 

$artist_fullname } else {

 

It doesn't make sense. Its not a complete statement.

 

Just take out '$artist_fullname' and it should be ok.

 

 

Thanks alot both ways worked. No error problem shown. But there is no print out either as yet, i will give it another try.

Thanks again

Link to comment
Share on other sites

Well did you echo $display_block any where? And it looks like your } might be in the wrong place. See if this isn't what you want to do instead

//old
if ($date_acq == "0000-00-00") {
$date_acq = "[unknown]";

$display_block .= "<P><strong>$title</strong> on $rec_label,
by $artist_fullname<br>
$my_notes <em>(acquired:$date_acq, format:$format)</em></P>";
}

//new


if ($date_acq == "0000-00-00") {
   $date_acq = "[unknown]";
} // otherwise display block only gets filled out if there is no date.
$display_block .= "<P><strong>$title</strong> on $rec_label,
by $artist_fullname<br>
$my_notes <em>(acquired:$date_acq, format:$format)</em></P>";

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.