Jump to content

Simple MySQL w/PHP IF Statement


Kaitosoto

Recommended Posts

This should be simple. After using PHP to connect to a MySQL database, how do I make an IF statement with a query?

 

like, I know that when you do something like

$sql = "UPDATE fdatabase SET blah blah blah";

$query = mysql_query($sql,$connect);

 

It connects to the thing. How do I make it so that it is conditional like this:

 

if(-MYSQL QUERY THAT SELECTS A VALUE FROM one of THE fdatabase tables- = 0) {

$sql = "UPDATE fdatabase SET blah blah blah";

$query = mysql_query($sql,$connect);

}

else

{

-do nothing

}

 

Link to comment
https://forums.phpfreaks.com/topic/38984-simple-mysql-wphp-if-statement/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.