join tables
Hello,
I have a PHP page which combines two MySQL tables (PHP 5.4). This is the script:
<?php require_once('Connections/Dezulle.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_Dezulle, $Dezulle);
$query_Recordset2 = "SELECT * FROM maandselectie";
$Recordset2 = mysql_query($query_Recordset2, $Dezulle) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
$colname_Recordset1 = "-1";
mysql_select_db($database_Dezulle, $Dezulle);
$query_Recordset1 = sprintf("SELECT * FROM webmaandkalender WHERE maand = %s", GetSQLValueString($colname_Recordset1, "text"));
$Recordset1 = mysql_query($query_Recordset1, $Dezulle) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
Now I have to upgrade my page to ¨PHP 7.4.2 using Webassist. How do I proceed to combine these tables.
<?php require_once('Connections/Woma.php'); ?>
<?php require_once('webassist/mysqli/rsobj.php'); ?>
<?php
$Recordset1 = new WA_MySQLi_RS("Recordset1",$Woma,0);
$Recordset1->setQuery("SELECT sleutel FROM webmaanden ORDER BY jaar, maand ASC");
$Recordset1->execute();?>
<?php
$Recordset2 = new WA_MySQLi_RS("Recordset2",$WoMa,0);
$Recordset2->setQuery("SELECT webmaandkalender.* FROM webmaandkalender");
$Recordset2->execute();
?>
Recordset1 is used to feed a form select menu with different months of a certain period.
Recordset2 should give me all data where the month equals the selected month in the form select menu (feeded by recordset1).
Thank you in advance for your replies.