Hi guys, can anyone help me with this script? The problem is that even with right values in data base it still fails, but only when i have more than 1 row in db.
Any suggestions on how to make this work properly ?
-------------------------------------------------------------------------------------------------------------------
<?php
include 'config.php';
$p=1;
$q=1;
$r=1;
$s=1;
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
$selected = mysql_select_db("db",$dbhandle)
or die("Could not select db");
$result = mysql_query("SELECT a, b, c, d FROM Table");
while ($row = mysql_fetch_array($result)) {
$a = $row['a'];
$b = $row['b'];
$c = $row['c'];
$d = $row['d'];
}
$result2= mysql_query("SELECT x, y, z, t FROM Table2");
while ($row = mysql_fetch_array($result2)) {
$x = $row['x'];
$y = $row['y'];
$z = $row['z'];
$t = $row['t'];
}
$ex = $a+$b+$c+$d;
$ex2 = $x+$y+$z+$t;
$ex3 = $ex+$ex2;
$ex4 = $p+$q+$r+$s;
//-------------------------------------------------------------------------------
if ($ex4 >= $ex && $ex4 <= $ex3) {
echo "Succes"."<br>"; }
else {
echo "Fail"."<br>";
}
//------------------------------------------------------------------------------
?>
Help
Moderator: General Moderators
Re: Help
Code: Select all
while ($row = mysql_fetch_array($result)) {
$a = $row['a'];
$b = $row['b'];
$c = $row['c'];
$d = $row['d'];
}If you had given a description of the problem I would have suggested another method.