+ Reply to Thread
Results 1 to 8 of 8
Like Tree2Likes
  • 1 Post By garrettroyce
  • 1 Post By xav0989

Thread: Dreamweaver cs4 MySQL code does not recognise db

  1. #1
    webbtle is offline x10Hosting Member webbtle is an unknown quantity at this point
    Join Date
    Jun 2009
    Posts
    4

    Dreamweaver cs4 MySQL code does not recognise db

    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>

  2. #2
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: Dreamweaver cs4 MySQL code does not recognise db

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

  3. #3
    webbtle is offline x10Hosting Member webbtle is an unknown quantity at this point
    Join Date
    Jun 2009
    Posts
    4

    Re: Dreamweaver cs4 MySQL code does not recognise db

    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

  4. #4
    garrettroyce's Avatar
    garrettroyce is offline Generally Helpful Member garrettroyce is a glorious beacon of lightgarrettroyce is a glorious beacon of light
    Join Date
    Apr 2008
    Location
    IL, USA
    Posts
    3,746

    Re: Dreamweaver cs4 MySQL code does not recognise db

    You're missing a parenthesis before the semicolon:
    Code:
    $totalpages_getwebbtfancythat = ceil ($totalows_getwebbt_fancthatfeedback/$maxRows_getwebbt_fancythatfeedback = 10);
    Are you using mysql_select_db() with your database name?
    karimirt47 likes this.
    gjr.gr - coming soon: secrets of OCD coding from a self taught tinkerer

  5. #5
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: Dreamweaver cs4 MySQL code does not recognise db

    Quote Originally Posted by webbtle View Post
    The actual error message is "Parse error: syntax error, unexpected ';' in /home/webbt/public_html/contactdetails.php on line 77"

    line 77 reads
    PHP Code:
    $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.

    Quote Originally Posted by webbtle View Post
    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 by misson; 06-15-2009 at 06:31 AM.

  6. #6
    webbtle is offline x10Hosting Member webbtle is an unknown quantity at this point
    Join Date
    Jun 2009
    Posts
    4

    Re: Dreamweaver cs4 MySQL code does not recognise db

    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 by webbtle; 06-15-2009 at 11:08 AM. Reason: Automerged Doublepost

  7. #7
    xav0989's Avatar
    xav0989 is offline Community Public Relation xav0989 is just really nice
    Join Date
    Jul 2008
    Location
    ifk
    Posts
    4,438

    Re: Dreamweaver cs4 MySQL code does not recognise db

    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 Code:
    <?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 by xav0989; 06-15-2009 at 02:54 PM. Reason: Typos
    dinomirt96 likes this.
    Xavier L | Community Public Relations Manager (Free Hosting Support)
    █ Yes, my position is too cool to even exist!
    How am I helping? Rate this post by clicking the icon below! (this is even better than "liking" a post)
    Terms of Service | Acceptable Use Policy | x10Hosting Wiki

  8. #8
    webbtle is offline x10Hosting Member webbtle is an unknown quantity at this point
    Join Date
    Jun 2009
    Posts
    4

    Re: Dreamweaver cs4 MySQL code does not recognise db

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

+ Reply to Thread

Similar Threads

  1. Hybrid's HTML Lessons
    By Hybrid in forum Tutorials
    Replies: 18
    Last Post: 11-28-2009, 02:12 PM
  2. New Site-Suggestions?
    By mnoutside in forum Review My Site
    Replies: 9
    Last Post: 08-27-2008, 07:01 AM
  3. Connection to mysql database (adapt file dreamweaver)
    By jabahoeoe in forum Free Hosting
    Replies: 3
    Last Post: 05-19-2008, 09:15 AM
  4. Process PHP from a MySQL array
    By tnl2k7 in forum Programming Help
    Replies: 12
    Last Post: 05-05-2008, 10:02 AM
  5. How to get a MySQL database into CS3 Dreamweaver
    By Geography in forum Free Hosting
    Replies: 1
    Last Post: 03-15-2008, 03:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers