|
It is currently Sat Feb 04, 2012 3:36 pm
|
View unanswered posts | View active topics
| Author |
Message |
|
Leonidasphp
|
Post subject: the page resulting appears without any content(or error), wh Posted: Sat Apr 12, 2008 2:50 pm |
|
Joined: Sat Feb 26, 2005 12:36 am Posts: 305
|
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> </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 rel="nofollow" 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>
|
|
| Top |
|
 |
|
Leonidasphp
|
Post subject: Posted: Sun Apr 13, 2008 12:34 am |
|
Joined: Sat Feb 26, 2005 12:36 am Posts: 305
|
|
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....
|
|
| Top |
|
 |
|
Leonidasphp
|
Post subject: I correct script but nothing on screen even error, ...? Posted: Sun Apr 13, 2008 3:19 pm |
|
Joined: Sat Feb 26, 2005 12:36 am Posts: 305
|
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); ?>
|
|
| Top |
|
 |
|
lostboy
|
Post subject: Posted: Sun Apr 13, 2008 9:33 pm |
|
Joined: Sun May 02, 2004 11:34 pm Posts: 6498 Location: toronto, canada
|
|
since the echo $pricesArray is commented out, and there don't seem to be other echos, you will not see anything on screen
_________________ Lostboy
Cat, the other other white meat
Please read Posting Etiquette before posting
You can always try Google
|
|
| Top |
|
 |
|
Leonidasphp
|
Post subject: this script is on the resulting page(update-prices.php), aft Posted: Sun Apr 13, 2008 10:35 pm |
|
Joined: Sat Feb 26, 2005 12:36 am Posts: 305
|
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 rel="nofollow" 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%"> </td> <td colspan="2"> Low Season <br /> 1st Nov.-15th March </td> <td colspan="2"> Mid Season <br /> 16th March-30th June </td> <td colspan="2"> High Season <br /> 1st July-31st Oct. </td> </tr> <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 rel="nofollow" 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>
|
|
| Top |
|
 |
|
Leonidasphp
|
Post subject: Why it does not move to other rows ? Posted: Sun Apr 13, 2008 10:48 pm |
|
Joined: Sat Feb 26, 2005 12:36 am Posts: 305
|
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); ?>
|
|
| Top |
|
 |
|
Leonidasphp
|
Post subject: seems session do not get destroyed , well ? Posted: Mon Apr 14, 2008 3:00 pm |
|
Joined: Sat Feb 26, 2005 12:36 am Posts: 305
|
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-pri ... essori.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'; ";
|
|
| Top |
|
 |
|
Leonidasphp
|
Post subject: but I can login typing any word , well ? Posted: Mon Apr 14, 2008 3:08 pm |
|
Joined: Sat Feb 26, 2005 12:36 am Posts: 305
|
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 ?
|
|
| Top |
|
 |
|
Leonidasphp
|
Post subject: all fixed now just: $query =UPDATE multiline ??? >>& Posted: Mon Apr 14, 2008 8:04 pm |
|
Joined: Sat Feb 26, 2005 12:36 am Posts: 305
|
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);
?>
|
|
| Top |
|
 |
|
lostboy
|
Post subject: Posted: Mon Apr 14, 2008 8:31 pm |
|
Joined: Sun May 02, 2004 11:34 pm Posts: 6498 Location: toronto, canada
|
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.");
_________________ Lostboy
Cat, the other other white meat
Please read Posting Etiquette before posting
You can always try Google
|
|
| Top |
|
 |
Who is online |
Users browsing this forum: No registered users and 0 guests |
|
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
|
|