Jump to content
urbanmafia

Nothing Here

Recommended Posts

For your class like that (especially with classes like GRPG V1) you could use the __get($var) magic method to retrieve all your stats so that you don’t have to keep editing your array each time you make a change to the database

Share this post


Link to post
Share on other sites
9 hours ago, urbanmafia said:

im playing around with the classes currently and changing them. For the stats ive decided to just go with this to save editing it all the time

public function getStats() { $stmt = $this->db->prepare("SELECT * FROM user_stats WHERE US_id = (:id) LIMIT 1"); $stmt->bindParam(":id", $this->id, PDO::PARAM_INT); if($stmt->execute()): if($stmt->rowCount() > 0): $result = $stmt->fetch(); endif; endif; return $result; }

public function getStats()
{
	$stmt = $this->db->prepare("SELECT * FROM user_stats WHERE US_id = (:id) LIMIT 1");
    $stmt->bindParam(":id", $this->id, PDO::PARAM_INT);
		
	if($stmt->execute()):
    	if($stmt->rowCount() > 0):
		$result = $stmt->fetch();
        endif;
    endif;
  return $result;
}

 

Ok, I see what you are doing there. One more recommendation:

You should return a result if nothing is found for whatever reason. If there isn’t any rows, it returns absolutely nothing at all because $result is only defined if there are rows found

Share this post


Link to post
Share on other sites
3 hours ago, KyleMassacre said:

[...]

If there isn’t any rows, it returns absolutely nothing at all because $result is only defined if there are rows found

With strict standards, it'd throw an error (Undefined variable: result)

Share this post


Link to post
Share on other sites
5 hours ago, Magictallguy said:

With strict standards, it'd throw an error (Undefined variable: result)

Well besides that lol

Share this post


Link to post
Share on other sites

hey good luck with the recoding, and for feedback not a big fan of the header, but over all looking dope good job 👍

Share this post


Link to post
Share on other sites

I think it is too much bright red. It may need just a tad bit more color and tone down the red color a little. Maybe make it a “gradient” 

Share this post


Link to post
Share on other sites

@urbanmafia nah i dont think any thing else need to be changed , but maybe the background need to be different than the tbale content? but so far its good

Share this post


Link to post
Share on other sites

I'd be happy to donate you some free MakeWebGames hosting with a sub-domain to host a demo for the community if you'd like. PM me if you're interested!

  • Like 1

Share this post


Link to post
Share on other sites
41 minutes ago, urbanmafia said:

Thankyou dave for the offer im currently hosting it on my dedicated server might be a good idea to host it here after it is completed. The demo should be released around Wednesday after the base is all finished.

Okay great! You do whatever you thinks best, excited to see it.

Will it be open source?

Share this post


Link to post
Share on other sites
Posted (edited)

Did you end up uploading to GitHub?

Edited by padre

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...