Jump to content


  • Posts

  • Joined

  • Last visited


Profile Information

  • Gender
    Not Telling

Darkwoods's Achievements


Member (2/5)



  1. hey thanks I know it looks awful that because I am total noob I'm still having problem with displaying the name of the category please if anybody can help me out with it would be great I have been stuck with this for a while now.. <?PHP $result = mysql_query("SELECT a.*, b.c_id, b.c_title FROM properties AS a JOIN cat AS b ON SUBSTRING_INDEX(a.pr_category, ',', 1) = b.c_id",$connect); while($row = mysql_fetch_assoc($result)) { $cat_name = $row["c_title"]; $cat_id = $row["c_id"]; $categories = explode(',', $row['pr_category']); /*test*/ foreach ($categories as $category) { list($cat_id, $cat_name) = explode('=', $category); echo '' . $cat_id . ':' . $cat_name . ''; } } ?>
  2. I cant figure this out I have been searching and searching with no luck
  3. Hey in my category field I got multiple values in the same mysql row I'm having problem with how to separate them so I can display the name of the category and make a link for each category.. the multiple values are something like that 1,2 how can I make it so it would separate after each comma? <?PHP $result = mysql_query("SELECT a.*, b.c_id, b.c_title FROM properties AS a JOIN cat AS b ON a.pr_category = b.c_id",$connect); while($row = mysql_fetch_assoc($result)) { ?> <h2><a href="blog-post.php?id="><?php echo $row['pr_title']; ?></a></h2> <p class="date">12 July 2011 in <a href="index.php?id<?php echo $row['c_id']; ?>"><?php echo $row['c_title']; ?></a></p> <img class="img-large-bg" src="../uploads/images/<?php echo $row['f_img']; ?>" alt="" title="" /> <?PHP } ?>
  4. Hey your code worked but my remaining problem is how do I display the name of multi categories for example in the mysql field I got 1,2 which are cat1 and cat2 so far I'm only seeing the name of one category
  5. Hey I'm trying to display the names of the categories but the values are numbers connected to another table with the title of the category and the other problem is that sometimes it is multi categories selected and this will make a value like 1,2 so how can I solve this please? here is my messed up code and there seems to be something wrong with it.. <?PHP $result = mysql_query("SELECT * FROM properties, categories ",$connect); while($row = mysql_fetch_assoc($result)) { $pr_category = $row["pr_category"]; ?> <h2><a href="blog-post.html"><?php echo $row['pr_title']; ?></a></h2> <?PHP $result = mysql_query("SELECT * FROM categories WHERE id='$pr_category' ",$connect); while($row = mysql_fetch_assoc($result)) { $cat_title = $row["title"]; ?> <p class="date">12 July 2011 in <a href="#"><?php echo $cat_title; } ?></a></p> <img class="img-large-bg" src="../uploads/images/<?php echo $row['f_img']; } ?>
  6. Hey thanks for your reply but this wont solve the problem the jQuery tabs im using is for news posts so the fragment tabs have to be the same 1,2,3,4 it wont work with id. is there a way to tell the mysql to echo the latest second or third or forth post? this way I can echo it in every fragment..
  7. Hello I got an jQuery tabs and every tab got ID "fragment-1", "fragment-2" and so on now if want to tell PHP to use fragment-2 if fragment-1 is taken how do I do that? Thanks <div id="fragment-1" class="ui-tabs-panel"> <img src="assets/img/image1.jpg" title="" alt="" /> <div class="info" > <h1><?php echo $row['pr_title']; ?></h1> <p>blabla..</p> </div> </div>
  8. ah thanks that's how i did it <?php echo substr($news_title,0,25); ?> thanl for helping me out...
  9. Hey... I'm trying to echo the title of the news in the right column but I just want to display maximum of 25 characters how can I do it? thanks
  10. thank youu this worked very well.. thanks again
  11. Hey im having troube making this code as i have no idea how to do it... basically what im trying to do is for example if the index.php?id=XXX i want to echo "this" and if it is just index.php i want to echo "that" your help would be nice thanks <?php $id_lang = $_GET['id']; if($id_lang == $id_lang){ $result = mysql_query("SELECT * FROM pages WHERE id='$id_lang' ",$connect); while($row44 = mysql_fetch_assoc($result)) { $js_langdir = $row44['lang_dir']; }} else{ $js_langdir = "LTR"; } ?>
  12. hey thanks for your help guys im using TinyMCE now so it is working fine thanks for your help anyway
  13. i tried addslashes() but it is still the same magic_quotes_gpc() is on know and it didn't change anything yeah there is a DB connection the data is getting to the mysql but for example if i try to add text such as ( The whatever ‘Countdown’ will begin now!) the text will cut and will only get (The whatever) to the database
  14. i just fixed the $_SERVER['PHP_SELF'] thanks for the advice i added if( isset($_POST['name']) ) { $name = mysql_real_escape_string($_POST['name']); } but i'm still having problem with bypassing characters which are not supported such as ‘ it is sending the data to the mysql now unlike before but it cuts the text if there is an ‘ what should i do? thanks
  15. Hey I wasn't able to add/edit some text to the mysql database because of some character how can i bypass them should i use the mysql_real_escape_string() ? if yes how do i make it work with the code i got? thaks <?php include "../configdb.php"; $id = $_GET['id']; if(isset($_POST['submit'])) { //global variables $name = $_POST['name']; $footer = $_POST['footer']; //run the query which adds the data gathered from the form into the database $result = mysql_query("UPDATE pages SET name='$name', footer='$footer' WHERE id='$id' ",$connect); echo "<b>Your Page have been edited successfully"; // echo "<meta http-equiv=Refresh content=2;url=index.php>"; } elseif($id) { $result = mysql_query("SELECT * FROM pages WHERE id='$id' ",$connect); while($row = mysql_fetch_assoc($result)) { ?> <h3>::Edit Page</h3> <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>?id=<?php echo $row['id']?>"> <input type="hidden" name="id" value="<?php echo $row['id']?>"> <textarea name="name"><?php echo $row['name']?></textarea> <input name="footer" size="40" maxlength="255" value="<?php echo $row['footer']?>"> <input type="submit" name="submit" value="Submit"> <?php } } ?>
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.