NineChime forum

Furry stuff, oekaki stuff, and other stuff.

You are not logged in.

Post a reply

Write your message and submit
Options
Humanity test

What is nine + two?

Go back

Topic review (newest first)

Silverpaws006
09-27-2009 23:49:28

Umm, I used mysql_fetch_array 'cause I'm fetching more than one row,
come to think of it, I use that all the time xD

I'm not sure of it's difference with fetch_row and fetch_assoc really,
but I think I read an article saying fetch_array is faster(?) and kinda like a combination of both.

Well just in case, if the script doesn't work, people can change mysql_fetch_array to mysql_fetch_row.

Waccoon
09-27-2009 21:43:08

One nit:  you should use mysql_fetch_row() instead of mysql_fetch_array().

Code:

$result = mysql_query ("SELECT `get`, `some`, `names` FROM `op_table` ORDER BY `ID` DESC");

$row = mysql_fetch_array($result);
echo ($row['names']);

$row = mysql_fetch_row($result);
echo ($row[3]);

$row = mysql_fetch_array($result, MYSQL_ASSOC);
echo ($row['names']);

$row = mysql_fetch_array($result, MYSQL_NUM);
echo ($row[3]);

Using mysql_fetch_array() will work if your server has notices disabled, but fetching a row is preferred.

rainbow
09-27-2009 00:59:47

Great idea! I might consider trying out this script on my oekaki board very soon to see if it works. smile

Silverpaws006
09-26-2009 23:24:59

Okay first, since this is my first post after registering... intro xD
I'm Silverpaws006/Char of URKaki.
uhh, I'm not really that good with PHP...
I made this script for our oekaki and just thought others might like it too :3

This displays the people with birthdays for the month smile
you can paste it on the notice:

P.S. I'm thinking up of more scripts when I have free time, so uhh,
to the admin: asking permission if I could post more soon?


Code:

<?php
//===========================================================================
// BIRTHDAYS START
// by Silverpaws006/Char of http://www.auropaws.com/
//===========================================================================
?>

<div style="padding:5px;width:400px;border:2px solid #ff6060;background:#ffffcc;color:#000000;">
<b>:: Birthdays this month ::</b>
<br/><br/>

<div style="text-align:left;">

<?php
$monthnow = date("m",time());
$query_dates = mysql_query("SELECT usrname, age FROM op_oekaki ORDER BY age ASC");
while($array = mysql_fetch_array($query_dates)) {

    $date = $array[1];
    $get_month = substr($date,5,2);

    if($monthnow == $get_month) {

        $to_timestamp = strtotime($date);
        $to_date = date("M j",$to_timestamp);
        $linkname = "<a onclick=\"openWindow('profile.php?user=$array[0]', 400, 600); return false\" href=\"profile.php?user=$array[0]\" style='color:#000000;'>$array[0]</a>
        ";
        echo ($to_date . " - " . $linkname . "<br/>");

    }


    if(!$array) {
        echo("No birthdays this month.");
    }

}
?>
</div>



</div>

<?php
//===========================================================================
// BIRTHDAYS END
//===========================================================================
?>

Board footer

Yep, still running PunBB
© Copyright 2002–2008 PunBB