Jump to content

The page is coming up blank?


MDanz

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.

Archived

This topic is now archived and is closed to further replies.

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