Jump to content

Recommended Posts

mysql_connect("localhost", "Master", "password");
mysql_select_db("db");

$checking = mysql_query("SELECT * FROM `Contribute` WHERE stack='$keywords' and username='$username'") or die (mysql_error());
$foundchecking = mysql_num_rows($checking)or die (mysql_error());

if($foundchecking==0) {


$nextblock = "INSERT INTO Contribute";
      $nextblock .= "(`username`,`stack`,`points`) VALUES ('$username','$keywords',1)";
      $nextresults = mysql_query($nextblock)or die (mysql_error()); 
echo "work2";


} else {

  $nextblock2= mysql_query("UPDATE Contribute SET points=points+1 WHERE username='$username' and stack='$keywords'");
$nextresults2 = mysql_query($nextblock2)or die (mysql_error());
echo "work1";

}

Link to comment
https://forums.phpfreaks.com/topic/204121-the-page-is-coming-up-blank/
Share on other sites

$foundchecking = mysql_num_rows($checking)or die (mysql_error());

 

mysql_num_rows() does not set mysql_error(), so your code is die'ing when there are zero rows in the result set but mysql_error() is nothing, so you get nothing output on your page.

 

Putting or die() or or anything() on the end of a mysql_num_rows() statement does not make any sense.

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.