Is anyone here good at php programming?

Pelagrin

Member
Just wondering if anyone here is any good with PHP. I've got a script for my website that I'm working on, but I'm a total n00b when it comes to programming anything except html.

The program was originally written by someone else and I'm customizing it for my forum (which I do have permission to do). Unfortunately he is unable to help me much with it because, even though he knows a lot more about it than I do, his knowledge is pretty limited too.

If someone has the time and knowledge to give me a hand with it, I would greatly appreciate it.
 
Well, if it's ok, i'll post what I'm working on:


This is the original working code.

code was removed

...but I'm not sure how to do it.

Also, right now it's pretty much standalone, but I'm trying to figure out how to break it into two files (the main program file and the skin file) so I can integrate it into my forum.

code was removed


If I'm way off on something, feel free to tell me because I'm learning.
smile.gif
 

Thanks!
 
ok, what exactly are you trying to do?

is it ignore people in the list without a gamertag (i.e. not print them out at all), or just not print out the '
rock.gif
' if they don't register with a gamertag?
 
To exclude the people from the list that don't have GamerTag Id's:

replace this code:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">$query = "SELECT * FROM ibf_members WHERE id = '$gamerid'";[/QUOTE]

with this code:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">$query = "SELECT * FROM ibf_members WHERE id = '$gamerid' AND field_1 IS NOT NULL";[/QUOTE]

if that doesn't work, try replacing it with this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">$query = "SELECT * FROM ibf_members WHERE id = '$gamerid' AND field_1 <> '' ";[/QUOTE]

or this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">$query = "SELECT * FROM ibf_members WHERE id = '$gamerid' AND field_1 != '' ";[/QUOTE]

I forget which one will work, so I put them all... :D

