www.webdeveloper.com
Results 1 to 6 of 6

Thread: Displaying an image with link underneath in the table

  1. #1
    Join Date
    Apr 2013
    Posts
    4

    Displaying an image with link underneath in the table

    Code:
        $chkuserid = mysql_query("select UserID from users where Username = '".$_SESSION['Username']."'");
        $row = mysql_fetch_array($chkuserid);
        $finall = $row['UserID'];
        $result = mysql_query("SELECT PhotoDesc, photoDateAdded, PhotoString from photo where photographerID='".$finall."'");
        if (!$result) {
        die("Database query failed: " . mysql_error());
      }
      
      //
      // 4. Use returned data
      //
      
      // while ($row = mysql_fetch_array($result)) {
      //  echo $row[0]." ".$row[1]."<br />";
      //}
      
      ?>
    
    <?php
    
    //
    //Set up table headings
    //
    echo "<table border=5 align=center>";
    echo "<tr>";
    echo '<td>Photo Desc.</td>';
    echo '<td>Date&Time Added</td>';
    echo '<td>Photo</td>';
    echo '<tr>';
    
    
    //
    //Display data returned by the query
    //
    
    $i=0;
    while ($row = mysql_fetch_array($result))
      {
      echo "<tr>";
      echo '<td>'.mysql_result($result,$i,0).'</td>';
      echo '<td>'.mysql_result($result,$i,1).'</td>';
      $image = mysql_result($result,$i,2);
      echo '<td>'.'<img src="http://'.$image.'">'.
      .'<a href="http://'.$image.'">View>'. <==== this is line 185
      '</td>';
      echo '</tr>';
      $i++;
      }
    echo "</table>";
    Parse error: syntax error, unexpected '.' in /srv/disk7/1259829/www/blablabla/imgup.php on line 185
    I want to display an image and just below it a link to display it full size in seperate tab.

    When I get rid of link code I can display the images but when I add link code I get this error message.

  2. #2
    Join Date
    Apr 2013
    Posts
    56
    There is a dot which is not needed on line 185. Just remove it (first dot you encounter).

  3. #3
    Join Date
    Apr 2013
    Posts
    1
    Hi,
    you need to change your following code
    echo '<td>'.'<img src="http://'.$image.'">'.
    .'<a href="http://'.$image.'">View>'.
    '</td>';
    to

    echo '<td>'.'<img src="http://'.$image.'">'.
    '<a href="http://'.$image.'">View</a>'. '</td>';

    There is extra dot and ending tag of a is missing.

    if you want to read tutorials on webdevelopment please also vist http://www.websourceblog.com.

  4. #4
    Join Date
    Apr 2013
    Posts
    36
    How about creating a web-based image viewer to help display an image with link underneath? I am not very sure about it. But you can google it and have a try. And I am also testing about the relevant programs these days. We can aommunicate about it later. Good luck.



    Best regards,
    Arron

  5. #5
    Join Date
    Feb 2014
    Location
    Canada
    Posts
    155
    You need the . for concatenation but when you're specifying HTML elements inside an echo statement, it's easier to use " " as it will automatically make the distinction between PHP variables and HTML elements. This will make your life easier and will (hopefully) avoid these sorts of errors. For example:

    PHP Code:
    echo("<td><img src = $yourSrc /><a href = $yourHref >View</a></td>"); 

  6. #6
    Join Date
    Mar 2014
    Posts
    24
    <table cellspacing="0" cellpadding="0" border="0" width="500">
    <tr><td><img src="nav1.gif"><img src="nav2.gif"><img src="nav3.gif"><img
    src="nav4.gif"><img src="nav5.gif"></td></tr>
    <tr><td style="background: red;">
    <img src="smallred.gif" height="1" width="1"></td></tr>
    <tr><td>
    <p style="margin: 0.5em;">This is text in another cell of the
    table. Within the textthere is an icon <img src="icon2.gif">
    that indicates a link to another site. It's very worldly. Lorem
    ipsum, dolor sit amet...</p></td></tr></table>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center

"

"

X vBulletin 4.2.2 Debug Information

  • Page Generation 0.36235 seconds
  • Memory Usage 2,894KB
  • Queries Executed 15 (?)
More Information
Template Usage (35):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (1)bbcode_code
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (6)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (73):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates