PHP forums, MySQL forums, Web Development resources

Home PageHome    PHP ResourcesTopic List    FAQFAQ    SearchSearch    MemberlistMemberlist    UsergroupsUsergroups 
 RegisterRegister
    ProfileProfile    Log in to check your private messagesLog in to check your private messages    Download the RSS Reader RSS Feed Download the RSS Reader RSS for this forum Log inLog in 

PHP Forum :: MySQL Forum :: Java Script Forum



the page resulting appears without any content(or error), wh
Goto page 1, 2  Next
 
Post new topic   Reply to topic    WeberForums.com Forum Index -> MySQL General
View previous topic :: View next topic  
Author Message
Leonidasphp



Joined: 25 Feb 2005
Posts: 305

PostPosted: Sat Apr 12, 2008 1:50 pm    Post subject: the page resulting appears without any content(or error), wh Reply with quote

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:

Code:
<?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);
?>


Code:
      <tr>
        <td>&nbsp; </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>
Back to top
View user's profile Send private message
Leonidasphp



Joined: 25 Feb 2005
Posts: 305

PostPosted: Sat Apr 12, 2008 11:34 pm    Post subject: Reply with quote

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

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....
Back to top
View user's profile Send private message
Leonidasphp



Joined: 25 Feb 2005
Posts: 305

PostPosted: Sun Apr 13, 2008 2:19 pm    Post subject: I correct script but nothing on screen even error, ...? Reply with quote

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

Code:
<?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);
?>
Back to top
View user's profile Send private message
lostboy



Joined: 02 May 2004
Posts: 6033
Location: toronto, canada

PostPosted: Sun Apr 13, 2008 8:33 pm    Post subject: Reply with quote

since the echo $pricesArray is commented out, and there don't seem to be other echos, you will not see anything on screen
Back to top
View user's profile Send private message Send e-mail AIM Address MSN Messenger
Leonidasphp



Joined: 25 Feb 2005
Posts: 305

PostPosted: Sun Apr 13, 2008 9:35 pm    Post subject: this script is on the resulting page(update-prices.php), aft Reply with quote

this script is on the resulting page(update-prices.php), after
LogIn Admin change prices: http://www.paphoscarhire.com/login.php
username="pphch123s"
password="retAsw123" ....see

Code:
<?php
session_start();
// echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Rates</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="styles.css" rel="stylesheet" type="text/css" />
<META NAME="robots" content="none" />
</head>

<body>
<?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);
?>
<div align="center"><img src="images/rs_header.jpg" alt="heading" width="800" height="103" /></div>
<table width="800" border="0" align="center" cellpadding="5" cellspacing="1">
  <tr>
    <td><div align="center"></div></td>
  </tr>
  <tr>
    <td><div align="center"><img src="images/gif/rates.gif" alt="Rates" width="127" height="20" /></div></td>
  </tr>
  <tr>
    <td height="457"><form action="update-prices-processor.php" method="post" enctype="application/x-www-form-urlencoded" target="_self" class="form_text"><table width="95%" align="center" cellpadding="2" cellspacing="0">
      <tr>
        <td width="6%"> Group\
          Date </td>
        <td width="37%">&nbsp; </td>
        <td colspan="2"> Low Season <br />
      1st Nov.-15th March </td>
        <td colspan="2"> Mid Season <br />
      16th March-30th June&nbsp; </td>
        <td colspan="2"> High Season <br />
      1st July-31st Oct.&nbsp; </td>
      </tr>
      <tr>
        <td>&nbsp; </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>
      <tr>
        <td align="right"> B1 </td>
Back to top
View user's profile Send private message
Leonidasphp



Joined: 25 Feb 2005
Posts: 305

PostPosted: Sun Apr 13, 2008 9:48 pm    Post subject: Why it does not move to other rows ? Reply with quote

I use below code and I get(without quotes): "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 ?

Code:
<?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);
 
mysql_free_result($result);
mysql_close($linkid);
?>
Back to top
View user's profile Send private message
Leonidasphp



Joined: 25 Feb 2005
Posts: 305

PostPosted: Mon Apr 14, 2008 2:00 pm    Post subject: seems session do not get destroyed , well ? Reply with quote

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)
Code:
<?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):

Code:
<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'; ";
Back to top
View user's profile Send private message
Leonidasphp



Joined: 25 Feb 2005
Posts: 305

PostPosted: Mon Apr 14, 2008 2:08 pm    Post subject: but I can login typing any word , well ? Reply with quote

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

Code:
<?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 ?
Back to top
View user's profile Send private message
Leonidasphp



Joined: 25 Feb 2005
Posts: 305

PostPosted: Mon Apr 14, 2008 7:04 pm    Post subject: all fixed now just: $query =UPDATE multiline ??? >>& Reply with quote

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);

?>
Back to top
View user's profile Send private message
lostboy



Joined: 02 May 2004
Posts: 6033
Location: toronto, canada

PostPosted: Mon Apr 14, 2008 7:31 pm    Post subject: Reply with quote

try

Code:

$result = mysql_query($query,$linkid) or die(mysql_error());


instead of

Code:

$result = @mysql_query($query,$linkid) or die("Unable to execute query. Please go back and retry.");
Back to top
View user's profile Send private message Send e-mail AIM Address MSN Messenger
Display posts from previous:   
WeberTrivia Questions WeberTrivia Questions
 Think you are smart? Prove it!. Try your skills with these questions :
 WeberTrivia QuestionsRecursive arrays and multi-dimensional arrays are one and the same. (PHP and MySQL)
 WeberTrivia QuestionsThe \"cache_dir\" tag of the squid configuration has a default of /var/spool/squid. (Linux)

WeberTrivia Questions



PHP Code Examples
 Stream diffrent sizes of images from a single image to save disk space.
 JavaScript dropdown list menu to switch any page.
 Dump the contents of a PHP variable in html format with a recursive list of subfolders and files from a given root directory.
 PHP Dump in html format the contents of one array variable with a recursive list of the nested array variables inside.
 Link Extractor - This function is used to extract links from a given URL. This will convert relative path into absolute path and also remove PHPSESSID stuff.
 Building a Dynamic Form using Javascript and innerHTML. Add form elements in realtime without refreshing the page.
 A PHP Calendar function with CSS : add a cool calendar to any php page by just adding a calendar class based function.
Post new topic   Reply to topic    WeberForums.com Forum Index -> MySQL General All times are GMT + 2 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Powered by phpBB © 2001, 2005 phpBB Group
PHP Forum :: MySQL Forum :: Java Script Forum