the page resulting appears without any content(or error), where is the problem ? (Full Version)

All Forums >> [Web Development] >> Dreamweaver Help



Message


lsfphelpls -> the page resulting appears without any content(or error), where is the problem ? (4/12/2008 8:02:50)

After login at:
http://www.paphoscarhire.com/login.php
the page resulting:
http://www.paphoscarhire.com/update-prices.php
appears without any content(or error), where is the problem ?
Please note the update-prices.php webpage appears data(prices:rent a car rates) in form fields to update and submit back to database ...
Some scripts from update-prices.php follow:

 
<?php   // script: retrieve from db and show after UPDATE save to db 

if ((($_POST['username'] == "pphch123s") && ($_POST['password'] == "retAsw123")) || ($_SESSION['login'] = "yes")) { 
   $_SESSION['login'] = "yes"; 
} else { 
   echo "<p>Wrong Username or Password, you will redirected in a few seconds...</p>"; 
   sleep(5); 
   header('Location:login.php'); 
} 

include("dbinfo.php"); 
$linkid = @mysqli_connect($hostname,$username,$password); 
   die( "Unable to connect to Database Server. Please try again later.");  
@mysqli_select_db($linkid,$database) or die( "Unable to select database.  Please try again later,");   // @ 

$query = "SELECT * FROM updateTable";    

$result = @mysqli_query($linkid,$query); 
   die( "Unable to execute query. Please try again later.");  
// $count = @mysql_num_rows($result); 

$row = @mysqli_fetch_row($result); 

$pricesArray = Array(16,6); 
$i = 0; 
$j = 0; 
Do { 
 for ($j=0;$J<6;++$j) { 
  $pricesArray[$i][$j] = $row[$j+1]; 
  // echo $pricesArray[$i][$j]; 
 } 
 $i = $i + 1; 
 $row = @mysqli_fetch_row($result); 
} while ($row); 
  
mysqli_free_result($result); 
mysqli_close($linkid); 
?> 


      <tr> 
        <td>  </td> 
        <td width="37%"> Car Model\Rental Period </td> 
        <td width="9%" align="center" valign="middle">2-6 days </td> 
        <td width="12%" align="center" valign="middle">7+ Days </td> 
        <td width="9%" align="center" valign="middle">2-6 days </td> 
        <td width="8%" align="center" valign="middle">7+ days </td> 
        <td width="10%" align="center" valign="middle">2-6 days </td> 
        <td width="9%" align="center" valign="middle">7+ days </td> 
      </tr> 
      <tr> 
        <td align="right"> A </td> 
        <td><a href="unsaved:///cars/group_a.htm"> Daihatsu Cuore or similar </a></td> 
        <td align="center" valign="middle"><input name="aL" type="text" id="aL" value="<?= $pricesArray[0][0]; ?>" size="5" maxlength="5" /></td> 
        <td align="center" valign="middle"> 
          <input name="aL7" type="text" id="aL7" value="<?= $pricesArray[0][1]; ?>" size="5" maxlength="5" /></td> 
        <td align="center" valign="middle"> 
          <input name="aM" type="text" id="aM" value="<?= $pricesArray[0][2]; ?>" size="5" maxlength="5" /></td> 
        <td align="center" valign="middle"> 
          <input name="aM7" type="text" id="aM7" value="<?= $pricesArray[0][3]; ?>" size="5" maxlength="5" /></td> 
        <td align="center" valign="middle"> 
          <input name="aH" type="text" id="aH" value="<?= $pricesArray[0][4]; ?>" size="5" maxlength="5" /></td> 
        <td align="center" valign="middle">          
          <input name="aH7" type="text" id="aH7" value="<?= $pricesArray[0][5]; ?>" size="5" maxlength="5" /></td> 
      </tr> 




lsfphelpls -> RE: the page resulting appears without any content(or error), where is the problem ? (4/12/2008 17:04:59)

I try debug but after some time spent, appears repeately the below....
$pricesArray[$i][$j] = $row[$j+1]; // line 40

