Dreamweaver cs4 MySQL code does not recognise db

webbtle

New Member
Messages
4
Reaction score
0
Points
0
Hi I am a newbe so please be kind and simple. I have used Dreamweaver cs4 to create a web site that displays feedback comments and allows comments to be added. Similar to Adobe's tutorial. I have got it to run on the pc using xmapp and its apache and mysql programs to test the site and it works yippee.

When I upload however it does not work. I have tried changing the database to the Mysql on the host but it still does not work.

I have created the same fields, created and linked a user put the db name, user and password into cs4 database wizard but still no joy.

Below is the code that works in the test server in xampp on local.

Grateful for any help.

Thnks
<?php do { ?>
<li class="style2"><strong><?php echo $row_Getfancyfeedback['title']; ?></strong><br />
<?php echo $row_Getfancyfeedback['contents']; ?><br />
By <?php echo $row_Getfancyfeedback['author_name']; ?> At <?php echo $row_Getfancyfeedback['created_at']; ?><br />
<br />
<?php } while ($row_Getfancyfeedback = mysql_fetch_assoc($Getfancyfeedback)); ?>
<a href="<?php printf("%s?pageNum_Getfancyfeedback=%d%s", $currentPage, max(0, $pageNum_Getfancyfeedback - 1), $queryString_Getfancyfeedback); ?>">Previous</a> Showing <?php echo ($startRow_Getfancyfeedback + 1) ?> to <?php echo min($startRow_Getfancyfeedback + $maxRows_Getfancyfeedback, $totalRows_Getfancyfeedback) ?> of<?php echo $totalRows_Getfancyfeedback ?><a href="<?php printf("%s?pageNum_Getfancyfeedback=%d%s", $currentPage, min($totalPages_Getfancyfeedback, $pageNum_Getfancyfeedback + 1), $queryString_Getfancyfeedback); ?>">Next</a>
</li>
</ol>
</div>
<div class="style21" id="create">
<h2 class="style2">Please send us your comments on the form below</h2>
<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">Your Name:</td>
<td><input type="text" name="author_name" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Your email:</td>
<td><input type="text" name="author_email" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Title:</td>
<td><input type="text" name="title" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Contents:</td>
<td><textarea name="contents" cols="32" rows="5"></textarea></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">&nbsp;</td>
<td><input type="submit" value="Add" /></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1" />
</form>
<p>&nbsp;</p>
<p></p>
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
  • If something isn't working the way you want it to, say what it's doing in addition to what you want it to do. If you're getting an error message, post the exact error message. If the error message indicates a line of code, indicate which line from your source code is that line. Saying "[it] does not work" provides next to no information.
  • put
    PHP:
    , [html] or [code] tags (whichever is most appropriate) around listings to improve readability. If you forget to put them in, edit the old post and add them.
    [*]Did you create a DB account and give it access to the database? There are numerous threads on this; search the forums for more info.
    [/list]
 

webbtle

New Member
Messages
4
Reaction score
0
Points
0
Thanks for the coments Mission,

I have tried reading tutorials tech notes forum pages to no avail.

The actual error message is "Parse error: syntax error, unexpected ';' in /home/webbt/public_html/contactdetails.php on line 77"

line 77 reads "$totalpages_getwebbtfancythat = ceil ($totalows_getwebbt_fancthatfeedback/$maxRows_getwebbt_fancythatfeedback = 10;" And is I believe in php.

This seams correct to me

I have another page called order that gives "No database selected"

The site is located at http:/collegetim.x10hosting.com Click on the link to take you it.

I think it is something simple that I am missing.

please help
 

garrettroyce

Community Support
Community Support
Messages
5,609
Reaction score
250
Points
63
You're missing a parenthesis before the semicolon:
Code:
$totalpages_getwebbtfancythat = ceil ($totalows_getwebbt_fancthatfeedback/$maxRows_getwebbt_fancythatfeedback = 10[b])[/b];

Are you using mysql_select_db() with your database name?
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
The actual error message is "Parse error: syntax error, unexpected ';' in /home/webbt/public_html/contactdetails.php on line 77"

