Results 1 to 8 of 8

Thread: [RESOLVED] php help

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2004
    Posts
    1,202

    Resolved [RESOLVED] php help

    PHP Code:
    <?php $title "MarkHost.Biz - Download"?>
    <?php 
    require("styles/top.php"); ?>
    <div id='full'>
    <?php
    require("scripts/connect.php");
    $query mysql_query("SELECT * FROM users WHERE username='$username'");
    $numrows mysql_num_rows($query);
    If(
    $username)
    echo 
    "<a href='http://www.markhost.biz/'><img src='images/banner.gif'></img></a>"
    echo 
    "You have now got access to the members page well done!";
    else
    echo 
    "You need to login to to view the content of this page.";
    ?>
    </div>
    <?php require("styles/bottom.php"); ?> #
    also how do i do a line brake between the first echo and the second echo.?
    come back and mark your original post as resoved if your problem is fixed

    Jamie Garland

  2. #2
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: php help

    simply add \n before the close of double quotation..

    http://www.tizag.com/phpT/strings.php

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2004
    Posts
    1,202

    Re: php help

    i tried that but still no joy

    PHP Code:
    <?php $title "MarkHost.Biz - Download"?>
    <?php 
    require("styles/top.php"); ?>

    <div id='full'>

    <?php

    require("scripts/connect.php");

    $query mysql_query("SELECT * FROM users WHERE username='$username'");
    $numrows mysql_num_rows($query);

    If(
    $username)
    echo 
    "<a href='http://www.markhost.biz/'><img src='images/banner.gif'></img></a>\n"
    echo 
    "test";
    else
    echo 
    "You need to login to to view the content of this page.";

    ?>

    </div>

    <?php require("styles/bottom.php"); ?>
    i now get this error?

    PHP Code:
    Parse errorsyntax errorunexpected T_ELSE in /home/markhost/public_html/download.php on line 16 
    i tried the above code but i get this error

    Parse error: syntax error, unexpected T_ELSE in /home/markhost/public_html/download.php on line 16
    come back and mark your original post as resoved if your problem is fixed

    Jamie Garland

  4. #4
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: php help

    well its because you don't use brackets.. and my bad, i thought you wanted it to show a new line in the source code...

    if you remove the blank line between the last echo and ?> then i think the error will go away..

    if you need a new line to display on the page, then replace the \n with <br /> tag..

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2004
    Posts
    1,202

    Re: php help

    still geting

    Parse error: syntax error, unexpected T_ELSE in /home/markhost/public_html/download.php on line 16
    come back and mark your original post as resoved if your problem is fixed

    Jamie Garland

  6. #6
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: php help

    hmm try changing

    PHP Code:
    If($username
    echo 
    "<a href='http://www.markhost.biz/'><img src='images/banner.gif'></img></a>\n"
    echo 
    "test"
    else 
    echo 
    "You need to login to to view the content of this page."
    to

    PHP Code:
    If($username) {
    echo 
    "<a href='http://www.markhost.biz/'><img src='images/banner.gif'></img></a>\n"
    echo 
    "test"
    } else { 
    echo 
    "You need to login to to view the content of this page."


  7. #7
    Frenzied Member TheBigB's Avatar
    Join Date
    Mar 2006
    Location
    *Stack Trace*
    Posts
    1,511

    Re: php help

    You might want to do some reading on the PHP syntax.
    http://www.php.net/manual/en/languag...structures.php
    Delete it. They just clutter threads anyway.

  8. #8
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: php help

    Please give your threads proper titles. Every topic in this section is about PHP so "php help" doesn't tell anyone anything.

Posting Permissions

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



Click Here to Expand Forum to Full Width