Warning: Cannot use a scalar value as an array in /home/content/l/s/f/lsfontana/html/update-prices.php on line 40

Warning: Cannot use a scalar value as an array in /home/content/l/s/f/lsfontana/html/update-prices.php on line 40

Warning: Cannot use a scalar value as an array in /home/content/l/s/f/lsfontana/html/update-prices.php on line 40
........................
........................




lsfphelpls -> RE: the page resulting appears without any content(or error), where is the problem ? (4/12/2008 17:34:06)

What to write [2 dim array] ?
if I use
$pricesArray = Array();
but I get nothing on screen[even an error] ...How I view SERVER log ? I use sharing hosting a/c from godaddy.com....





lsfphelpls -> RE: the page resulting appears without any content(or error), where is the problem ? (4/13/2008 8:18:31)

I correct script but nothing on screen even error, ...?

<?php   // script: retrieve from db and show after UPDATE save to db

if ((($_POST['username'] == "pphch123s") && ($_POST['password'] == "retAsw123")) || ($_SESSION['login'] = "yes")  || (($_POST['username'] == "guest") && ($_POST['password'] == "guest"))) {
   $_SESSION['login'] = "yes";
} else {
   echo "<p>Wrong Username or Password, you will redirected in a few seconds...</p>";
   sleep(5); 
   header('Location:login.php');
}

include("dbinfo.php");
$linkid = @mysql_connect($hostname,$username,$password) or die( "Unable to connect to Database Server. Please try again later.");  
@mysql_select_db($database,$linkid) or die( "Unable to select database.  Please try again later,");   // @

$query = "SELECT * FROM updateTable";   

$result = @mysql_query($query,$linkid) or die( "Unable to execute query. Please try again later.");  
// $count = @mysql_num_rows($result);

$row = @mysql_fetch_row($result);
// $pricesArray = Array(16,6);
$pricesArray = Array();
$i = 0;
$j = 0;
Do {
 $pricesArray[$i] = Array();
 for ($j=0;$J<6;++$j) {
  $pricesArray[$i][$j] = $row[($j+1)];
  // echo $pricesArray[$i][$j];
 }
 $i = $i + 1;
 $row = @mysql_fetch_row($result);
} while ($row);
 
mysql_free_result($result);
mysql_close($linkid);
?>




Ryokotsusai -> RE: the page resulting appears without any content(or error), where is the problem ? (4/13/2008 23:14:30)

quote:

ORIGINAL: lsfphelpls

I correct script but nothing on screen even error, ...?

<?php   // script: retrieve from db and show after UPDATE save to db

if ((($_POST['username'] == "pphch123s") && ($_POST['password'] == "retAsw123")) || ($_SESSION['login'] = "yes")  || (($_POST['username'] == "guest") && ($_POST['password'] == "guest"))) {
   $_SESSION['login'] = "yes";
} else {
   echo "<p>Wrong Username or Password, you will redirected in a few seconds...</p>";
   sleep(5); 
   header('Location:login.php');
}

include("dbinfo.php");
$linkid = @mysql_connect($hostname,$username,$password) or die( "Unable to connect to Database Server. Please try again later.");  
@mysql_select_db($database,$linkid) or die( "Unable to select database.  Please try again later,");   // @

$query = "SELECT * FROM updateTable";   

$result = @mysql_query($query,$linkid) or die( "Unable to execute query. Please try again later.");  
// $count = @mysql_num_rows($result);

$row = @mysql_fetch_row($result);
// $pricesArray = Array(16,6);
$pricesArray = Array();
$i = 0;
$j = 0;
Do {
 $pricesArray[$i] = Array();
 for ($j=0;$J<6;++$j) {
  $pricesArray[$i][$j] = $row[($j+1)];
  // echo $pricesArray[$i][$j];
 }
 $i = $i + 1;
 $row = @mysql_fetch_row($result);
} while ($row);
 
mysql_free_result($result);
mysql_close($linkid);
?>


The only thing in the above script that seems wrong to me is :
for ($j=0;$J<6;++$j) 


which should be:
for ($j=0;$j<6;$j++) 