Now you can remove this code
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if($rows['field_1'] == '')
{
$username = "???";
}
else {
[/QUOTE]
and the curly end bracket for the else statement.

Don't have time to look at the other right now, but I hope this helps!
BlazeQ

EDIT: stupid smilies work even in the code...
 
actually, I found out how to do it easily

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if($rows['field_1'] == '')
{
continue;
}
[/QUOTE]

Thanks for the tip.

I gave up on trying to integrate it with my forums. Now I'm going to see about just wrapping the portal I'm using around it.

One thing I still would like help with though is how to change the background, test, and link colors.

I know how to do it in html, but html in php confuses me still.
 
I removed what I had, and I'm posting my current working code.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
<?php
mysql_connect('localhost', 'username', 'password');
mysql_select_db('database');
$sql = "SELECT * FROM ibf_pfields_content";
$orderbyletter = $_GET['order_by'];
if($_GET['order_by'])
{
$letter = $_GET['order_by'];$sql .= " WHERE field_1 LIKE '$letter%' ORDER BY field_1 ASC";
}
else
{
$sql .= " ORDER BY field_1 ASC";
}
echo "
<div class=\"content\" align=\"center\">
Gamertag Database </div><div class=\"content\"><br />Click a letter to show all gamertags beginning with that letter.<br />
<a class=\"menu-item\" href=\"http://www.airforcefun.com/outsidethebox/forums/index.php?act=gamertag&amp;order_by=A\">A</a> |

<a class=\"menu-item\" href=\"http://www.airforcefun.com/outsidethebox/forums/index.php?act=gamertag&amp;order_by=B\">B</a> |

<a class=\"menu-item\" href=\"http://www.airforcefun.com/outsidethebox/forums/index.php?act=gamertag&amp;order_by=C\">C</a> |

<a class=\"menu-item\" href=\"http://www.airforcefun.com/outsidethebox/forums/index.php?act=gamertag&amp;order_by=D\">D</a> |

<a class=\"menu-item\" href=\"http://www.airforcefun.com/outsidethebox/forums/index.php?act=gamertag&amp;order_by=E\">E</a> |

<a class=\"menu-item\" href=\"http://www.airforcefun.com/outsidethebox/forums/index.php?act=gamertag&amp;order_by=F\">F</a> |

<a class=\"menu-item\" href=\"http://www.airforcefun.com/outsidethebox/forums/index.php?act=gamertag&amp;order_by=G\">G</a> |

<a class=\"menu-item\" href=\"http://www.airforcefun.com/outsidethebox/forums/index.php?act=gamertag&amp;order_by=H\">H</a> |

<a class=\"menu-item\" href=\"http://www.airforcefun.com/outsidethebox/forums/index.php?act=gamertag&amp;order_by=I\">I</a> |

<a class=\"menu-item\" href=\"http://www.airforcefun.com/outsidethebox/forums/index.php?act=gamertag&amp;order_by=J\">J</a> |

<a class=\"menu-item\" href=\"http://www.airforcefun.com/outsidethebox/forums/index.php?act=gamertag&amp;order_by=K\">K</a> |

<a class=\"menu-item\" href=\"http://www.airforcefun.com/outsidethebox/forums/index.php?act=gamertag&amp;order_by=L\">L</a> |

<a class=\"menu-item\" href=\"http://www.airforcefun.com/outsidethebox/forums/index.php?act=gamertag&amp;order_by=M\">M</a> |

<a class=\"menu-item\" href=\"http://www.airforcefun.com/outsidethebox/forums/index.php?act=gamertag&amp;order_by=N\">N</a> |

<a class=\"menu-item\" href=\"http://www.airforcefun.com/outsidethebox/forums/index.php?act=gamertag&amp;order_by=O\">O</a> |

<a class=\"menu-item\" href=\"http://www.airforcefun.com/outsidethebox/forums/index.php?act=gamertag&amp;order_by=P\">P</a> |

<a class=\"menu-item\" href=\"http://www.airforcefun.com/outsidethebox/forums/index.php?act=gamertag&amp;order_by=Q\">Q</a> |

<a class=\"menu-item\" href=\"http://www.airforcefun.com/outsidethebox/forums/index.php?act=gamertag&amp;order_by=R\">R</a> |

<a class=\"menu-item\" href=\"http://www.airforcefun.com/outsidethebox/forums/index.php?act=gamertag&amp;order_by=S\">S</a> |

<a class=\"menu-item\" href=\"http://www.airforcefun.com/outsidethebox/forums/index.php?act=gamertag&amp;order_by=T\">T</a> |

<a class=\"menu-item\" href=\"http://www.airforcefun.com/outsidethebox/forums/index.php?act=gamertag&amp;order_by=U\">U</a> |

<a class=\"menu-item\" href=\"http://www.airforcefun.com/outsidethebox/forums/index.php?act=gamertag&amp;order_by=V\">V</a> |

<a class=\"menu-item\" href=\"http://www.airforcefun.com/outsidethebox/forums/index.php?act=gamertag&amp;order_by=W\">W</a> |

<a class=\"menu-item\" href=\"http://www.airforcefun.com/outsidethebox/forums/index.php?act=gamertag&amp;order_by=X\">X</a> |

<a class=\"menu-item\" href=\"http://www.airforcefun.com/outsidethebox/forums/index.php?act=gamertag&amp;order_by=Y\">Y</a> |

<a class=\"menu-item\" href=\"http://www.airforcefun.com/outsidethebox/forums/index.php?act=gamertag&amp;order_by=Z\">Z</a>
</div>
<br /><br />";


$sql = mysql_query($sql);
$counter = 0;
echo "
<div class=\"content\">
<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" align=\"center\">
<tr><td><div class=title>Gamertag</div></td><td><div class=title><br></div></td><td><div class=title>Username</div></td>
</tr>
";
$num = 0;
//GET gamertag and info
while($rows = mysql_fetch_array($sql))
{
if($counter % 2 == 0){$color = "list-item1";}
if($counter % 2 != 0){$color = "list-item2";}
$gamerid = $rows['member_id'];
$query = "SELECT * FROM ibf_members WHERE id = '$gamerid'";
$query = mysql_query($query);
$row = mysql_fetch_array($query);
if($rows['field_1'] == '')
{
continue;
}
if($rows['field_1'] == 'none')
{
continue;
}
else {
$username = $rows['field_1'];
}
echo "
<tr>
<td class=\"$color\">$username</a></td>
<td class=\"$color\"><br></td>
<td class=\"$color\"><a href=\"/outsidethebox/forums/index.php?act=Profile&amp;CODE=03&amp;MID=".$row['id']."\">".$row['name']."</a></td>
</tr>
";

$counter++;
$num++;
}
echo "
</table>
<p class=form-text>Total of ".$num." people listed on this page.</p>
</div>
";
?>
<p class=form-text>To be entered into the Gamertag DB, you need to be a registered member. If you are registered, you can enter it in your <a href="http://www.airforcefun.com/outsidethebox/forums/index.php?act=UserCP&amp;CODE=00">control panel</a>.</p>
[/QUOTE]
 
Back
Top