[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Dreamweaver PHP JavaScript error(s)

Posted on 2008-11-10
27
Medium Priority
?
503 Views
Last Modified: 2012-05-05
In Dreamweaver using php I have created a connection to a database and am trying to create a recordset.
I go through the process but get an error message
The following JavaScript error(s) occourred;
While executing findServerBehaviours in Recordset.htm, a javacsript error occourred.
The code I have is below
Can anyone advise what may be going wrong please?
Thanks
John
<?php require_once('Connections/connSmylee.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $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_connSmylee, $connSmylee);
$query_rsConn = "SELECT * FROM products";
$rsConn = mysql_query($query_rsConn, $connSmylee) or die(mysql_error());
$row_rsConn = mysql_fetch_assoc($rsConn);
$totalRows_rsConn = mysql_num_rows($rsConn);
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
</head>
 
<body>
 
</body>
</html>
<?php
mysql_free_result($rsConn);
?>

Open in new window

0
Comment
Question by:johnhardy
  • 13
  • 10
  • +2
26 Comments
 
LVL 15

Expert Comment

by:quincydude
ID: 22921509
Hi, you mentioned about Javascript Error but I cannot see any javascript in the code given. And can you also tell us what is the error shown?
0
 
LVL 6

Assisted Solution

by:cr4ck3rj4ck
cr4ck3rj4ck earned 200 total points
ID: 22921569
"While executing findServerBehaviours in Recordset.htm, a javacsript error occourred."

On a side note, it looks as if you've saved your php file as a htm file. You need to save it as Recordset.php
0
 

Author Comment

by:johnhardy
ID: 22921596
Thanks I will come back a bit later
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
LVL 15

Assisted Solution

by:MMDeveloper
MMDeveloper earned 200 total points
ID: 22922090
that's an issue with dreamweaver files and not yours. Try the solution(s) on this page



http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=12&catid=263&threadid=1386160
0
 

Author Comment

by:johnhardy
ID: 22929911
Thanks,
Sorry for the delay.
Re Recordset.htm I dont know what this is, I cannot see it anywhere.

I had a look through the above page recreated the cache and few othe items but no change.
The page where I try to create a recordset has the above code in it but the recordset is not visible.
If I run the page the error that shows is

Warning: require_once(Connections/connSmylee.php) [function.require-once]: failed to open stream: No such file or directory in D:\Inetpub\wwwroot\SmyleePHP\Test.php on line 1

Fatal error: require_once() [function.require]: Failed opening required 'Connections/connSmylee.php' (include_path='.;C:\php5\pear') in D:\Inetpub\wwwroot\SmyleePHP\Test.php on line 1

I suspect the configuartion files are OK. Usually I develop in .aspvbs and thats working fine.
0
 

Author Comment

by:johnhardy
ID: 22962525
Any ideas please?
Thank you
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 22990218
John,

>> Warning: require_once(Connections/connSmylee.php) [function.require-once]: failed to open stream: No such file
>> or directory in D:\Inetpub\wwwroot\SmyleePHP\Test.php on line 1

>> Fatal error: require_once() [function.require]: Failed opening required 'Connections/connSmylee.php'
>> (include_path='.;C:\php5\pear') in D:\Inetpub\wwwroot\SmyleePHP\Test.php on line 1

These errors indicate either a path problem in the inetpub folder (things are not where they are expected to be) or a configuration problem with your PHP installation.

Also, do you have a testing server defined for this site?
0
 

Author Comment

by:johnhardy
ID: 22992766
Thanks Jason
I am completely new to php and am a bit lost.
I have created a test site on my local PC.
I created the database in a GUI extension(?) called Navicat 8 for MySQL which seems excellent

When I open Navicat I can see LocalHost in the connection column and if I right click on Localhost and select connection properties, under setting save path
I have
D:\Program Files\PremiumSoft\Navicat 8.0 MySQL\localhost
but if I look in D:\Program Files\PremiumSoft\Navicat 8.0 MySQL\ I cannot see any reference to Localhost

Previously in asp the database is always located in the Local files.
Perhaps this is where its going wrong?

The connections file shows:
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_ConTest = "localhost";
$database_ConTest = "lee2008php";
$username_ConTest = "root";
$password_ConTest = "";
$ConTest = mysql_pconnect($hostname_ConTest, $username_ConTest, $password_ConTest) or trigger_error(mysql_error(),E_USER_ERROR);
?>
Perhaps you may be able to see where I am going wrong from the above.
Regards
John
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 22997103
>> Perhaps you may be able to see where I am going wrong from the above.

If you read your error messages above, you will see that PHP is complaining that whatever is in test.php at line 1 cannot be found at the location defined.  That's problem #1.

Problem #2 (the fatal error in the connection file) may be related to problem #1 or not.  Fix the first problem and see what happens with the second.
0
 

Author Comment

by:johnhardy
ID: 22998234
Thanks Jason
Line 1, would you believe I didnt upload the connection!!!!
When I try to create a recordset in Dreamweaver I go through the process and if I use the Test button the records show OK
However when I click OK to save I get an error
While executing find server behaviours in recordset.htm, a javascript error occoured.
Click OK and code goes onto the page but the recordset does not appear.
The page runs now but without a recordset There can be no dynamic content.
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 22998282
Is your Testing Server defined correctly in the site definition?  While you can test the recordset without a testing server, you cannot implement the behaviors in DW unless that is set up and working.
0
 

Author Comment

by:johnhardy
ID: 22998419
Thanks
Yes I have rechecked (several times)  I am sure the site is defined correctly
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 22998812
The testing server, not just the local and remote...how do you have that set?
0
 

Author Comment

by:johnhardy
ID: 22999531
Yes thanks Jason it seems OK
Server Model: PHP MySQL
Access:         Local/Network
Testing server folder: D:\Inetpub\wwwroot\MySite
URL prefix:     http://Localhost/MySite
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 22999607
>> Testing server folder: D:\Inetpub\wwwroot\MySite

>> D:\Inetpub\wwwroot\SmyleePHP\Test.php

Those don't appear to be the same path to me....
0
 

Author Comment

by:johnhardy
ID: 22999676
Sorry I wrote MySite should be SmyleePHP
Corrected
Server Model: PHP MySQL
Access:         Local/Network
Testing server folder: D:\Inetpub\wwwroot\SmyleePHP
URL prefix:     http://Localhost/SmyleePHP

0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 22999824
Check to see if the _mmServerScripts folder is present on both the testing folder and the remote (if they are different).

If not, try running Site | Advanced | Remove Connection Scripts then Site | Advanced | Deploy Supporting Files.
0
 

Author Comment

by:johnhardy
ID: 23002245
Thanks Jason
I have copies _mmServerScripts with MMHTTPDB.php on my local PC in both localview and remoteview
I checked that they are exactly the same.
Both files have at line 1
<?php // <ERRORS><ERROR><DESCRIPTION>Your testing server do not has support for PHP pages</DESCRIPTION></ERROR>\n</ERRORS>
I also have same copies of mysql.php in localview and remoteview.
I completed Site | Advanced | Remove Connection Scripts
but
Site | Advanced | Deploy Supporting Files is greyed out
I tried creating a recordset again but received the same error
0
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 1600 total points
ID: 23006432
>> <?php // <ERRORS><ERROR><DESCRIPTION>Your testing server do not has support for PHP
>> pages</DESCRIPTION></ERROR>\n</ERRORS>

So there you go.  Something is wrong with the testing server's PHP config and DW cannot "see" what it needs to see in order to be used.  

Have you considered trying XAMPP to set up an Apache/PHP/MySQL environment?
0
 

Author Comment

by:johnhardy
ID: 23006519
Thanks Jason
Re Have you considered trying XAMPP to set up an Apache/PHP/MySQL environment?
I know nothing about Apache so not keen to go there, Perhaps I should have a clearout of php and MySQL and start again?
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 23006587
XAMPP is lightweight and fully configured.  Seriously, look into it.

>> Perhaps I should have a clearout of php and MySQL and start again?

Up to you.  I wouldn't recommend it unless you are having other issues.  
0
 

Author Comment

by:johnhardy
ID: 23007106
Thanks Jason
I will look into XAMPP before deciding whether to have another go after a clearout or not. Nothing much will be lost as this is an initial start to my PHP quest.
I thank everyone who has helped me and although I did not find my answer I had a lot of very welcomed help
Regards
John
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 23007134
>> although I did not find my answer

No, we did answer the question "what may be going wrong please?"

Your PHP is not configured correctly.
0
 

Author Comment

by:johnhardy
ID: 23007206
Sorry
in that case I did not understand or understand what to do about the PHP configuration
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 23007274
That wasn't the question.  This issue dealt with why you cannot make the connection.  It turned out to be a configuration issue on your end.  Your next logical question here should be what's wrong with the PHP config and you should post that to the PHP Zones...
0
 

Author Comment

by:johnhardy
ID: 23012202
Thanks Jason
I have now resubmitted a futher question
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month17 days, 14 hours left to enroll

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question