line 77 reads
PHP:
$totalpages_getwebbtfancythat = ceil ($totalows_getwebbt_fancthatfeedback/$maxRows_getwebbt_fancythatfeedback = 10;
Take a closer look. The error message tells you PHP was processing a statement that ended early. If your editor supports paren balancing, you'll quickly see that the opening parenthesis for the "ceil" call is never closed. The "=10" also looks suspicious.

I have another page called order that gives "No database selected"
Every table is in a database. When you refer to a table, you must somehow say which database it is in. You can set a default database using the SQL statement "USE <dbname>" or (more appropriately) using the select database method of your database driver, such as mysqli::select_db. For other drivers, such as pgsql and PDO, you generally specify the database in the DSN when you open the connection (pg_connect() and PDO::__construct(), respectively). PDO still isn't enabled on the free hosts, so you'd better be using mysqli in this case.
 
Last edited:

webbtle

New Member
Messages
4
Reaction score
0
Points
0
Thanks both,

Your responses are very helpful. You were both right on the line code changed it to"...) -1;" at the end. This has sorted the error massage but now shows the same as the 'order page' ie no database.

I have found the line "mysql_select_db($database_fancyfeedback_db, $fancyfeedback_db);" This is from xmapp version that worked on the pc.

The database I have created on the remote, I have called 'webbt_fancythat' so I assume I need to change this to "mysql_select_db($database_webbt_fancythat,$webbt_fancythat);

I have defined 3 tables called administration, feedback and order. if I make the change above will these tables be selected. They are the same in both databases.

Again thanks for the help
Edit:
Hi

I have tried what I thought would fix no database selected and no go(see above)

I think the code problem now falls in the line 1 "<?php require_once('Connections/fancyfeedback_db.php'); ?>".

I believe this calls a subroutine that is coded as follows and basically sets up the database to access. As I am new to this (only been using dreamweaver 5 days and last programing I did was 28 years ago) I am not sure what "$..." is, I am assuming its a string variable.

Not sure what changes I need to make to this to solve the "no database selected"

<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_fancyfeedback_db = "localhost";
$database_fancyfeedback_db = "webbt_fancythat";
$username_fancyfeedback_db = "webbt_fancy";
$password_fancyfeedback_db = "password";
$fancyfeedback_db = mysql_pconnect($hostname_fancyfeedback_db, $username_fancyfeedback_db, $password_fancyfeedback_db) or trigger_error(mysql_error(),E_USER_ERROR);
?>
 
Last edited:

xav0989

Community Public Relation
Community Support
Messages
4,467
Reaction score
95
Points
0
I see that you are indeed pretty mixed up about $! "$" is an reserved keyword that tells php that what follows, until another reserved keyword or space, is a variable. To be usable, you need to give them a value. To directly use a string, as in your case, you need to use double or single quotes.
So basically, your code should read like that:
PHP:
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
// Set the hostname_fancyfeedback_db variable to the value : localhost
$hostname_fancyfeedback_db = "localhost";

// Set the database_fancyfeedback_db variable to the value : webbt_fancythat
$database_fancyfeedback_db = "webbt_fancythat";

// Set the username_fancyfeedback_db variable to the value : webbt_fancy
$username_fancyfeedback_db = "webbt_fancy";

// Set the password_fancyfeedback_db variable to the value : password
$password_fancyfeedback_db = "password";

// Connect to the database (mysql_pconnect) using the information stored 
// in the variables, and assign the connection to a variable, fancyfeedback_db
// The 'or trigger_error(...)' part is just to make sure that there is a database connection
$fancyfeedback_db = mysql_pconnect($hostname_fancyfeedback_db, $username_fancyfeedback_db, $password_fancyfeedback_db) or trigger_error(mysql_error(),E_USER_ERROR);

// Select the database where the tables reside, using the database name we stored 
// earlier, and the connection we stored earlier
mysql_select_db($database_fancyfeedback_db, $fancyfeedback_db);
?>

Don't forget to use [ PHP ] [ /PHP ] around php code, [ HTML ] [ /HTML ] around html code and [ CODE ] [ /CODE ] around any other code. (take the spaces out)

Here are some php-related tutorials:
http://www.php.net/manual/en/tutorial.php
http://w3schools.com/php/default.asp
 
Last edited:

webbtle

New Member
Messages
4
Reaction score
0
Points
0
Thankyou for all your help problem solved. I think using dreamweaver made it too easy to get into complex programming without knowing the basics. The final problem was down to me reading the name of the database I had constructed on the host server wrong repeatedly. Instead of the above it should have been "webbt_fancythatfeedback". Clearly a case of reading what you think it should be instead of what is actually there.

Reminds me of ny first forays into BBC Basic Ah!!
 
Top