sql connect help
Moderator: General Moderators
-
rodrigorules
- Forum Commoner
- Posts: 35
- Joined: Wed Jan 05, 2005 3:10 pm
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
Error in SQL
yikes error, didnt work
Last edited by rodrigorules on Wed Jan 05, 2005 8:34 pm, edited 1 time in total.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
-
rodrigorules
- Forum Commoner
- Posts: 35
- Joined: Wed Jan 05, 2005 3:10 pm
Code: Select all
$sql="SELECT * FROM character WHERE CtlCode IS NULL ORDER LIMIT 35 BY cLevel DESC";- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
not what I meant...
Code: Select all
<?php
$sql="SELECT * FROM character WHERE CtlCode IS NULL ORDER BY cLevel LIMIT 35 DESC";
?>-
rodrigorules
- Forum Commoner
- Posts: 35
- Joined: Wed Jan 05, 2005 3:10 pm
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
-
rodrigorules
- Forum Commoner
- Posts: 35
- Joined: Wed Jan 05, 2005 3:10 pm
-
rodrigorules
- Forum Commoner
- Posts: 35
- Joined: Wed Jan 05, 2005 3:10 pm
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)
-------
some parse error =/
------
thats all i could think of...anybody think they know?
look...i know this is it but how would i use it?
Code: Select all
while (odbc_fetch_row($rs,35))-------
Code: Select all
while (odbc_fetch_row($rs, $i=1, $i<35, i++))------
thats all i could think of...anybody think they know?
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
from a quick google prayer:
Code: Select all
SELECT TOP 35 * FROM character WHERE CtlCode IS NULL ORDER BY cLevel DESC-
rodrigorules
- Forum Commoner
- Posts: 35
- Joined: Wed Jan 05, 2005 3:10 pm
THanks

EDIT!! : i had to change the database and now i need help getting this to work...
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
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>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
-
rodrigorules
- Forum Commoner
- Posts: 35
- Joined: Wed Jan 05, 2005 3:10 pm
-
rodrigorules
- Forum Commoner
- Posts: 35
- Joined: Wed Jan 05, 2005 3:10 pm
-
rodrigorules
- Forum Commoner
- Posts: 35
- Joined: Wed Jan 05, 2005 3:10 pm