00:00
00:00
Newgrounds Background Image Theme

Tallya just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Need your help again guys!

1,181 Views | 5 Replies
New Topic Respond to this Topic

Need your help again guys! 2001-11-19 04:18:12


Just when ya thought u got rid of me-

I have a database full of information, but currently all titles in the database are in UPPER CASE (e.g. GRAND THEFT AUTO 3), but i have just finished a new design and really need to put the titles all into lower case (either at the DB end, or in the SQL that pulls the info from the DB). A friend said it would be something like "ucfirst(strtolower($string)", but im not sure if it works or where to put it!

I would really love to turn all my titles into lower case with a initial Upper Case Letter (e.g. Grand theft auto 3)

Im supposed to be uploading the new design sometime today, so if anyone knows- please reply asap!

Thanks

Response to Need your help again guys! 2001-11-19 05:12:57


At 11/19/01 04:18 AM, RichL wrote:
A friend said it would be something like "ucfirst(strtolower($string)", but im not sure if it works or where to put it!

Your friend would be right (except you need another bracket after $string):

ucfirst(strtolower($string));

Just use that on the strings you're bringing back from the db call, and echo it out, so:

$string = ucfirst(strtolower($string));

Or

echo ucfirst(strtolower($string));

This really is simple stuff. Check this for an explanation on strings:
http://www.zend.com/zend/tut/using-strings.php

Or this:
http://www.php.net/manual/en/function.echo.php

For an explanation on the echo function. You'll see a list of useful string functions to the left of that manual entry.

Response to Need your help again guys! 2001-11-19 06:00:24


Thanks- Have been trying this:

? $results = mysql_query SELECT * FROM articles ORDER BY id ASC $db

$finalresults = ucfirst(strtolower($results));

if ($item = mysql_fetch_array($finalresults)) {

do {

printf(" A HREF=articles/?id=%s %s /a ", $item["id"], $item["title"]);

} while($item = mysql_fetch_array($finalresults));

}

?

But it just gives me a "Not a vaid mysql resource" error, unfortunately..whats wrong with the code?

Response to Need your help again guys! 2001-11-19 06:04:35


Thanks- heres what ive been trying,

? $results = mysql_query("SELECT * FROM articles ORDER BY id ASC", $db);

if ($item = mysql_fetch_array($results)) {

do {

$itemtwo = ucfirst(strtolower($item));
printf(" A HREF=articles/?id=%s %s /a br", $itemtwo["id"], $itemtwo["title"]);

} while($item = mysql_fetch_array($results));
}

?

But it just gives me this:
A
A
A
A
A
(in that order. lol) the link ID points to "?id=A" aswell..wassup with this?

Response to Need your help again guys! 2001-11-19 07:26:42


At 11/19/01 06:04 AM, RichL wrote: (in that order. lol) the link ID points to "?id=A" aswell..wassup with this?

You're applying the functions to the array, and not the individual variables as you want.

Response to Need your help again guys! 2001-11-19 12:37:38


You're applying the functions to the array, and not the individual variables as you want.

Thanks, all done now