dean7 Posted July 22, 2010 Share Posted July 22, 2010 Hi all, lately ive been coding myself a script for my website which allows users to buy a unique which is a car of there choice and faster than all the others in the game but once finished coding it, well near enouth, I tested it and its only showing a blank white screen. I think its either me missing a ; ' } but I couldnt see anything I was missing. session_start(); include ("includes/config.php"); include ("includes/functions.php"); logincheck(); // Error Check ini_set ('display_errors', 1); error_reporting (E_ALL); // End Error Check ///////// Ok so let make the varibals $username = $_SESSION['username']; $ok = mysql_query("SELECT * FROM users WHERE username='$username'") or die (mysql_error(); $fetch = mysql_fetch_object($ok); // Start the accuall code if (isset($_POST['bmoney'])){ // Post varibals $uniquename = $_POST['uniquename']; $uniquepic = $_POST['uniquepic']; $uniquespeed = "770"; $points = $fetch->points; $money = $fetch->money; // Post vatibals done // Check Name aint to long etc.. if ($uniquename == ""){ echo ("Your new unique need to have a name!"); }else{ if ($uniquename >= "41"){ echo ("Your unique name is too big!"); }else{ if ($uniquename <= "3"){ echo ("Your Unique name is too small!"); }}} // Much as I can think of about name atm // Unique Image if ($uniquepic == ""){ echo ("You need a picture for your unique!"); } // Unique Image Done I think. // Lets do the cost etc.. $costmoney = "3000000000"; $costcredits = "750"; // Buy using money // if ($money < $costmoney){ echo ("You dont have enouth money to buy a unique!"); }elseif ($money => $costmoney){ // Update using money // mysql_query ("UPDATE users SET money='$money-$costmoney' WHERE username='$username'") or die (mysql_error()); mysql_query ("INTERT INTO garage (id,car,worth,speed,owner,upgrades,status,location,origion,damage,pic) VALUES ('','$uniquename','$uniqueworth','$uniquespeed','$username','100-100-100-100-100-100-100-100','0','England','England','0','$uniquepic')") or die (mysql_error(); echo ("Your new unique is now in your garage. <br /> Brought by £3,000,000,000! <br />No Refunds!"); } } // end bmoney // End Update using money // // Buy Using credits // if (isset($_POST['bcred'])){ if ($points < $costcredits){ echo ("You dont have enouth points to buy a unique!"); }else{ if ($points >= $costcredits){ // Update using credits // mysql_query ("UPDATE users SET points='$points-$costcredits' WHERE username='$username'") or die (mysql_error()); mysql_query ("INTERT INTO garage (id,car,worth,speed,owner,upgrades,status,location,origion,damage,pic) VALUES ('','$uniquename','$uniqueworth','$uniquespeed','$username','100-100-100-100-100-100-100-100','0','England','England','0','$uniquepic')") or die (mysql_error(); echo ("Your new Unique is now in your garage. <br /> Brought by 750 Points! <br />No Refunds!"); } } } // End bcred // Ok new option. Half Money Half Credits. (Cost more) // // need new varibals $hm = "1700000000"; // money $hc = "500"; // credits if (isset($_POST['both'])){ if ($money < $hm){ echo ("You havent got enouth money!"); }else{ if ($points < $hc){ echo ("You havent got enouth points!"); }else{ if ($money >= $hm && $fetch->points >= $hc){ mysql_query ("UPDATE users SET money='$money-$hm' AND points='$points-$hc' WHERE username='$username'") or die (mysql_error()); mysql_query ("INTERT INTO garage (id,car,worth,speed,owner,upgrades,status,location,origion,damage,pic) VALUES ('','$uniquename','$uniqueworth','$uniquespeed','$username','100-100-100-100-100-100-100-100','0','England','England','0','$uniquepic')") or die (mysql_error(); echo ("Your new Unique is now in your garage. <br /> Brought with Half Money Half Credits! <br />No Refunds!"); } } } // Submit both Anyone see why its showing a blank page? Thanks. Please note, I might have other errors in that code, but I couldnt sort them as I carnt see what the errors are. Link to comment https://forums.phpfreaks.com/topic/208524-not-showing-anything/ Share on other sites More sharing options...
timvdalen Posted July 22, 2010 Share Posted July 22, 2010 Hi all, lately ive been coding myself a script for my website which allows users to buy a unique which is a car of there choice and faster than all the others in the game but once finished coding it, well near enouth, I tested it and its only showing a blank white screen. I think its either me missing a ; ' } but I couldnt see anything I was missing. session_start(); include ("includes/config.php"); include ("includes/functions.php"); logincheck(); // Error Check ini_set ('display_errors', 1); error_reporting (E_ALL); // End Error Check ///////// Ok so let make the varibals $username = $_SESSION['username']; $ok = mysql_query("SELECT * FROM users WHERE username='$username'") or die (mysql_error(); $fetch = mysql_fetch_object($ok); // Start the accuall code if (isset($_POST['bmoney'])){ // Post varibals $uniquename = $_POST['uniquename']; $uniquepic = $_POST['uniquepic']; $uniquespeed = "770"; $points = $fetch->points; $money = $fetch->money; // Post vatibals done // Check Name aint to long etc.. if ($uniquename == ""){ echo ("Your new unique need to have a name!"); }else{ if ($uniquename >= "41"){ echo ("Your unique name is too big!"); }else{ if ($uniquename <= "3"){ echo ("Your Unique name is too small!"); }}} // Much as I can think of about name atm // Unique Image if ($uniquepic == ""){ echo ("You need a picture for your unique!"); } // Unique Image Done I think. // Lets do the cost etc.. $costmoney = "3000000000"; $costcredits = "750"; // Buy using money // if ($money < $costmoney){ echo ("You dont have enouth money to buy a unique!"); }elseif ($money => $costmoney){ // Update using money // mysql_query ("UPDATE users SET money='$money-$costmoney' WHERE username='$username'") or die (mysql_error()); mysql_query ("INTERT INTO garage (id,car,worth,speed,owner,upgrades,status,location,origion,damage,pic) VALUES ('','$uniquename','$uniqueworth','$uniquespeed','$username','100-100-100-100-100-100-100-100','0','England','England','0','$uniquepic')") or die (mysql_error(); echo ("Your new unique is now in your garage. <br /> Brought by £3,000,000,000! <br />No Refunds!"); } } // end bmoney // End Update using money // // Buy Using credits // if (isset($_POST['bcred'])){ if ($points < $costcredits){ echo ("You dont have enouth points to buy a unique!"); }else{ if ($points >= $costcredits){ // Update using credits // mysql_query ("UPDATE users SET points='$points-$costcredits' WHERE username='$username'") or die (mysql_error()); mysql_query ("INTERT INTO garage (id,car,worth,speed,owner,upgrades,status,location,origion,damage,pic) VALUES ('','$uniquename','$uniqueworth','$uniquespeed','$username','100-100-100-100-100-100-100-100','0','England','England','0','$uniquepic')") or die (mysql_error(); echo ("Your new Unique is now in your garage. <br /> Brought by 750 Points! <br />No Refunds!"); } } } // End bcred // Ok new option. Half Money Half Credits. (Cost more) // // need new varibals $hm = "1700000000"; // money $hc = "500"; // credits if (isset($_POST['both'])){ if ($money < $hm){ echo ("You havent got enouth money!"); }else{ if ($points < $hc){ echo ("You havent got enouth points!"); }else{ if ($money >= $hm && $fetch->points >= $hc){ mysql_query ("UPDATE users SET money='$money-$hm' AND points='$points-$hc' WHERE username='$username'") or die (mysql_error()); mysql_query ("INTERT INTO garage (id,car,worth,speed,owner,upgrades,status,location,origion,damage,pic) VALUES ('','$uniquename','$uniqueworth','$uniquespeed','$username','100-100-100-100-100-100-100-100','0','England','England','0','$uniquepic')") or die (mysql_error(); echo ("Your new Unique is now in your garage. <br /> Brought with Half Money Half Credits! <br />No Refunds!"); } } } // Submit both Anyone see why its showing a blank page? Thanks. Please note, I might have other errors in that code, but I couldnt sort them as I carnt see what the errors are. You can't check string lenght like that. Use strlen() instead. Link to comment https://forums.phpfreaks.com/topic/208524-not-showing-anything/#findComment-1089491 Share on other sites More sharing options...
dean7 Posted July 22, 2010 Author Share Posted July 22, 2010 Hi all, lately ive been coding myself a script for my website which allows users to buy a unique which is a car of there choice and faster than all the others in the game but once finished coding it, well near enouth, I tested it and its only showing a blank white screen. I think its either me missing a ; ' } but I couldnt see anything I was missing. session_start(); include ("includes/config.php"); include ("includes/functions.php"); logincheck(); // Error Check ini_set ('display_errors', 1); error_reporting (E_ALL); // End Error Check ///////// Ok so let make the varibals $username = $_SESSION['username']; $ok = mysql_query("SELECT * FROM users WHERE username='$username'") or die (mysql_error(); $fetch = mysql_fetch_object($ok); // Start the accuall code if (isset($_POST['bmoney'])){ // Post varibals $uniquename = $_POST['uniquename']; $uniquepic = $_POST['uniquepic']; $uniquespeed = "770"; $points = $fetch->points; $money = $fetch->money; // Post vatibals done // Check Name aint to long etc.. if ($uniquename == ""){ echo ("Your new unique need to have a name!"); }else{ if ($uniquename >= "41"){ echo ("Your unique name is too big!"); }else{ if ($uniquename <= "3"){ echo ("Your Unique name is too small!"); }}} // Much as I can think of about name atm // Unique Image if ($uniquepic == ""){ echo ("You need a picture for your unique!"); } // Unique Image Done I think. // Lets do the cost etc.. $costmoney = "3000000000"; $costcredits = "750"; // Buy using money // if ($money < $costmoney){ echo ("You dont have enouth money to buy a unique!"); }elseif ($money => $costmoney){ // Update using money // mysql_query ("UPDATE users SET money='$money-$costmoney' WHERE username='$username'") or die (mysql_error()); mysql_query ("INTERT INTO garage (id,car,worth,speed,owner,upgrades,status,location,origion,damage,pic) VALUES ('','$uniquename','$uniqueworth','$uniquespeed','$username','100-100-100-100-100-100-100-100','0','England','England','0','$uniquepic')") or die (mysql_error(); echo ("Your new unique is now in your garage. <br /> Brought by £3,000,000,000! <br />No Refunds!"); } } // end bmoney // End Update using money // // Buy Using credits // if (isset($_POST['bcred'])){ if ($points < $costcredits){ echo ("You dont have enouth points to buy a unique!"); }else{ if ($points >= $costcredits){ // Update using credits // mysql_query ("UPDATE users SET points='$points-$costcredits' WHERE username='$username'") or die (mysql_error()); mysql_query ("INTERT INTO garage (id,car,worth,speed,owner,upgrades,status,location,origion,damage,pic) VALUES ('','$uniquename','$uniqueworth','$uniquespeed','$username','100-100-100-100-100-100-100-100','0','England','England','0','$uniquepic')") or die (mysql_error(); echo ("Your new Unique is now in your garage. <br /> Brought by 750 Points! <br />No Refunds!"); } } } // End bcred // Ok new option. Half Money Half Credits. (Cost more) // // need new varibals $hm = "1700000000"; // money $hc = "500"; // credits if (isset($_POST['both'])){ if ($money < $hm){ echo ("You havent got enouth money!"); }else{ if ($points < $hc){ echo ("You havent got enouth points!"); }else{ if ($money >= $hm && $fetch->points >= $hc){ mysql_query ("UPDATE users SET money='$money-$hm' AND points='$points-$hc' WHERE username='$username'") or die (mysql_error()); mysql_query ("INTERT INTO garage (id,car,worth,speed,owner,upgrades,status,location,origion,damage,pic) VALUES ('','$uniquename','$uniqueworth','$uniquespeed','$username','100-100-100-100-100-100-100-100','0','England','England','0','$uniquepic')") or die (mysql_error(); echo ("Your new Unique is now in your garage. <br /> Brought with Half Money Half Credits! <br />No Refunds!"); } } } // Submit both Anyone see why its showing a blank page? Thanks. Please note, I might have other errors in that code, but I couldnt sort them as I carnt see what the errors are. You can't check string lenght like that. Use strlen() instead. What would I use strlen() for the length of the name etc? Link to comment https://forums.phpfreaks.com/topic/208524-not-showing-anything/#findComment-1089495 Share on other sites More sharing options...
timvdalen Posted July 23, 2010 Share Posted July 23, 2010 Well, you want to know if the value of $uniquename has more than 40 chars. You check that with strlen What you are doing now is checking if the value of the string is greater than 41. That makes no sense. That would be like this: "This_is_my_name" > "40" Link to comment https://forums.phpfreaks.com/topic/208524-not-showing-anything/#findComment-1090015 Share on other sites More sharing options...
Pikachu2000 Posted July 23, 2010 Share Posted July 23, 2010 In addition to timvdalen pointed out, there are 6 parse errors, and at least 3 spelling/other syntax errors in that script. Line 14 missing a parenthesis after or die(mysql_error() Line 64 incorrect comparison operator: }elseif ($money => $costmoney){ Line 68 INTERT INTO Line 68 missing a parenthesis after or die(mysql_error() Line 84 missing a parenthesis after or die(mysql_error() Line 105 UPDATE query syntax wrong Line 106 INTERT INTO Line 106 missing a parenthesis after or die(mysql_error() End Missing closing curly brace Link to comment https://forums.phpfreaks.com/topic/208524-not-showing-anything/#findComment-1090164 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.