I'm not sure if that will fix the problem your having though, thats just the only thing that I saw.




lsfphelpls -> RE: the page resulting appears without any content(or error), where is the problem ? (4/14/2008 4:14:10)

I use below code and I get(without quotes the same as before): "020.5123125.53127.5".
please note that digits after 0 represent prices of ONLY the first row[20.5 12 31 25.5 31 27.5] ? Why it does not move to other rows ?

<?php   // script: retrieve from db and show after UPDATE save to db
/*
if ((($_POST['username'] == "pphch123s") && ($_POST['password'] == "retAsw123")) || ($_SESSION['login'] = "yes")  || (($_POST['username'] == "guest") && ($_POST['password'] == "guest"))) {
   $_SESSION['login'] = "yes";
} else {
   echo "<p>Wrong Username or Password, you will redirected in a few seconds...</p>";
   sleep(5); 
   header('Location:login.php');
}
*/
include("dbinfo.php");
$linkid = @mysql_connect($hostname,$username,$password) or die( "Unable to connect to Database Server. Please try again later.");  
@mysql_select_db($database,$linkid) or die( "Unable to select database.  Please try again later,");   // @

$query = "SELECT * FROM updateTable";   

$result = @mysql_query($query,$linkid) or die( "Unable to execute query. Please try again later.");  
// $count = @mysql_num_rows($result);

$row = @mysql_fetch_row($result);
// $pricesArray = Array(16,6);
$pricesArray = Array();
$i = 0;
echo $i;
$j = 0;
Do {
 $pricesArray[$i] = Array();
 for ($j=0;$J<6;$j++) {
  $pricesArray[$i][$j] = $row[($j+1)];
  echo $pricesArray[$i][$j];
 }
 $i = $i + 1;
 $row = @mysql_fetch_row($result);
} while ($row);
echo $pricesArray[14][3]; 
mysql_free_result($result);
mysql_close($linkid);
?>




lsfphelpls -> RE: the page resulting appears without any content(or error), where is the problem ? (4/14/2008 4:17:57)

the
echo $pricesArray[14][3];
do not get printed neither appears any content or error, although there are html and echos after the script ...well ?




Ryokotsusai -> RE: the page resulting appears without any content(or error), where is the problem ? (4/14/2008 4:52:46)

If you think it may be an error that the page isn't showing, try running the script with this at the top:
error_reporting(E_ALL);


and to see what that array contains, use print_r($pricesArray) and see where it stopped, maybe that will help

also the $J in the for loop should be $j ($J and $j are considered different variables by php), that loop will continue for a very long time as $J will always be less than 6 no matter what the value of $j is




lsfphelpls -> RE: the page resulting appears without any content(or error), where is the problem ? (4/14/2008 5:01:19)

see attached db table ...




lsfphelpls -> RE: the page resulting appears without any content(or error), where is the problem ? (4/14/2008 5:10:18)

where to put

error_reporting(E_ALL);

in php code ?




Ryokotsusai -> RE: the page resulting appears without any content(or error), where is the problem ? (4/14/2008 5:13:51)

at the very top of the page:
<?php
error_reporting(E_ALL); 




lsfphelpls -> RE: the page resulting appears without any content(or error), where is the problem ? (4/14/2008 7:59:42)

