Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2014
    Thanked 0 Times in 0 Posts

    Payout #2 Newspaper Not Updating Properly

    Hello again, I am a self taught programmer so veyr green at the thumbs. This script is meant to give the top rank newspaper gold coins and news saying the owner won, but for some reason the query is updating the 'to' in the news as blank and not the owners email. Nor is it updating the owners goldcoins. I dont think it is recognizing the owners uid or email. Was hoping someone could help me out?

    $sql="SELECT rank, owner, name FROM newspaper_company ORDER BY rank DESC LIMIT 0,1";
                      if(@mysql_num_rows($sql)==0) {}
                     else {
                    $uid = "SELECT uid, email FROM user_characters WHERE 'nickname' ='".$temp['owner']."'";
                    $sql = "UPDATE users_goldcoins SET goldcoins=goldcoins+100 WHERE 'uid'='".$uidd['uid']."'";
    		$sql = mysql_query($sql) or die(mysql_error());
    		$sql	= "INSERT INTO `news` (`to` , `news` , `timestamp`) VALUES ('".$uidd['email']."', '<br>Congratulations. You Have Won 100 B.D(s) For Finishing With The Top Ranked Newspaper ".$temp['name'].". ', '$time')";
    		$sql = mysql_query($sql) or die(mysql_error());

  2. #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Saskatoon, Saskatchewan
    Thanked 2,668 Times in 2,637 Posts
    It all comes down to the missing mysql_query calls. You cannot fetch from a string.
    I won't bother with a correction here, I've posted the joined insert in a previous thread. You should ensure the error reporting is enabled in the dev environment, preferably in the php.ini. Otherwise in line:
    PHP Code:
    Will report the errors on screen. That would tell you things like mysql_fetch_array being provided with an incorrect datatype.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts