close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

join tables

Thread began 7/27/2020 8:11 am by Yves | Last modified 7/28/2020 9:46 am by Yves | 699 views | 3 replies

Yves

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.

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...