Jump to content

ucwords


hyster

Recommended Posts

i want to be able to use ucwords in my whole return results. i know this works.

 

$choice1 = ucwords($rows['auth']);

 

BUT. my query returns 14 $rows of data so i thought of doing this instead of doing a new chunk of code for each row.

 

$sql = "SELECT * from dsgi_serval $column ";
$result1=mysql_query($sql);
$result = ucwords($'result1');

while($rows=mysql_fetch_array($result)){
echo "$rows";
}

 

needless to say that does not work. i have tried to google this but i only get matches for manual arrays and not an sql query.

is there a way of doing this?

 

Thanks

Link to comment
Share on other sites

Because $result holds a result resource, not an array. You also won't be able to echo $rows; all you'll get back from that should be 'Array'. I haven't tested this, but it *should* work to capitalize each one. You'll need to replace the echo pre/print_r()/echo pre with appropriate echo statements to format the output how you'd like it.

 

$sql = "SELECT * from dsgi_serval $column";
$result=mysql_query($sql);
while( $rows=mysql_fetch_array($result) ) {
   array_map('uc_words', $rows);
   echo '<pre>';
   print_r($rows);
   echo '</pre>';
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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