Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    Member
    Join Date
    Mar 2012
    Posts
    55
    Member #
    31209

    Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in

    Hi!
    I have not posted in a while, and I have redone my website (while learning some things) and have run into this problem.. Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in xx/xx/xx//xx on line 78. Line 78 is in bold. I know where the problem is, which is in red. it is in the field "more". I am trying to make the table "more" act as a link to the page that is in the table. For Eg. row1>field "more" has the site "http://www.google.com". How would I redirect it to go to "google.com" and instead of showing "google.com in the html, show the word "more"?

    Code:
    <?php
    /* connect to the db */
    $connection = mysql_connect('yosheenew.db.8887926.hostedresource.com','yosheenew','Yoshee09!');
    mysql_select_db('yosheenew');
    
    $query = "SELECT * FROM books"; //You don't need a ; like you do in SQL
    $result = mysql_query($query);
    
    echo '<table cellpadding="0" cellspacing="0" class="db-table">'; // start a table tag in the HTML
    echo '<tr><th>ID</th><th>Name</th><th>Author</th><th>Description</th><th>Series</th><th>More</th></tr>';
    
    
    while($row = mysql_fetch_array($result)){   //Creates a loop to loop through results
    echo "<tr><td>" . $row['id'] . "</td><td>" . $row['name'] . "</td><td>" . $row['author'] . "</td><td>" . $row['dscrpt'] . "</td><td>" . $row['series'] . "</td><td>"<a href=". $row['more'] . ">"Max"</a>"</td></tr>";  //$row['index'] the index here is a field name
    }
    
    echo "</table>"; //Close the table in HTML
    
    mysql_close(); //Make sure to close out the database connection
        ?>
    Thanks!

  2.  

  3. #2
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    Code:
    <a href=". $row['more'] . ">More</a></td></tr>"
    Like that. You'll notice how I got rid of the extra quotes. The problem was that you had quotes that separate PHP from HTML and that it was looking for PHP where you had HTML.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  4. #3
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    By the way, I moved this to the PHP thread so others could read this and comment or learn.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  5. #4
    Member
    Join Date
    Mar 2012
    Posts
    55
    Member #
    31209
    Thanks!
    It works!


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 09:16 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com