SitePoint Sponsor |
|
User Tag List
Results 1 to 16 of 16
Thread: I m lost!!
-
May 16, 2009, 04:47 #1
- Join Date
- Aug 2007
- Location
- Earth
- Posts
- 1,766
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
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 lineCode PHP:echo "<a href=\"content.php?cont=$catagories["id"]\">["name"]
-
May 16, 2009, 04:49 #2
- 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.Pawel Decowski (you should follow me on Twitter)
-
May 16, 2009, 04:56 #3
absolutely right.
Code:echo "<a href=\"content.php?cont=$catagories["id"]\">["name"]
Code:<a href=\"content.php?cont=$catagories["id"]\">[<?=$catagories['name']?>></a>
-
May 16, 2009, 05:02 #4
- 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>";
PHP Code:echo '<a href="content.php?cont=', $categories['id'], '">', $categories['name'], '</a>';
PHP Code:<a href="content.php?cont=<?php echo $categories['id']; ?>"><?php echo $categories['name']; ?></a>
Pawel Decowski (you should follow me on Twitter)
-
May 16, 2009, 05:04 #5
- Join Date
- Aug 2007
- Location
- Earth
- Posts
- 1,766
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
-
May 16, 2009, 05:06 #6
-
May 16, 2009, 05:07 #7
- Join Date
- Oct 2008
- Location
- London
- Posts
- 862
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Look at my last post.
Pawel Decowski (you should follow me on Twitter)
-
May 16, 2009, 05:10 #8
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
-
May 16, 2009, 05:10 #9
-
May 16, 2009, 05:11 #10
- 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.
Pawel Decowski (you should follow me on Twitter)
-
May 16, 2009, 05:12 #11
-
May 16, 2009, 05:13 #12
- Join Date
- Aug 2007
- Location
- Earth
- Posts
- 1,766
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
-
May 16, 2009, 05:20 #13
- 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.Pawel Decowski (you should follow me on Twitter)
-
May 16, 2009, 05:24 #14
- 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; ?>
-
May 16, 2009, 05:28 #15
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>
}
}
-
May 16, 2009, 05:28 #16
- 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; ?>Pawel Decowski (you should follow me on Twitter)
Bookmarks