Page 2 of 2
Posted: Wed Jan 05, 2005 8:12 pm
by rodrigorules
Warning: odbc_exec(): SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near 'LIMIT'., SQL state 37000 in SQLExecDirect in c:\appserv\www\ranking.php on line 6
Error in SQL
yikes error, didnt work
Posted: Wed Jan 05, 2005 8:27 pm
by John Cartwright
I believe DESC goes last... not to good with SQL
Posted: Wed Jan 05, 2005 8:31 pm
by rodrigorules
Code: Select all
$sql="SELECT * FROM character WHERE CtlCode IS NULL ORDER LIMIT 35 BY cLevel DESC";
no that still doesnt work =/
Posted: Wed Jan 05, 2005 8:31 pm
by John Cartwright
not what I meant...
Code: Select all
<?php
$sql="SELECT * FROM character WHERE CtlCode IS NULL ORDER BY cLevel LIMIT 35 DESC";
?>
Posted: Wed Jan 05, 2005 8:34 pm
by rodrigorules
Warning: odbc_exec(): SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near 'LIMIT'., SQL state 37000 in SQLExecDirect in c:\appserv\www\ranking.php.php on line 7
Error in SQL
yea i changed to the one u posted above this post
and i still get error, weird =/
Posted: Wed Jan 05, 2005 8:39 pm
by John Cartwright
i'm not sure then, I'm not too familar with sql syntax and I'm not on my work computer so I can't refer to it.
Posted: Wed Jan 05, 2005 8:39 pm
by rodrigorules
icic , thanks for helping

ill try to look it up in that guide u posted..
EDIT: i tried MAX_ROWS but didnt work also..
anyone with soltuon?

Posted: Wed Jan 05, 2005 8:47 pm
by rodrigorules
http://us3.php.net/odbc_fetch_row
look...i know this is it but how would i use it?
didnt work, as it said it would (it gets row 35, unlimited times)
-------
Code: Select all
while (odbc_fetch_row($rs, $i=1, $i<35, i++))
some parse error =/
------
thats all i could think of...anybody think they know?
Posted: Wed Jan 05, 2005 9:00 pm
by feyd
from a quick google prayer:
Code: Select all
SELECT TOP 35 * FROM character WHERE CtlCode IS NULL ORDER BY cLevel DESC
Posted: Wed Jan 05, 2005 9:04 pm
by rodrigorules
THanks
EDIT!! : i had to change the database and now i need help getting this to work...
Code: Select all
<html><center><body background="b.jpg"><?php
$conn=odbc_connect('MuOnline','','');
if (!$conn)
{
exit("Connection Failed: " . $conn);
}
$sql="SELECT TOP 35 * FROM character WHERE CtlCode IS NULL ORDER BY cLevel DESC";
$rs=odbc_exec($conn,$sql);
if (!$rs)
{
exit("Error in SQL");
}
echo "<table border=1><tr>";echo "<th>Name</th>";
echo "<th>Level</th>";
echo "<th>Money</th>";
echo "<th>Experiance</th>";
echo "<th>Strength</th>";
echo "<th>Agility</th>";
echo "<th>Vitality</th>";
echo "<th>Energy</th>";
echo "<th>Resets</th></tr>";
while (odbc_fetch_row($rs))
{
$resets=odbc_result($rs, "Resets");
$xp=odbc_result($rs,"Experience");
$str=odbc_result($rs,"Strength");
$agi=odbc_result($rs,"Dexterity");
$vit=odbc_result($rs,"Vitality");
$nrg=odbc_result($rs,"Energy");
$zen=odbc_result($rs,"Money");
$pname=odbc_result($rs,"Name");
$level=odbc_result($rs,"cLevel");
echo "<tr><td>$pname</td>";
echo "<td>$level</td>";
echo "<td>$zen</td>";
echo "<td>$xp</td>";
echo "<td>$str</td>";
echo "<td>$agi</td>";
echo "<td>$vit</td>";
echo "<td>$nrg</td>";
echo "<td>$resets</td></tr>";
}
odbc_close($conn);
echo "</table>";
?></body></html>
i need to make the column Resets connect to the table "MEMB_INFO"
instead of "character" but still be in the same table?
please reply someone, i planned to open my server now..heh cant do it now
well if someone can reply it would be helpful

Posted: Wed Jan 05, 2005 11:21 pm
by rodrigorules
please help, bump, i need help again -_- read above post
k thanks
Posted: Wed Jan 05, 2005 11:33 pm
by feyd
I don't quite understand what you are wanting to do now. How is the column Resets supposed to connect to the table MEMB_INFO ?
Posted: Wed Jan 05, 2005 11:39 pm
by rodrigorules
what i mean is that
the Resets column is in the MEMB_info
and i want it to show up here in the TABLE, but the $SQL says to check for table "character"
what do i do so it checks MEMB_INFO so the column "resets" which is in MEMB_INFO
can be in the table
Posted: Wed Jan 05, 2005 11:57 pm
by feyd
you'll need a way for them to link together, or you'll get multple ~duplicate rows. Anyways, I haven't the energy to sift through the google prayer: [google]mssql +join[/google]. As you may guess, it involves a join of some sort.
Posted: Thu Jan 06, 2005 12:00 am
by rodrigorules
o god thats confusing..i think ill just make a serperate table then
