RON_ron
-
Posts
370 -
Joined
-
Last visited
Posts posted by RON_ron
-
-
Someone Help.....
-
Am I in the wrong place or is this impossible or are there better ways of doing this?
-
Sorry! I if I was not clear...
E.g.
$winRa1 = $userRa1, $winRa2 = $userRa2,... (if both are matching then it's 2 points.)
$winRk1 = $userRk1, $winRk2 = $userRk2,... (if only 1 is matching then it's 1 point.)
Hope you experts are clear of that.
-
How to write this in a shorter way?
I've got a set of results and I need to check them against another database results. If they both are similar then I want to make it as "1" (points). The questions and the answers are in the same order (Question1, Question2, Question3 = Answer1, Answer2, Answer3). sa I guess the maching could be done using a set of arrays.
E.g.
get records from db1 get records from db2
get records from dbY get records from dbX
COUNT the matching data from db1 against dbY = echo TOTAL_SCORE1
COUNT the matching data from db2 against dbX = echo TOTAL_SCORE2
I've managed to get the data from the databases in order. But i need to get the COUNT of the MATCHING records.
php
\\Assume this is db1 $SomeVar = $_POST['sitting2']; $queryU = "SELECT * FROM adxone WHERE username = '".$SomeVar."'"; $resultU = mysql_query($queryU); $scoreU = mysql_fetch_assoc($resultU); $userRa1 = $scoreU['roundzAa']; $userRa2 = $scoreU['roundzAb']; $userRa3 = $scoreU['roundzAc']; $userRa4 = $scoreU['roundzAd']; $userRa5 = $scoreU['roundzAe']; $userRa6 = $scoreU['roundzAf']; $userRa7 = $scoreU['roundzAg']; $userRa8 = $scoreU['roundzAh']; \\ Assume this is dbY $WinVar = 'examinationA'; $query = "SELECT * FROM markacs WHERE roundx = '".$WinVar."'"; $result = mysql_query($query); $scoreM = mysql_fetch_assoc($result); $winRa1 = $scoreM['markwinxa']; $winRa2 = $scoreM['markwinxb']; $winRa3 = $scoreM['markwinxc']; $winRa4 = $scoreM['markwinxd']; $winRa5 = $scoreM['markwinxe']; $winRa6 = $scoreM['markwinxf']; $winRa7 = $scoreM['markwinxg']; $winRa8 = $scoreM['markwinxh']; /*need to match if $winRa1 = $userRa1, $winRa2 = $userRa2, etc.. then get the COUNT of the matching results*/
-
Hi jdavidbakr.
That was exactly what I wanted to know.
Many thanks!
Ron.
-
Wel spotted litebearer and shlumph.
// Is PendingXCD a constant OR did you forget the Dollar Sign?<br>nope. "PendingXCD" the word I want to match againts the name.
But still that doesn't work for the first condition.
$result1=mysql_query("SELECT * FROM applicants WHERE username = '$user' AND status = 'PendingXCD'"); if(mysql_num_rows($result1)) { $login = "&err=In progress."; echo($login); //
-
The error I'm getting is
unexpected $end in /home/xxx/public_html/xxx/test.php on line 22
line 22 is ?>
Any idea why?
-
Hey Dan...
I'm trying to match a user name in database "applicants" and if it exist and hold the value "PendingXCD" then it returns echo "A"
if not
it should search for the same username in batabase "comp" and if it exist it should match againts it's the password and echo "B"
if not
echo "C"
But I'm unable to do it. Please help.
-
this doesn't work. Please help fix this.
$result1=mysql_query("SELECT * FROM applicants WHERE username = '$user' AND status = 'PendingXCD'");
if(mysql_num_rows($result1)) {
$login = "&err=In progress.";
echo($login);
}
else {
$result=mysql_query("SELECT * FROM comp WHERE username = '$user' AND password ='$pass'");
if(mysql_num_rows ($result) == 0) {
$login = "&err=Please retry.";
echo($login);
} else {
$row = mysql_fetch_array($result);
$user=$row['user'];
$pass=$row['pass'];
$login = "$user=" . $user . "$pass=" . $pass . "&err=Successful.";
echo($login);
}
?>
-
Nope.
I'm asking if it is safe to use the username and password (given by the host) in the php connection?
or can the usernames and passwords which was created when creating the database should be safer and used to connect to the database?
E.g.1
<?php $link = mysql_connect("localhost","username_given_by_host","password_given_by_host"); mysql_select_db("db_1");
E.g.2
<?php $link = mysql_connect("localhost","username_created_when_creating_the_db","password_created_when_creating_the_db"); mysql_select_db("db_1");
-
I need to check if in databaseA (shown below as applicant) it says "PendingGroupA" if yes echo "something"
and if not to check databaseB (shown below as comp) for the username and password.
Then upon successful username and password entry echo "message B".
And if username and password fails to echo "message C".
How can I write this correctly?
$result=mysql_query("SELECT * FROM comp WHERE username = '$useid' AND pass ='$pass'"); if(mysql_num_rows ($result) == 0) { $login = "&err=Login Failed. Please retry."; echo($login); } elseif { $row = mysql_fetch_array($result); $user=$row['user']; $pass=$row['pass']; $login = "$user=" . $user . "$pass=" . $pass . "&err=Login Successful."; echo($login); } else { $resultA=mysql_query("SELECT * FROM applicant WHERE username = '$useid' AND statusA ='PendingGroupA'"); $peningGA = "&err=Please be patient!"; echo($peningGA); }
-
I don't really know... but there is an option of creating users + passwords when a creating a database using PhpMyAdmin. So I'm confused.
As you see I'm a novice!
-
How to write 2 "if" statements together?
if($userResult==$myResult) and ($userResult<0)
{
-
Thanks Don!!
-
Cheers!
-
Thanks doni49!!!!!
-
How can I ignore - when doing claculations?
e.g.
150 - 50 = 100
150 - 225 = -75 // I WANT to display only 75 and ignore the - sign
-
Thanks jcbones. But the code did not give me the results I wanted. This echos "udatedValue" nothing else.
Here's what I'm trying to achieve.
I want to check if the $scoreM['newtag'] and $scoreU['newPrice'] are the same.
If it is similar
then I want to get the difference between $scoreM['newtag'] and $scoreU['newPrice']
if it's not similar
then I want to get the total between $scoreM['newtag'] and $scoreU['newPrice']
-
Please help me calculate this according to the "if" condition.
$scoreM['newtag'] + $scoreU['newPrice']
$SomeVar = 'currentPrice'; $queryU = "SELECT * FROM db1 WHERE bookprice = '".$SomeVar."'"; $resultU = mysql_query($queryU); $scoreU = mysql_fetch_assoc($resultU); echo $scoreU['newPrice']; echo $scoreU['weeklyScr']; echo $scoreU['priceX']; //// $WinVar = 'additionalAmount'; $query = "SELECT * FROM db2 WHERE booklist = '".$WinVar."'"; $result = mysql_query($query); $scoreM = mysql_fetch_assoc($result); echo $scoreM['newtag']; echo $scoreM['priceY']; if($scoreU['priceX']== $scoreM['priceY']) { $udatedValue = ($scoreM['newtag'] - $scoreU['newPrice']); echo(udatedValue); } else{ $udatedValue = ($scoreM['newtag'] + $scoreU['newPrice']); echo(udatedValue); }
-
Thanks mate!
-
How to pull just I record of a column out of the 20 columns? This is not showing the results.
$SomeVar = 'pets'; $query = "SELECT field1 FROM db1 WHERE id1 = '".$SomeVar."'"; $results=mysql_query($link); echo $link;
-
When I need to post / get data out of the MySQL, if I use the username and password which is the same username and password to access the CP,
1. is this a bad thing to do?
2. Is it safe/risky?
<?php $conn = mysql_connect("localhost","the_un1","the_pw1"); $db = mysql_select_db("the_db");
-
Hey DON - I appreciate your effort N time mate!!
-
Thanks mate!!
Set time zone?
in PHP Coding Help
Posted
How to set the time zone? All 3 shows the same time???