[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

PHP sql data selection and compare

Posted on 2010-08-23
3
Medium Priority
?
196 Views
Last Modified: 2013-12-13
// I have problem. it does not take tha date and assign it to the  $date_comingfrom_database
what should I do?

$query = "SELECT Email,Date FROM Mytable where Email='$visitoremail'";
$sql=mysql_query($query);
$result = mysql_fetch_array($query); // I have error message Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /
// I have problem here it does not take tha date and assign it to the  $date_comingfrom_database

$date_comingfrom_database = $result['Date'];
$databaseemail =$result['Email'];

$todaysdate = date('Y-m-d H:i:s');

if ( ( strtotime('Y-m-d H:i:s') - strtotime($date_comingfrom_database) >= 50 ) && ($databaseemail = $visitormail))
{
echo "record exist."  . $date_comingfrom_database . " ".$databaseemail. " ".$visitormail    ;
}
else
{
echo "record not exist." . $date_comingfrom_database . " ".$databaseemail. " ".$visitormail    ; // it only writes record not exist. and $visitormail here
}

I'll be back in 25 minutes..
0
Comment
Question by:Braveheartli
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
Snarfles earned 2000 total points
ID: 33499099
change

$result = mysql_fetch_array($query); // I have error message Warning: mysql_fetch_array(): supplied argument

to

$result = mysql_fetch_array($sql); // I have error message Warning: mysql_fetch_array(): supplied argument
0
 
LVL 1

Author Closing Comment

by:Braveheartli
ID: 33499226
you are great,
thank you
0
 
LVL 9

Expert Comment

by:Snarfles
ID: 33499259
You're welcome :)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question