I make it finally work. well another thing, After the application at (http://www.paphoscarhire.com/login.php) confirm price update when I press logout and after try to login without any characters(empty) to username/password I login successfully, seems session do not get destroyed , well ?:
(http://www.paphoscarhire.com/logout.php)
<?php 
session_start();
if ($_POST['logout'] == 'yes') {
   $_SESSION = array();
   session_destroy();
   header('Location:login.php');
} else {
   header('Location:update-prices.php');
}
// echo "You will be redirected in a few seconds...";

?>


from script(http://www.paphoscarhire.com/update-prices-processori.php):

<form name="form1" id="form1" method="post" action="logout.php">
  <p>
    <input name="back" type="hidden" id="back" value="yes" />
    <input type="submit" name="Submit3" value="Go Back To Change Prices Again" />
  </p>
</form>
<form name="form1" id="form1" method="post" action="logout.php">
  <input name="logout" type="hidden" id="logout" value="yes" />
  <input type="submit" name="Submit2" value="Log Out" />
</form>
</body>
</html>


May use below each statement in individual line ?

$query = "UPDATE updateTable SET L='$aL', L7='$aL7', M='$aM', M7='$aM7', H='$aH', H7='$aH7' WHERE cat='A';
UPDATE updateTable SET L='$b1L', L7='$b1L7', M='$b1M', M7='$b1M7', H='$b1H', H7='$b1H7' WHERE cat='B1';
UPDATE updateTable SET L='$b2L', L7='$b2L7', M='$b2M', M7='$b2M7', H='$b2H', H7='$b2H7' WHERE cat='B2'; ";




lsfphelpls -> RE: the page resulting appears without any content(or error), where is the problem ? (4/14/2008 8:06:43)

After login.php I go to http://www.paphoscarhire.com/update-prices.php with:

<?php 
session_start();
// echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; 
if ((($_POST['username'] == "pphch123s") && ($_POST['password'] == "retAsw123")) || ($_SESSION['login'] = "yes")  || (($_POST['username'] == "guest") && ($_POST['password'] == "guest"))) {
   $_SESSION['login'] = "yes";
} else {
   // sleep(5); 
   header('Location:login.php');
   // echo "<p>Wrong Username or Password, you will redirected in a few seconds...</p>";
   
}
?>

but I can login typing any word , well ?




lsfphelpls -> RE: the page resulting appears without any content(or error), where is the problem ? (4/14/2008 13:03:54)

all fixed now just: $query =UPDATE multiline ??? >>>

I get :Unable to execute query. Please go back and retry.

[CODE]include("dbinfo.php");
$linkid = @mysql_connect($hostname,$username,$password) or die( "Unable to connect to Database Server. Please try again later.");
@mysql_select_db($database,$linkid) or die( "Unable to select database. Please try again later,"); // @

$query = "UPDATE updateTable SET L='$aL', L7='$aL7', M='$aM', M7='$aM7', H='$aH', H7='$aH7' WHERE cat='A';
UPDATE updateTable SET L='$b1L', L7='$b1L7', M='$b1M', M7='$b1M7', H='$b1H', H7='$b1H7' WHERE cat='B1';
UPDATE updateTable SET L='$b2L', L7='$b2L7', M='$b2M', M7='$b2M7', H='$b2H', H7='$b2H7' WHERE cat='B2';
UPDATE updateTable SET L='$cL', L7='$cL7', M='$cM', M7='$cM7', H='$cH', H7='$cH7' WHERE cat='C';
UPDATE updateTable SET L='$dL', L7='$dL7', M='$dM', M7='$dM7', H='$dH', H7='$dH7' WHERE cat='D';
UPDATE updateTable SET L='$eL', L7='$eL7', M='$eM', M7='$eM7', H='$eH', H7='$eH7' WHERE cat='E';
UPDATE updateTable SET L='$fL', L7='$fL7', M='$fM', M7='$fM7', H='$fH', H7='$fH7' WHERE cat='F';
UPDATE updateTable SET L='$gL', L7='$gL7', M='$gM', M7='$gM7', H='$gH', H7='$gH7' WHERE cat='G';
UPDATE updateTable SET L='$hL', L7='$hL7', M='$hM', M7='$hM7', H='$hH', H7='$hH7' WHERE cat='H';
UPDATE updateTable SET L='$iL', L7='$iL7', M='$iM', M7='$iM7', H='$iH', H7='$iH7' WHERE cat='I';
UPDATE updateTable SET L='$jL', L7='$jL7', M='$jM', M7='$jM7', H='$jH', H7='$jH7' WHERE cat='J';
UPDATE updateTable SET L='$k1L', L7='$k1L7', M='$k1M', M7='$k1M7', H='$k1H', H7='$k1H7' WHERE cat='K1';
UPDATE updateTable SET L='$k2L', L7='$k2L7', M='$k2M', M7='$k2M7', H='$k2H', H7='$k2H7' WHERE cat='K2';
UPDATE updateTable SET L='$nL', L7='$nL7', M='$nM', M7='$nM7', H='$nH', H7='$nH7' WHERE cat='N';
UPDATE updateTable SET L='$pL', L7='$pL7', M='$pM', M7='$pM7', H='$pH', H7='$pH7' WHERE cat='P';
UPDATE updateTable SET L='$sL', L7='$sL7', M='$sM', M7='$sM7', H='$sH', H7='$sH7' WHERE cat='S';
";
// P499
$result = @mysql_query($query,$linkid) or die("Unable to execute query. Please go back and retry.");
echo "<p>Rental Prices get UPDATED sucessfully,...</p>";

mysql_close($linkid);

?>[/CODE]




lsfphelpls -> RE: the page resulting appears without any content(or error), where is the problem ? (4/14/2008 13:36:09)

I do not try yet but eched the query:
UPDATE updateTable SET L='20.5', L7='12', M='31', M7='25.5', H='31', H7='27.5' WHERE cat='A'; UPDATE updateTable SET L='24', L7='13', M='32.5', M7='27.5', H='32.5', H7='28' WHERE cat='B1'; UPDATE updateTable SET L='24', L7='14.5', M='34', M7='29', H='34', H7='32.5' WHERE cat='B2'; UPDATE updateTable SET L='25.5', L7='16', M='34', M7='32.5', H='36', H7='34' WHERE cat='C'; UPDATE updateTable SET L='27.5', L7='16', M='39.5', M7='31', H='36', H7='34' WHERE cat='D'; UPDATE updateTable SET L='32.5', L7='19.5', M='44.5', M7='36', H='41', H7='36' WHERE cat='E'; UPDATE updateTable SET L='34', L7='22', M='46', M7='37.5', H='44.5', H7='37.5' WHERE cat='F'; UPDATE updateTable SET L='34', L7='27.5', M='46', M7='34', H='49.5', H7='44.5' WHERE cat='G'; UPDATE updateTable SET L='65', L7='58', M='77', M7='72', H='84', H7='72' WHERE cat='H'; UPDATE updateTable SET L='48', L7='36', M='58', M7='48', H='58', H7='51.5' WHERE cat='I'; UPDATE updateTable SET L='37.5', L7='29', M='51.5', M7='44.5', H='54.5', H7='48' WHERE cat='J'; UPDATE updateTable SET L='41', L7='32.5', M='54.5', M7='49.5', H='58', H7='54.5' WHERE cat='K1'; UPDATE updateTable SET L='44.5', L7='34', M='58', M7='53', H='61.5', H7='58' WHERE cat='K2'; UPDATE updateTable SET L='48', L7='44.5', M='65', M7='56.5', H='65', H7='61.5' WHERE cat='N'; UPDATE updateTable SET L='48', L7='44.5', M='58', M7='53', H='63', H7='60' WHERE cat='P'; UPDATE updateTable SET L='25.5', L7='22', M='29', M7='29', H='31', H7='29' WHERE cat='S';Unable to execute query. Please go back and retry.




Ryokotsusai -> RE: the page resulting appears without any content(or error), where is the problem ? (4/14/2008 20:21:39)

quote:

if ((($_POST['username'] == "pphch123s") && ($_POST['password'] == "retAsw123")) || ($_SESSION['login'] = "yes") || (($_POST['username'] == "guest") && ($_POST['password'] == "guest")))


In that line, you have:
($_SESSION['login'] = "yes")


instead of:
($_SESSION['login'] == "yes")


that if statement will always equate to 'true' as long as there is an open session, as the if statement itself is setting the variable $_SESSION['login'] to "yes"

quote:

$query =UPDATE multiline ??? >>>

Using standard MySQL functions a multiline update is not normally allowed.

Using Mysqli functions there is a multi query function: mysqli_multi_query(), but not all hosts have mysqli enabled

If you do have mysqli enabled, here is an example of a working script:
test.php




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.078125