SitePoint Sponsor

User Tag List

Results 1 to 16 of 16

Thread: I m lost!!

  1. #1
    SitePoint Wizard nofel's Avatar
    Join Date
    Aug 2007
    Location
    Earth
    Posts
    1,766
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Angry I m lost!!

    hey folks,
    i m seo specialist and my boss has told me do revamp some sites along with database. now i get stuck again n again on php quotes, mysql commands and stuff. i followed lynda.com php n mysql tutorial but all i do is end up here asking question. wht shld i do. i mean i can't use drupal or joomla coz have my own design approved and i donno how to customize drupal or joomla with ur own themes. any quick and deep help in building a cms. meanwhile i m stuck on this line. i trying but i m getting error on line
    Code PHP:
    echo "<a href=\"content.php?cont=$catagories["id"]\">["name"]
    i need work it out have website build n delivered by 2 weeks and i m still stuck with mysql queries and uploading n displaying files in php with mysql id-ing the files for reference. its so messed up. wht shld i do?
    All those who wander aren't lost.

  2. #2
    Web Professional
    Join Date
    Oct 2008
    Location
    London
    Posts
    862
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First things first: use meaningful post titles and drop that text-message-like writing "style".

    Now, if you tell us what the error message is and, perhaps, post a bit more code we might be able to help you.

  3. #3
    SitePoint Guru deepM's Avatar
    Join Date
    Dec 2007
    Location
    India
    Posts
    705
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by decowski View Post
    First things first: use meaningful post titles and drop that text-message-like writing "style".

    Now, if you tell us what the error message is and, perhaps, post a bit more code we might be able to help you.
    absolutely right.

    Code:
    echo "<a href=\"content.php?cont=$catagories["id"]\">["name"]
    you dont need to echo this. this is the link. and i assume that on name you want to goto user's name page. somthing like this

    Code:
    <a href=\"content.php?cont=$catagories["id"]\">[<?=$catagories['name']?>></a>

  4. #4
    Web Professional
    Join Date
    Oct 2008
    Location
    London
    Posts
    862
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    echo "<a href=\"content.php?cont={$categories['id']}\">{$categories['name']}</a>"
    Although I would recommend to write it like this (it’s faster and cleaner):

    PHP Code:
    echo '<a href="content.php?cont='$categories['id'], '">'$categories['name'], '</a>'
    What I would really recommend, though, is to not echo any HTML

    PHP Code:
    <a href="content.php?cont=<?php echo $categories['id']; ?>"><?php echo $categories['name']; ?></a>

  5. #5
    SitePoint Wizard nofel's Avatar
    Join Date
    Aug 2007
    Location
    Earth
    Posts
    1,766
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by decowski View Post
    First things first: use meaningful post titles and drop that text-message-like writing "style".

    Now, if you tell us what the error message is and, perhaps, post a bit more code we might be able to help you.
    what style?
    the error i m getting is this Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in C:\xampp\htdocs\sandboxx\pyb.php on line 19 and as the other guy told, i did according to him. i m still getting error
    All those who wander aren't lost.

  6. #6
    SitePoint Wizard nofel's Avatar
    Join Date
    Aug 2007
    Location
    Earth
    Posts
    1,766
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    now i m getting this error
    Parse error: parse error, expecting `','' or `';'' in C:\xampp\htdocs\sandboxx\pyb.php on line 20
    All those who wander aren't lost.

  7. #7
    Web Professional
    Join Date
    Oct 2008
    Location
    London
    Posts
    862
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Look at my last post.

  8. #8
    SitePoint Guru deepM's Avatar
    Join Date
    Dec 2007
    Location
    India
    Posts
    705
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ammark View Post
    what style?
    decowski means to say is if you put something more related to your code like coding is not working or variable passing is wrong instead of something like this.so people can help you properly.

    the error i m getting is this Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in C:\xampp\htdocs\sandboxx\pyb.php on line 19 and as the other guy told, i did according to him. i m still getting error
    show here some of your code. so probably we can help you.

  9. #9
    SitePoint Wizard nofel's Avatar
    Join Date
    Aug 2007
    Location
    Earth
    Posts
    1,766
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    still getting error at that line n the error is Parse error: parse error
    All those who wander aren't lost.

  10. #10
    Web Professional
    Join Date
    Oct 2008
    Location
    London
    Posts
    862
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Post the code you're getting the error for. We have posted a few snippets and have no clue which one you're using.

  11. #11
    SitePoint Wizard nofel's Avatar
    Join Date
    Aug 2007
    Location
    Earth
    Posts
    1,766
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    apprently i ask to much question so the post related to that get deleted :P so that's why. why on earth i can't do smooth progamming these errors r killing me
    All those who wander aren't lost.

  12. #12
    SitePoint Wizard nofel's Avatar
    Join Date
    Aug 2007
    Location
    Earth
    Posts
    1,766
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by decowski View Post
    Post the code you're getting the error for. We have posted a few snippets and have no clue which one you're using.
    here it is
    Code PHP:
    while ($catagories = mysql_fetch_array($catagories_set)){
    [B]<a href="content.php?cont=<?php echo $categories['id']; ?>"><?php echo [/B]$categories['name']; ?></a>
    echo "<br/>";
    }
    ?>
    the bold one is the line i m getting error.
    All those who wander aren't lost.

  13. #13
    Web Professional
    Join Date
    Oct 2008
    Location
    London
    Posts
    862
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code PHP:
    <?php while ($catagories = mysql_fetch_array($catagories_set)): ?>
    <a href="content.php?cont=<?php echo $categories['id']; ?>"><?php echo [/B]$categories['name']; ?></a><br />
    <?php endwhile; ?>

    Of course you won’t need the opening <?php tag if you’re already in a PHP block.

  14. #14
    SitePoint Wizard nofel's Avatar
    Join Date
    Aug 2007
    Location
    Earth
    Posts
    1,766
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    again i m getting parse error here is whole code
    Code PHP:
    <?php
    $con = mysql_connect("supressed");
    if(!$con){
    echo "Error connecting to database" .mysql_error();
    }
    $grab = mysql_select_db("supressed");
    if(!$grab){
    echo "Cannot select the database" .mysql_error();
    }
    ?>
    <?php
    $query = "SELECT * FROM listing 
             ORDER BY name ASC";
    $catagories_set = mysql_query($query,$con);
    if(!$catagories_set){
    echo "Error";
    }
    ?>
    <?php while ($catagories = mysql_fetch_array($catagories_set)): ?>
    <a href="content.php?cont=<?php echo $categories['id']; ?>"><?php echo [/b]$categories['name']; ?></a><br />
    <?php endwhile; ?>
    All those who wander aren't lost.

  15. #15
    SitePoint Guru deepM's Avatar
    Join Date
    Dec 2007
    Location
    India
    Posts
    705
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try this:


    PHP Code:
     if(mysql_num_rows($query) > 0){

           while($catagories= $op->select($query)){
         <a href=\"content.php?cont=$catagories["id"]\"><?=$catagories['name']?></a>

    }
    }

  16. #16
    Web Professional
    Join Date
    Oct 2008
    Location
    London
    Posts
    862
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You have left in the [b] tag (OK, I did actually but you blindly copied and pasted it ). Remove it and it will work:

    PHP Code:
    <?php
    $con 
    mysql_connect("supressed");
    if(!
    $con){
    echo 
    "Error connecting to database" .mysql_error();
    }
    $grab mysql_select_db("supressed");
    if(!
    $grab){
    echo 
    "Cannot select the database" .mysql_error();
    }
    ?>
    <?php
    $query 
    "SELECT * FROM listing
             ORDER BY name ASC"
    ;
    $catagories_set mysql_query($query,$con);
    if(!
    $catagories_set){
    echo 
    "Error";
    }
    ?>
    <?php 
    while ($catagories mysql_fetch_array($catagories_set)): ?>
    <a href="content.php?cont=<?php echo $categories['id']; ?>"><?php echo $categories['name']; ?></a><br />
    <?php endwhile; ?>


Bookmarks

Posting Permissions

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