close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues


Template won't connect to MySQL

Thread began 2/03/2011 12:42 am by neo314 | Last modified 2/04/2011 1:10 pm by neo314 | 1097 views | 4 replies |


Template won't connect to MySQL

I am using UE 4 and I am trying to send an email as the final step in a transaction. I am using a session variable to pass the key to the template file.

What I am getting is:

Warning:  mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /var/www/html/ on line 44

I have checked the connection file path and it is correct. I even tried changing it to a static path:

<?php require_once($_SERVER["DOCUMENT_ROOT"].'/Connections/conn.php'); ?>
if (!isset($_SESSION)) {

Is there something about templates I am missing. If I try to just make a DW file, using the DW button in the GUI, I get too much of the page's template, so an external file would be desirable.

Sign in to reply to this post


I think I figured out the template issue, but I cannot edit the template except for the first time I use it. I tried a default template followed up with using framework to include the file (static), but I get the same results.

"mysql_select_db(): supplied argument is not a valid MySQL-Link resource..."

Sign in to reply to this post


Well I hope to get a reply to resolve the issue. Creating the email on the page from which it is to be sent includes way too much junk from the page's template and invariably breaks. I have not been able to get a database connection or a framework include with a database connection from either sending the email through a clean file (no page template), or an email template.

I resolved the problem through straight PHP getting the contents of the file and pulling out just the BODY content out of it. I put this code in an email template and it works.

$file = file_get_contents("http://".$_SERVER['SERVER_NAME']."/path/to/file/invoice.php?key=".$_SESSION['key']);
$body = preg_replace("/.*<body[^>]*>|<\/body>.*/si", "", $file);
echo $body;
Sign in to reply to this post

Jason ByrnesWebAssist

the connection and recordset should be created on the main page that you apply universal email to, not in the template file.

In the email template file, you can use the recordset data, but the code to create the actual connection and the recordset itself should be on the main page.

Sign in to reply to this post


Ok, I see that from the response I get from the server, but that seems to be a problem on two fronts.

1. If I use the framework module in other pages, it has to have the db connection in the file, so I cannot use that module in an email. It would be beneficial to use a framework module in an email or on a web page. My invoice is a module on the page. Other dynamic modules include event ended and soldout for example. The invoice module has a db connection and is also what I want to email.

2. Is there any way to bind the data source from the main page to the template file much the way WA provides the ability to bind form data from another page. That would be helpful.

Sign in to reply to this post

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





Ease of use


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...