Jump to content

Cypher_489

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

About Cypher_489

  • Birthday 11/06/1990

Contact Methods

  • MSN
    callumisitt@hotmail.co.uk
  • Website URL
    http://www.myspace.com/zero948
  • Yahoo
    callumisitt

Profile Information

  • Gender
    Male
  • Location
    England

Cypher_489's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. NVM, I've fixed it now. [code]while ( $dirs = mysql_fetch_array($sql) ) {   $name = $name."$dirs[name], ";   $names = rtrim($name, ','); }[/code] Didn't need the last element info.
  2. Just one more thing on this topic, I've found the last element in the array: $last_sql = mysql_query("SELECT * FROM dt_directories WHERE category = '$category' ORDER BY name DESC LIMIT 1") or die(mysql_error()); while ( $last = mysql_fetch_object($last_sql) ) { $last_element = "$last->name"; } How will I incorporate this into the $name variable so that the last element doesn't have the comma after it. I've tried a simple if( $name != $last_element) { $name = $name."$dirs[name], "; else { $name = $name."$dirs[name]"; } but that doesn't work, any ideas?
  3. Brilliant, thats exactly what I wanted. Thanks for the quick replies.
  4. I've tried echoing the $name variable outside while() { } before and I only got the last directory in the array.
  5. Hi, Just a simple question. [code] $sql = mysql_query("SELECT * FROM dt_directories WHERE category = '$category'") or die(mysql_error());   while ( $dirs = mysql_fetch_array($sql) ) { $name = $dirs['name']; echo "$name, "; }[/code] This echos out the names of directories which are from the category stored in the variable $category like this (category is "general"): Dmoz, Yahoo, Best of the Web, and so on... What I want to do is, rather then echo it, is to store them in a variable with the formatting like in the example. TIA
×
×
  • 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.