Jump to content

Changing variable length?, only want 15 characters of full desc into variable


luke777

Recommended Posts

Hi there :)

 

I'm new to php, still learning and I got stuck with this... I'd really appreciate any help, i've searched everywhere but without any success.

 

What I am doing is grabbing some table data and for each putting it into html code to display a list of games from the database

 

<?

$sql = mysql_query('SELECT * FROM `games` WHERE `authorsite`="yippigames" ORDER BY RAND() LIMIT 0, 3') or mysql_error();

 

while($row=mysql_fetch_array($sql)) {

                $rowname = $row["name"];

                $change = str_replace( " ", "-", $rowname);

 

                echo("<table class='gltable' cellpadding='0' cellspacing='0'><tr><td><a href='/game/".$row["id"]."/$change.html' rel='nofollow' class='gamelink'><img src='http://www.mysite.net/img/own/".$row["nameid"].".jpg' alt='".$row["name"]."' width='100' height='100' class='gamethumb' align='left' /></a><a href='/game/".$row["id"]."/$change.html' rel='nofollow' class='gamelink'>".$row["name"]."</a><br /><span class='gdesc'>".$row["desc"]."...</span></td></tr></table> \n");}

 

?>

 

 

Everything is displaying great, but my only problem is I only want 20 characters of the description to display otherwise theres too much text on the page for each game.

 

I just really need to make the ".$row["desc"]." in the code display just half of the full description.

 

Any ideas  ???

 

Any help is much appreciated!

 

Thanks Luke.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.