Code: Select all
$rs = mysql_query("SELECT * FROM myTable");
if (NO_RECORDS)
{
echo("Nothing found");
}
else
{
echo("Stuff found");
}
Moderator: General Moderators
Code: Select all
$rs = mysql_query("SELECT * FROM myTable");
if (NO_RECORDS)
{
echo("Nothing found");
}
else
{
echo("Stuff found");
}
Code: Select all
$rs = mysql_query("SELECT * FROM myTable");
if (isset($rs[0]{0})){
echo("Stuff Found");
}
else {
echo("Nothing Found");
}Code: Select all
if (isset($rs[0]{0}) OR DIE("NO RESULTS")){
}Code: Select all
$rs = mysql_query("SELECT * FROM myTable");
if ($rs) { //if the query returned true then the query was OK
if (mysql_num_rows($rs) > 0) { //check how many results were returned
[your code]
} else {
echo "No results returned";
}
} else {
echo mysql_error();
}
Code: Select all
if (!isset($rs[0]{0}))
{
$counter = 1;
while ($row = mysql_fetch_array($rs))
{
mysql_query("UPDATE " . $System["tblPrefix"] . "_navigation SET navPosition=" . $counter . " WHERE navID=" . $row["navID"]);
$counter++;
}
}
}
Code: Select all
$first = "The first string in the array";
$second = "The second string in the array";
echo "This is $first, and this is $second";
Code: Select all
$arr["first"] = "The first string in the array"; //defining your arrays like this will parse
$arr["second"] = "The second string in the array"; //just fine using the double quotes
echo "This is $arr["first"], and this is $arr["second"]"; //This however will throw an error
Code: Select all
echo "This is $arr['first'], and this is $arr['second']"; //Here the associations are correctly parsed
Code: Select all
echo "This is " . $arr["first"] . ", and this is " . $arr["second"];
Code: Select all
$resource = mysql_query("select * from table_name");
if ($resource)
{
}
Code: Select all
$resource = mysql_query("select * from table_name");
if (mysql_num_rows($resource) > 0)
{
}
Code: Select all
$rs = mysql_query("SELECT * FROM myTable");
if ($rs) { //if the query returned true then the query was OK
if (mysql_num_rows($rs) > 0) { //check how many results were returned
Code: Select all
if ($rs) {
//results returned
}
Code: Select all
if (mysql_num_rows($rs) > 0) {
//results returned
}
Code: Select all
$rs = mysql_query("SELECT * FROM myTable") or die(mysql_error());