Re: Possible Syntax Error
For the logo to appear, you have to use an img tag.
PHP Code:
<td id="team" width="20%">' . $away['team'] . '</td>
Instead of concatenating the $away['team'], you have to use an img tag and put the URL in the src property pointing to the team shield.
HTH,
HoraShadow
Re: Possible Syntax Error
Exactly,
I am learning PHP so I am not familiar with the proper syntax.....
I know the img tag is <img src=""></img>
Re: Possible Syntax Error
Never never ever use echo to display HTML. It is unnecessarily sloppy and results in unreadable code such as the above (not to mention your wacky indentation). All you need to do is close the PHP tags: ?>.
PHP Code:
<img src="<?php echo $away['R'] ?>" alt="<?php echo 'some appropriate text equivalent' ?>">
<img> does not have a closing tag in HTML.
Re: Possible Syntax Error
It's best practice not to echo HTML, only the required portion. You really should do it and enforce it from now on.
I'm going to reply with your current code, as you have it now. When you have this working, I suggest you clean up the code.
PHP Code:
<td id="team" width="20%">' . $away['team'] . '</td>
Should be replaced with:
PHP Code:
<td id="team" width="20%"><img src="' . $away['logoURL'] . '" /></td>
Where logoURL should be the link to the team logo image, in this case, the away team.
HTH,
HoraShadow
Re: Possible Syntax Error
Once I get it working what is the best way to clean up the code? Any sites. I am not that experienced yet!
Code:
<td id="team" width="20%"><img src="' . $away['http://robbyzworld.com/personal/images/sports/teams/tex.jpg'] . '" /></td>
The above code still doesn't work!
Re: Possible Syntax Error
that URL should be stored inside a field in the database, since you are fetching it from there.
In the database structure, you have to add a field to store the team logo picture URL. That way, when you fetch the team information, you also have the logo URL.
You have to update your database structure first, and then you will be able to access it with $away['logoURL'] .
Example of clean code:
PHP Code:
<table border="1">
<tr>
<td>Team Name:</td>
<td><?php echo $away['team']; ?></td>
</tr>
</table>
Notice that the HTML is treated as HTML, not as a concatenation on PHP, and when PHP has to display a dynamic value, it echoes only that value in it's specific place.
HTH,
HoraShadow
Re: Possible Syntax Error
ahh ok yeah, cleaned that up...
now to set the size of the image how does that play in this line of code?
Code:
width="25" height="25"
Re: Possible Syntax Error
If you want to resize the image, you have to add those properties to the <img> tag.
It should look something like this in the cleaned up way:
PHP Code:
<img width="25" height="25" src="<?php echo $away['logoURL'] ?>" />
HTH,
HoraShadow
Re: Possible Syntax Error
Width and height are presentational attributes and all presentation should be done using CSS and HTML. Give your image an ID attribute and specify width and height in your stylesheet.
Re: Possible Syntax Error
ok it works....
now time to clean up.
Seeing how you guys are far more experienced than I am, what ways would you recommend for me learning the best way to clean up my code?
Re: Possible Syntax Error
Don't forget the "alt" description within the img tag if you want it to be valid html...
F