Junior Spellweaver
- Joined
- Sep 9, 2015
- Messages
- 132
- Reaction score
- 10
Thanks dudeGood job Naveh!
Well, I didn't know about the foreach() loop, until right now, lol. I used an if() because it gave me an error if I will put it as max 10 in the for loop for the simple reason that I don't have 10 rows to show, I got only 4 in my database. So I did if the admin got less than 10 users it will post all of them, else if he got 10 or more it will post only 10 of them.One thing I didn't quite understand about your queries, why don't you place a limit for the number of rows?The for() loop in the rankings for example, including the preceding if() statement could be eliminated easily and shorted, in the query you could simply add a limit of 10, then instead of having an if() and for() - you could simply run a simple foreach() loop, without the need to define a limit for the loop itself
I did it with other way with TcpClient (In the SqlConnector.cs):Also you did not add the server status socket?
public static bool status(string ip, int port) {
TcpClient tcpClient = new TcpClient();
try
{
tcpClient.Connect(ip, port);
return true;
}
catch (Exception)
{
return false;
}
}
<span>Status: <span id="status"><% if (SqlConnector.status(Information.serverIp, Information.loginPort)) {
Response.Write("Online");
%>
<script>
document.getElementById("status").style.color = "green";
</script>
<%
}
else
{
Response.Write("Offline");
%>
<script>
document.getElementById("status").style.color = "red";
</script>
<%
} %></span></span>
of course! Next website will be a lot more professional.Next step could be fetching the topMessage from the Database, perhaps adding a news page or something?
Can you tell me what files are you talking about? Didn't understand what you mean, each file has a different role of course.Another thing I didn't quite understand is why do you have the same file for each page, like the same file with the same code with just it's name changed for the page? If it's means to be a controller, it could be done in a better way
:biggrin:Also finally a public web development with OOP instead of raw code lolAgain, good job!
That's the problem, the "right" way is to not repeat yourself, you can handle it dynamically like i said, and the limit should be set in the query itself.Thanks dude
Well, I didn't know about the foreach() loop, until right now, lol. I used an if() because it gave me an error if I will put it as max 10 in the for loop for the simple reason that I don't have 10 rows to show, I got only 4 in my database. So I did if the admin got less than 10 users it will post all of them, else if he got 10 or more it will post only 10 of them.
TcpClient is basically opening a TCP socket, so it's what I meant, just wasn't familiar with C# syntax to point you to the function/object itselfI did it with other way with TcpClient (In the SqlConnector.cs):
and in the master page I wrote:
I hope so xdof course! Next website will be a lot more professional.
Can you tell me what files are you talking about? Didn't understand what you mean, each file has a different role of course.
:biggrin:
I agree, I forgot about that..I agree that some of the best websites are the simplest in layout. I commend you for your work. However, I honestly feel this is aesthetically unappealing at first glance because of the font.