Mysql_fetch_assoc()

I created a db and added content to it. Now I want to get it
out. I created a recordset for a simple search for houses buy
state.
It works fine in the test, but when I add the dynamic table I
get this on the page
Warning: mysql_fetch_assoc(): supplied argument is not a
valid MySQL result resource in C:\wamp\www\offers4house\results.php
on line 12
I have followed every help page and still cant figure it out.
Line 12 is the next to last line of this code for the dynamic table
<table border="1" cellpadding="1" cellspacing="1">
<tr>
<td>state</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_Recordset1['state'];
?></td>
</tr>
<?php } while ($row_Recordset1 =
mysql_fetch_assoc($Recordset1)); ?>
</table>
I can include the rest of the dreamweaver php for the
recordset and query if needed.
Please Please Please! Help
Michael

Hey,
1. What version of PHP are you using to test your pages?
2. How are you defining your recordsets? Are you using the
simple or advanced mode of the recordset dialog box?
If you are manually specifying the runtime value of the
search filter/s that you are using, make sure that they are
correct.

Similar Messages

  • Warning: mysql_fetch_assoc(): showing in PHP 5.2 but not 4

    I am building a site that was on 1&1 and it was set on PHP4 but now i have moved the cart integration and needed to move it up aand am now running php 5.2 but an error has now come up within the content of and image that is has a Tom Muck repeat region in it
    Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in/homepages/6/d132436789/htdocs/beta/product-list.php on line 169
            <?php
    $None_endRow = 0;
    } while ($row_None = mysql_fetch_assoc($None));
    if($None_endRow != 0) {
    while ($None_endRow < $None_columns) {
        echo("<td> </td>");
        $None_endRow++;
    echo("</tr>");
    }?>
    the error line being
    if($None_endRow != 0) {
    the page still functions but how do i clear this error?
    thanks in advance

    The problem lies here:
    mysql_free_result($storeresults);
    ?>
    <table border="0">
      <tr>
        <td>str_id</td>
        <td>str_name</td>
        <td>sale_begin</td>
        <td>sale_end</td>
      </tr>
      <?php do { ?>
        <tr>
          <td><?php echo $row_storeresults['str_id']; ?></td>
          <td><?php echo $row_storeresults['str_name']; ?></td>
          <td><?php echo $row_storeresults['sale_begin']; ?></td>
          <td><?php echo $row_storeresults['sale_end']; ?></td>
        </tr>
        <?php } while ($row_storeresults = mysql_fetch_assoc($storeresults)); ?>
    </table>
    mysql_free_result() is destroying the recordset resource before the repeat region.
    If you delete mysql_free_result($storeresults); it should work.
    Dreamweaver always puts mysql_free_result() below the closing </html> tag, so it looks as though you have accidentally moved it. When working with server behaviors, it's important to remove them cleanly by clicking the minus button in the Server Behaviors panel. Otherwise, you can be left with stray bits of code that cause problems like this.

  • Warning: mysql_fetch_assoc()

    Hi,
    I have been trying to create a forum using the online Adobe
    Tutorial . Following is the link :
    http://www.adobe.com/devnet/dreamweaver/articles/forum_pt3_03.html"
    My Specifications are:
    Windows Xp
    Apache
    MySql
    Php
    I have followed every set of instructions specified by the
    developers who have posted the tutorial, but still posting a
    message in the forum does not work. I have used the wizard as per
    specified by them and its after that i get 2 warning messages :
    Warning: mysql_fetch_assoc(): supplied argument is not a
    valid MySQL result resource in H:\Program
    Files\xampp\htdocs\M3forum\post_message.php on line 48
    Warning: mysql_num_rows(): supplied argument is not a valid
    MySQL result resource in H:\Program
    Files\xampp\htdocs\M3forum\post_message.php on line 49
    Im really confused, the above specified warnings are
    displayed on the form called postmessages.php page.
    After i post data on the form just to try out if it works, i
    get another Fatal error:
    Fatal error: Call to a member function Execute() on a
    non-object in H:\Program
    Files\xampp\htdocs\M3forum\includes\tng\tNG.class.php on line 396
    Do help me regarding this as quick as possible.
    Thanks

    On Sun, 26 Nov 2006 17:23:25 +0000 (UTC), "Flashvivek"
    <[email protected]> wrote:
    > $rsmessage_msg = $tNGs->getRecordset("message_msg");
    Is this tutorial by Interakt?
    What include or require files are in the code at the top of
    the page?
    Steve
    steve at flyingtigerwebdesign dot com

  • IF statement in Query

    Hi
    I have a query / recordset that  would be looking at 12000 rows in a database and 10 different variables and potential filters chosen by end users.
    Should I put 10 wild card / url Where statements in my recordset query or should I put IF statements in my query.
    ie.
    If URL colname then ",and BetType= "xzz"" .
    Is that the most efficient way to run my queries.
    I will be running about 10 recordsets on my page all looking at these url variables so it will be a busy page.
    If that is the answer can someone please tell me how to insert the if statement - i've tried allsorts but it wont work.
    $colname_Recordset4 = "%";
    if (isset($_GET['colname'])) {
      $colname_Recordset4 = $_GET['colname'];
    mysql_select_db($database_racing_analysis, $racing_analysis);
    $query_Recordset4 = sprintf("SELECT BetType, sum(if(season='2006-2007', Bet, 0)) AS '2006-2007',  sum(if(season='2007-2008', Bet, 0)) AS '2007-2008',  sum(if(season='2008-2009', Bet, 0)) AS '2008-2009' FROM dataextract WHERE BetType Like %s and TrackID = 1 and Distance = 1000 and Class = 1 GROUP BY BetType", GetSQLValueString($colname_Recordset4, "text"));
    $Recordset4 = mysql_query($query_Recordset4, $racing_analysis) or die(mysql_error());
    $row_Recordset4 = mysql_fetch_assoc($Recordset4);
    $totalRows_Recordset4 = mysql_num_rows($Recordset4);
    hope someone can help.
    Simon

    That part of the query cross tabs my data into three columns - not intended to confuse the issue. I'd have the same problem with a basic query.
    So Here is a very basic version:
    I want an IF statement to go around: "WHERE Distance = 1000" and "AND Class = 1"
    That I believe will reduce the effort on the MYSQL Server as it wouldn't be running a bunch of wild card queries and would only run if there is a URL paramter delivered.??
    I just don't get how to put the IF statements in PHP.
    thanks
    $maxRows_Recordset3 = 5;
    $pageNum_Recordset3 = 0;
    if (isset($_GET['pageNum_Recordset3'])) {
      $pageNum_Recordset3 = $_GET['pageNum_Recordset3'];
    $startRow_Recordset3 = $pageNum_Recordset3 * $maxRows_Recordset3;
    mysql_select_db($database_racing_analysis, $racing_analysis);
    $query_Recordset3 = "SELECT * FROM dataextract WHERE Distance = 1000 AND Class = 1";
    $query_limit_Recordset3 = sprintf("%s LIMIT %d, %d", $query_Recordset3, $startRow_Recordset3, $maxRows_Recordset3);
    $Recordset3 = mysql_query($query_limit_Recordset3, $racing_analysis) or die(mysql_error());
    $row_Recordset3 = mysql_fetch_assoc($Recordset3);
    if (isset($_GET['totalRows_Recordset3'])) {
      $totalRows_Recordset3 = $_GET['totalRows_Recordset3'];
    } else {
      $all_Recordset3 = mysql_query($query_Recordset3);
      $totalRows_Recordset3 = mysql_num_rows($all_Recordset3);
    $totalPages_Recordset3 = ceil($totalRows_Recordset3/$maxRows_Recordset3)-1;

  • Image path not storing in sql database

    Hello,
    I have read here on the forum how to upload an image to server and store path in  your database, the image uploads correctly to the correct folder on my server but the image path does not get stored on my sql database (not local hosting). I receive the error: The file has been uploaded, and your information has been added to the directory. Column 'image' cannot be null.
    My database has the following columns:
    id
    datum
    image
    sectie
    My code is as follows:
    <?php require_once('Connections/dbTroch.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_dbTroch, $dbTroch);
    $query_rs_aanbod = "SELECT * FROM tblSlideshow ORDER BY id ASC";
    $rs_aanbod = mysql_query($query_rs_aanbod, $dbTroch) or die(mysql_error());
    $row_rs_aanbod = mysql_fetch_assoc($rs_aanbod);
    $totalRows_rs_aanbod = mysql_num_rows($rs_aanbod);
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    $target = "images/slides/";  //This is the directory where images will be saved// 
    $target = $target . basename( $_FILES['image']['name']); //change the image and name to whatever your database fields are called//
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "add-photos-aanbod")) {
      $insertSQL = sprintf("INSERT INTO tblSlideshow (image, sectie) VALUES (%s, %s)",
                           GetSQLValueString($_POST['file'], "text"),
                           GetSQLValueString($_FILES['image']['name'], "text"));
    //This code writes the photo to the server//
    if(move_uploaded_file($_FILES['image']['tmp_name'], $target))
    //And confirms it has worked//
    echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";
    else {
    //Gives error if not correct//
    echo "Sorry, there was a problem uploading your file.";
      mysql_select_db($database_dbTroch, $dbTroch);
      $Result1 = mysql_query($insertSQL, $dbTroch) or die(mysql_error());
    ?>
    <!doctype html>
    <html>
    <meta charset="utf-8" />
      <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Troch Project Solutions - Admin - Toevoegen</title>
      <link rel="stylesheet" href="css/foundation.css" />
      <link rel="stylesheet" href="css/layout.css" />
      <!-- Fonts
      ================================================== -->
      <script type="text/javascript" src="//use.typekit.net/vob8gxg.js"></script>
      <script type="text/javascript">try{Typekit.load();}catch(e){}</script>
      <!-- jQuery
      ================================================== -->
      <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
      <script src="js/vendor/modernizr.js"></script>
    </head>
    <body>
        <div class="row">
          <div class="large-8 medium-8 small-8 large-centered medium-centered small-centered columns intro">
              <h2 class="subheader text-center">Admin</h2>
              <p><a>Log uit</a></p>
              <p><a href="admin.php">Terug naar Admin menu</a>
              <h4>image toevoegen naar aanbod slideshows:</h4>
              <form action="<?php echo $row_rs_aanbod['']; ?>" method="POST" name="add-photos-aanbod" id="add-photos-aanbod" enctype="multipart/form-data">
              <table>
                    <tbody>
                         <tr>
                              <td><label for="image">Kies foto:</label></td>
                              <td><input name="image" type="file" id="image" value="<?php echo $row_rs_aanbod['image']; ?>" /></td>
                        <tr>
                              <td>Sectie:</td>
                              <td><select name="sectie" id="sectie" option value="sectie">
                                <?php
    do { 
    ?>
                                <option value="<?php echo $row_rs_aanbod['sectie']?>"><?php echo $row_rs_aanbod['sectie']?></option>
                                <?php
    } while ($row_rs_aanbod = mysql_fetch_assoc($rs_aanbod));
      $rows = mysql_num_rows($rs_aanbod);
      if($rows > 0) {
          mysql_data_seek($rs_aanbod, 0);
          $row_rs_aanbod = mysql_fetch_assoc($rs_aanbod);
    ?>
                              </select></td> 
                        </tr>
                        <tr>
                            <td><input type="Submit" name="Add" id="add" value="Toevoegen" /></td>
                        </tr>
                </tbody>
            </table>
            <input type="hidden" name="MM_insert" value="add-photos-aanbod" />
        </form>
          </div><!-- end large-8 -->
        </div><!-- end row -->
    <script src="js/vendor/jquery.js"></script>
    <script src="/js/vendor/fastclick.js"></script>
    <script src="js/foundation.min.js"></script>
    <script>
                $(document).foundation();
            </script>
    </body>
    </html>
    <?php
    mysql_free_result($rs_aanbod);
    ?>
    I cannot work out what is wrong and I would appreciate any help on this. Thanks

    Your form field and array variable names do not match
    <td><input name="image" type="file" id="image" value="<?php echo $row_rs_aanbod['image']; ?>" /></td>
    GetSQLValueString($_POST['file'], "text"),

  • What is happening in safari/firefox?

    the problem is, whenever i successfully login in to my site
    in safari or firefox, the sites display completely cocks up.
    the link is
    http://www.bwise-webdevelopment.co.uk/index2.php
    i have set up a domain password for you to test, domain is
    adobetest.co.uk, the password is adobe
    the php code is :
    <?php
    if(isset($_POST['Submit'])) //if submit button is pressed for
    a new login
    unset($_SESSION['sesdomain']);
    unset($_SESSION['sescompany']);
    unset($_SESSION['sessite']);
    unset($_SESSION['sesemail']);
    unset($_SESSION['sescmspassword']);
    $server = "localhost";
    $user = "xxxx";
    $password = "xxxx";
    $database = "xxxx";
    $gotdomain = $_POST['Domain'];
    $gotpass = $_POST['Password'];
    $db_handle = mysql_connect($server, $user, $password);
    $db_found = mysql_select_db($database, $db_handle);
    $sql = "select * from clients WHERE domain = '$gotdomain' AND
    password = '$gotpass'"; //match up data to login/password
    $result = mysql_query($sql);
    while ($db_field = mysql_fetch_assoc($result))
    $_SESSION['sescompany'] = $db_field['company'];
    $_SESSION['sessite'] = $db_field['website'];
    $_SESSION['sesemail'] = $db_field['email'];
    $_SESSION['sescmspass'] = $db_field['CMSPassword'];
    $count=mysql_num_rows($result); //find if row is returned
    unset($_POST['Domain']);
    if($count==1) //if a record of username/password is found
    $_SESSION['sesdomain'] = $gotdomain;
    $strwelcolm = "welcolm ".$_SESSION['sesdomain'];
    echo "<div id = 'logintext'>" .$strwelcolm.
    "</div>";
    else
    $strwelcolm = "invalid username/password"; //if
    username/password is not found
    echo "<div id = 'logintext'>" .$strwelcolm.
    "</div>";
    if($_SESSION['sesdomain']) //if submit button is not pressed,
    check if a valid username/password has been entered
    $strwelcolm = "welcolm ".$_SESSION['sesdomain'];
    echo "<div id = 'logintext'>" .$strwelcolm.
    "</div>";
    ?>
    the site, php etc works fine in explorer. if i login
    successfully, it cocks up. if i go to another page, everything
    looks fine in all browsers.
    hope you can help

    Hi there,
    I'm having output issues also. I created a site with CSS and
    Dreamweaver. I added a contact us button on the pages, but somehow
    it is shifting off the page in IE. It works fine on my Mac, but
    content is shifted in IE and Firefox on a PC.
    Please could you take a look at my code and steer me in the
    right direction. I'm not the greatest with CSS and am learning
    there are probably comments that need to added to my HTML to combat
    browser issues.
    Here are the links to look at the site and CSS code:
    http://tallowahmedia.com/dissertationgenius/aboutus.html
    http://tallowahmedia.com/dissertationgenius/aboutus_css.html
    Cheers!!

  • How to use the nl2br() function - or addressing textarea formatting issues

    the textarea does not pass line breaks to mysql - the result in the html output is one long string of text. I would like the user to input into the textarea using the enter key to create new paragraphs.
    I am not a php programmer and rely on the dreamweaver data tools and developer tool kit to create my dynamic content.
    Please send sample code for a form that addresses and corrects this issue. I do not know how/where to modify the code to correct this issue.
    I have searched online but nowhere have I found an example of how to actually write the code. I can do a great deal of manual modification of php code but this one has me stumped for some reason..
    thanks in advance !!!!
    here is the index.php code which contains the form:
    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;
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
      $insertSQL = sprintf("INSERT INTO tw_responses (id, tweet, response, permalink) VALUES (%s, %s, %s, %s)",
                           GetSQLValueString($_POST['id'], "int"),
                           GetSQLValueString($_POST['tweet'], "text"),
                           GetSQLValueString($_POST['response'], "text"),
                           GetSQLValueString($_POST['permalink'], "text"));
      mysql_select_db($database_twitter, $twitter);
      $Result1 = mysql_query($insertSQL, $twitter) or die(mysql_error());
      $insertGoTo = "QA.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $insertGoTo));
    mysql_select_db($database_twitter, $twitter);
    $query_Recordset1 = "SELECT * FROM tw_responses";
    $Recordset1 = mysql_query($query_Recordset1, $twitter) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    $totalRows_Recordset1 = mysql_num_rows($Recordset1);
    ?>
    <?php $rs = mysql_fetch_array($resultsetquery);
    $string = nl2br($rs['response']);
    echo($string); ?>
    FORM:
    <form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
                    <table width="461" align="center" cellpadding="4" cellspacing="4">
                      <tr valign="baseline">
                        <td width="71" align="right" nowrap="nowrap">Question:</td>
                        <td width="360"><input type="text" name="tweet" value="" size="50" /></td>
                      </tr>
                      <tr valign="baseline">
                        <td nowrap="nowrap" align="right" valign="top">Answer:</td>
                        <td><textarea name="response" cols="50" rows="15"></textarea></td>
                      </tr>
                      <tr valign="baseline">
                        <td nowrap="nowrap" align="right"> </td>
                        <td><input type="submit" value="Insert record" />
                        <input type="reset" name="Reset" id="button" value="Reset" /></td>
                      </tr>
                    </table>
                    <input type="hidden" name="id" value="" />
                    <input type="hidden" name="MM_insert" value="form1" />
                  </form>
    Here is QA.php code which contains the output:
    PHP
    <?php require_once('../Connections/twitter.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;
    $maxRows_Recordset1 = 10;
    $pageNum_Recordset1 = 0;
    if (isset($_GET['pageNum_Recordset1'])) {
      $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
    $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
    mysql_select_db($database_twitter, $twitter);
    $query_Recordset1 = "SELECT * FROM tw_responses ORDER BY id ASC";
    $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
    $Recordset1 = mysql_query($query_limit_Recordset1, $twitter) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    if (isset($_GET['totalRows_Recordset1'])) {
      $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
    } else {
      $all_Recordset1 = mysql_query($query_Recordset1);
      $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
    $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;$maxRows_Recordset1 = 10;
    $pageNum_Recordset1 = 0;
    if (isset($_GET['pageNum_Recordset1'])) {
      $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
    $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
    mysql_select_db($database_twitter, $twitter);
    $query_Recordset1 = "SELECT * FROM tw_responses ORDER BY id DESC";
    $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
    $Recordset1 = mysql_query($query_limit_Recordset1, $twitter) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    if (isset($_GET['totalRows_Recordset1'])) {
      $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
    } else {
      $all_Recordset1 = mysql_query($query_Recordset1);
      $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
    $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
    ?>
    OUTPUT:
    <?php do { ?>
      <table width="95%" border="0" cellpadding="4" cellspacing="2">
        <tr>
          <td><a name="<?php echo $row_Recordset1['id']; ?>"></a></td>
        </tr>
        <tr>
          <td><p><strong><em>Question: </em></strong><a href="http://www.halopets.com/test/admin/QA.php#<?php echo $row_Recordset1['id']; ?>"><?php echo $row_Recordset1['tweet']; ?></a></p></td>
        </tr>
        <tr>
          <td><p><strong><em>Answer: </em></strong><?php echo $row_Recordset1['response']; ?></p></td>
        </tr>
        <tr>
          <td><hr width="95%" size="1" noshade="noshade" /><br /></td>
        </tr>
      </table>
      <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>

    twinflame wrote:
    the textarea does not pass line breaks to mysql - the result in the html output is one long string of text. I would like the user to input into the textarea using the enter key to create new paragraphs.
    I am not a php programmer and rely on the dreamweaver data tools and developer tool kit to create my dynamic content.
    Please send sample code for a form that addresses and corrects this issue. I do not know how/where to modify the code to correct this issue.
    http://tinymce.moxiecode.com/

  • Is there any way to add dynamic parameter in sql without breaking Server Behavior

    Hello, i'm building multiple language site.. i would like to know if there is possible way to add dynamic parameter in my query, without break the server behavior.
    For example:
    mysql_select_db($database_dxc_conn, $dxc_conn);
    $query_Recordset1 = "SELECT article.articleName, article.articleDesc FROM article";
    $Recordset1 = mysql_query($query_Recordset1, $dxc_conn) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    $totalRows_Recordset1 = mysql_num_rows($Recordset1);
    will become something like this:
    $additionalSQL=", article.articleName_en";
    mysql_select_db($database_dxc_conn, $dxc_conn);
    $query_Recordset1 = "SELECT article.articleName, article.articleDesc $additionalSQL FROM article";
    $Recordset1 = mysql_query($query_Recordset1, $dxc_conn) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    $totalRows_Recordset1 = mysql_num_rows($Recordset1);
    this is just an example, my real scenarion is far more complicated than this... however this kind of approach break the server behavior and force to do hand-coding...
    i would like to know if there's better way to do such thing like this...

    viktor.iwan wrote:
    Hello, i'm building multiple language site.. i would like to know if there is possible way to add dynamic parameter in my query, without break the server behavior.
    Server behaviors are simply bits of boilerplate code automatically generated by Dreamweaver. Editing the code doesn't "break" it (unless your edits are badly written). However, once you edit the code, Dreamweaver no longer recognizes it, so you lose the ability to drag recordset results from the Bindings panel.
    If you want to edit server behavior code, the best way to handle it is to lay out your page as you want, using the Bindings panel. Once everything has been done, only then edit the server behavior code.

  • Recordsets with multiple options - AND, OR If Else and the "Any" Rule

    Hi,
    Been trying to get this to work for days now... I have a form with drop down lists that feeds through variables to a search page... The Recordset Jobsearch2 shown below works great so long as a user chooses and option that has info in the DB.... ie all fields must be present. I cannot seem to work out how to achieve and Any rule?...
    I have had 2 options suggested to me...
    a) the code below...
    if(isset($searchsector) && $searchsector !== "") {
    $query_jobsearch2 .= ' AND Sector LIKE "%' . mysql_real_escape_string($searchsector) . '%"';
    putting this in for each option..... but If Im told I have to add this in before the "$jobsearch2 = mysql_query" line... but when I do this the recordset disappears\is deleted...
    b) Using an Array and "Implode" -  this wouldbe great I'm sure if I had any clue how to do this and what it meant.
    MY CURRENT CODE
    <?php require_once('Connections/steelbakercouk_473245_db1.php'); ?>
    <?php
    $searchsector = $_POST['Sector'];
    $searchlocation = $_POST['clocation'];
    $searchmin = $_POST['minsalary'];
    $searchmax = $_POST['maxsalary'];
    $searchtype = $_POST['Type'];
    ?>
    <?php
    mysql_select_db($database_steelbakercouk_473245_db1, $steelbakercouk_473245_db1);
    $query_jobsearch2 = "SELECT jobs.clocation, jobs.Ref_id, jobs.RefCode, jobs.jobtitle, jobs.blurb, jobs.Consultant, jobs.Salary, jobs.tlocation, jobs.Sector, jobs.Type FROM jobs WHERE jobs.Salary BETWEEN '$searchmin' AND '$searchmax' AND clocation = '$searchlocation' AND jobs.Sector  = '$searchsector' AND jobs.Type = '$searchtype'";
    $jobsearch2 = mysql_query($query_jobsearch2, $steelbakercouk_473245_db1) or die(mysql_error());
    $row_jobsearch2 = mysql_fetch_assoc($jobsearch2);
    $totalRows_jobsearch2 = mysql_num_rows($jobsearch2);
    ?>
    Please help... ... pulling my hair out!
    Thanks

    Ok.. I've tried all methods and still not getting anywhere..
    David... following the link you gave me... and to the letter.. apart from GetSQLValueString()which does not seem to exist.
    All it does is return all the records (as per the basic recordset)
    Heres the code.... please please tell me where I am going wrong.... downloaded your book Foundation PHP but struggaling.,
    <?php require_once('Connections/steelbakercouk_473245_db1.php'); ?>
    <?php
    $searchsector = $_POST['Sector'];
    $searchlocation = $_POST['clocation'];
    $searchmin = $_POST['minsalary'];
    $searchmax = $_POST['maxsalary'];
    $searchtype = $_POST['Type'];
    $any = $_POST['any'];
    ?>
    <?php
    $currentPage = $_SERVER["PHP_SELF"];
    mysql_select_db($database_steelbakercouk_473245_db1, $steelbakercouk_473245_db1);
    $expected = array('Sector' => 'text',
                      'clocation'         => 'text',
                      'minsalary'          => 'int',
                      'maxsalary'      => 'int');
    $query_jobsearch2 = "SELECT jobs.clocation, jobs.Ref_id, jobs.RefCode, jobs.jobtitle, jobs.blurb, jobs.Consultant, jobs.Salary, jobs.tlocation, jobs.Sector, jobs.Type FROM jobs";
    $where = false;
    // Loop through the associatiave array of expected search values
    foreach ($expected as $var => $type) {
      if (isset($_GET[$var])) {
        $value = trim(urldecode($_GET[$var]));
        if (!empty($value)) {
          // Check if the value begins with > or <
          // If so, use it as the operator, and extract the value
          if ($value[0] == '>' || $value[0] == '<') {
            $operator = $value[0];
            $value = ltrim(substr($value, 1));
          } elseif (strtolower($type) != 'like') {
            $operator = '=';
          // Check if the WHERE clause has been added yet
          if ($where) {
            $query_search .= ' AND ';
          } else {
            $query_search .= ' WHERE ';
            $where = true;
          // Build the SQL query using the right operator and data type
          $type = strtolower($type);
          switch($type) {
            case 'like':
              $query_search .= "`$var` LIKE " . GetSQLValueString('%' .
    $value . '%', "text");
              break;
            case 'int':
            case 'double':
            case 'date':
              $query_search .= "`$var` $operator " .
    GetSQLValueString($value, "$type");
              break;
            default:
            $query_search .= "`$var` = " . GetSQLValueString($value,
    "$type");
    $jobsearch2 = mysql_query($query_jobsearch2, $steelbakercouk_473245_db1) or die(mysql_error());
    $row_jobsearch2 = mysql_fetch_assoc($jobsearch2);
    $totalRows_jobsearch2 = mysql_num_rows($jobsearch2);
    $queryString_jobsearch2 = "";
    if (!empty($_SERVER['QUERY_STRING'])) {
      $params = explode("&", $_SERVER['QUERY_STRING']);
      $newParams = array();
      foreach ($params as $param) {
        if (stristr($param, "pageNum_jobsearch2") == false &&
            stristr($param, "totalRows_jobsearch2") == false) {
          array_push($newParams, $param);
      if (count($newParams) != 0) {
        $queryString_jobsearch2 = "&" . htmlentities(implode("&", $newParams));
    $queryString_jobsearch2 = sprintf("&totalRows_jobsearch2=%d%s", $totalRows_jobsearch2, $queryString_jobsearch2);
    ?>

  • Help with if/else in displaying data - (possibly foreach)

    Hello all,
    I've been trying to set something up, and I'm having difficulty getting it to work.
    Lines 84-111 have become my biggest difficulty.  I've got an if/else statement set up so that if one record has an image located on the localhost that image is pulled up.  The way I have it now, this works great.
    If I swap lines 93-96 with 102-105, and just tweek line 90, I can get it to work if the image is located on an alias and not the localhost.
    The problem is that if I have it like it is now, I can't get both to work at the same time.  So, I'm trying to get the if/else statement to apply to each record that is being pulled up.  It seems like what it is doing now is choosing which part of the if/else statement it needs to use for the first record, and then applies that for all records.
    Is there a way to have it coded like it is now for the if/else statement (because I want to be able to add multiple alias' and just check to see if the image is on the localhost or not); but have the image be displayed no matter if the image is located on the localhost or an alias?
    The following is what I've got so far:
    <?php
    $search = $_GET['series'];
    $query_begin=" SELECT * FROM movies WHERE movie_name_series = '$search' ";
    $search_begin = mysql_query($query_begin) or die(mysql_error());
    $row_begin = mysql_fetch_assoc($search_begin);
    if($row_begin == 0){
    ?>
    <script type="text/javascript"><!--
    setTimeout('Redirect()',0000);
    function Redirect()
      location.href = 'index.php?content=noresult';
    // --></script>
    <?php
    else
                    $query_display = "SELECT * from series WHERE series_id = '$search'";
           $result_display = mysql_query($query_display);
           $row_display = mysql_fetch_array($result_display, MYSQL_ASSOC);
              $series_id = $row_diaplay['series_id'];
              $series_name = $row_display['series_name'];
        ?>
    <h2>All Movies in our Library categorized in the series <?php echo $series_name ?></h2>
    <br />
    <div style="float: left; width: auto">
        Click on the name of the movie to edit the movie.
    </div>
         <br />
            <hr size="1" noshade="noshade" />
      <br />
    <?php
    $query="SELECT * FROM movies
      INNER JOIN family_rating ON movies.movie_star_rating=family_rating.star_id
      INNER JOIN alias ON movies.alias=alias.alias_id
      INNER JOIN parent_alert ON movies.parent_alert=parent_alert.alert_id
      INNER JOIN rating ON movies.movie_rating=rating.rating_id
      WHERE movies.movie_name_series='$search'
      ORDER BY movies.movie_name ASC";
    $result= mysql_query($query)or die (mysql_error());
    while($row=mysql_fetch_array($result)){
    // Display the data
    ?>
        <table width="200" style="margin: 20px">
        <tr align="center">
      <td valign="top">
       <h1 style="font-size: 12px"><?php echo $row['movie_name']; ?></h1>
            </td>
        </tr>
        <tr align="center">
      <td valign="top" style="width: 100%; border-bottom: ridge #FFF; border-left: ridge #FFF; background: url(assets/images/transback.png) repeat; padding: 10px">
       <a class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'">
       <style media="screen" type="text/css">
              #coverart {
                display: block;
                width: 110px;
                height: 150px;
              #coverart:hover {
                background: url("assets/icons/play_movie.png") no-repeat 0 0;
              background-size: 110px;
             </style>
            <p>
             <form action="index.php?content=play_movie" method="post">
                <input type="hidden" value="<?php echo $row['movie_id']; ?>" name="movie" />
             <input type="hidden" value="<?php echo $row['warning'] ?>" name="warning" />
                                        <?php
              if ($row['alias_name']='localhost') {
             ?>
                                        <input onmouseover='this.src="assets/icons/play_movie.png"'
                                         onmouseout='this.src="movies/coverart/<?php echo $row['art']; ?>"'
                                        type="image" src="movies/coverart/<?php echo $row['art']; ?>"
                                        style="border: none" height="150" width="110" />
                                        <?php
              }else{
               ?>
                                        <input onmouseover='this.src="assets/icons/play_movie.png"'
                                         onmouseout='this.src="http://<?php echo $row['ip_address']; ?>/<?php echo $row['alias_name']; ?>/coverart/<?php echo $row['art']; ?>"'
             type="image" src="http://<?php echo $row['ip_address']; ?>/<?php echo $row['alias_name']; ?>/coverart/<?php echo $row['art']; ?>"
                                        style="border: none" height="150" width="110" />
                                        <?php
              ?>
                </form>
                                        </p>
                                    <span><h2 align="center"><?php echo $row['movie_name']; ?></h2>
            <?php echo $row['rating_name']; ?>
                                    <h4><?php echo $row['description']; ?></h4>
            <?php
             if($row['parent_alert']='1') {
              ?>
            <p align"center"><img src="assets/icons/<?php echo $row['alert_file_name']; ?>"></p></span>
                                    <?php
             } else {
             ?>
                </a>
                <img src="assets/icons/s_<?php echo $row['star_file_name']; ?>" />
            </td>
    </tr>
        </table>
    <?
    ?>
    I've looked through a number of tutorials and it's been indicated to use a for each loop.  However, I can't seem to get this to work.  Is there anything I can do to get this to work the way I am trying to?  Is it a problem with my if/else or do I need a for each?  If I need a for each, how do I do that?
    Thanks.

    Thank you for your reply.  I apologize for not being as clear as I needed to be, so I'll try and explain better.
    I've got a page that pulls up some records from a database, where I've got an if / else statement as part of the section where it displays the data.
                                        <?php
              if ($row['alias_name']='localhost') {
             ?>
                                        <input onmouseover='this.src="assets/icons/play_movie.png"'
                                         onmouseout='this.src="movies/coverart/<?php echo $row['art']; ?>"'
                                        type="image" src="movies/coverart/<?php echo $row['art']; ?>"
                                        style="border: none" height="150" width="110" />
                                        <?php
              }else{
               ?>
                                        <input onmouseover='this.src="assets/icons/play_movie.png"'
                                         onmouseout='this.src="http://<?php echo $row['ip_address']; ?>/<?php echo $row['alias_name']; ?>/coverart/<?php echo $row['art']; ?>"'
             type="image" src="http://<?php echo $row['ip_address']; ?>/<?php echo $row['alias_name']; ?>/coverart/<?php echo $row['art']; ?>"
                                        style="border: none" height="150" width="110" />
                                        <?php
              ?>
    When the records are pulled, it seems like only the first part of the if / else statement is being applied to every record that is being pulled. The problem is if I've got records like the following:
    Record one - (file on the host computer)
    needs to be displayed from the condition
    src="movies/coverart/<?php echo $row['art']; ?>"
    Record two - (file on networked external hard drive)
    needs to be displayed from the condition
    src="http://<?php echo $row['ip_address']; ?>/<?php echo $row['alias_name']; ?>/coverart/<?php echo $row['art']; ?>
    The way it's coded now, only record one will display the image (record two will not display the image).  If I swap the order of the conditions, only record two will display the image (record one will not display the image).
    How do I get both record one and record two to display the image when both appear on the same page from a single search query?
    If I still did not explain it well enough, please let me know and I will try and do better.  Again, thank you for your help.

  • How to show all records by default on search result page?

    Hi
    I am trying to make a search page that would execute the search in the database based on one or more field constraints.
    (Using MySQL,PHP)
    I have  2 columns in the database "vm_ip" (primary key) <IP address>, "Operating_System" <Any, Windows, Solaris, AIX>
    need to search vm_ip based on other two fields.
    PROBLEM: Need to show all the record when I select "Any" in the Operating_System  drop down menu.
    <p>Operating System:
        <select name="os_select" id="os_select">
        <?php
    $os_count=1;
    foreach($os_type as $value) //(os_type is array with possible values of OS)
    echo "<option value=".$os_count.">".$value."</option>";
        $os_count++;
    ?>
          <option value=" " selected="selected">Any</option>
        </select>
      </p>
    this code POSts  NULL value to the search page.
    Below code is of recordset on  search page
    $varOS_virtual = "Operating_System"; // recordset variable set to same as column name (default value)
    if (isset($_POST['os_select'])) //this should not be true
      $varOS_virtual = $_POST['os_select'];
    mysql_select_db($database_xyz_db, $xyz_db);
    $query_virtual = sprintf("SELECT table.VM_IP FROM table
    WHERE table.Operating_System=%s", GetSQLValueString($varOS_virtual, "int"));
    $virtual = mysql_query($query_virtual, $xyz_db) or die(mysql_error());
    $row_virtual = mysql_fetch_assoc($virtual);
    $totalRows_virtual = mysql_num_rows($virtual);
    I expected the 'os_select' field to be null and default value of Operating_System to be "Operating_System" so that the Query shows all records.
    But instead the value being passed in the Query is "0". and no records are shown.
    What can I do to show all records?
    As probably obvious I am new to php/MySQL so all the help is most welcomed .
    Thanks

    Hi
    Thanks for the prompt reply but this does not solve my problem.
    First thing I appologise for giving you incorrect info. Actually I have many more constraints on the search apart from OS.
    Didn't think I would get single constraint specific ans.
    Here is what all i tried and problems I faced:
    1. I cannot use seperate queries cause I have around 7-8 other constraints on the search.
    2. I cannot play around with the Record set code. For some reason even if I mess with it a little bit Dreamweaver stops recognising the recordset. for eg i tried the below code:
    $query_virtual = sprintf("SELECT table.VM_IP FROM table WHERE
    table.Operating_System=%s ,($_POST['os_select']=="")? TRUE:GetSQLValueString($varOS_virtual, "int"));
    this ran well for the first time, and then the record set was screwed up. kept on asking me to "Discover" the links, which it couldn't do.
    3.  take a look at this code:
    $varOS_virtual = "Operating_System";
    if (isset($_POST['os_select'])) {
      $varOS_virtual = $_POST['os_select'];
    $varState_virtual = "State";               //second constraint
    if (isset($_POST['state_select'])) {
      $varState_virtual = $_POST['state_select'];
    mysql_select_db($database_xyz, $xyz);
    $query_virtual = sprintf("SELECT table.VM_IP FROM table AND table.Operating_System=%s AND State=%s",
    GetSQLValueString($varOS_virtual, "int"),GetSQLValueString($varState_virtual, "int"));
    $virtual = mysql_query($query_virtual, $xyz) or die(mysql_error());
    $row_virtual = mysql_fetch_assoc($virtual);
    $totalRows_virtual = mysql_num_rows($virtual);
    here on passing NULL value for "Any"  GetSQLValueString($varOS_virtual, "int") functions returns NULL and though the Default value of
    varOS is set to 'Operating_System" query takes NULL value only which when executed shows no records.
    My problem majorly revolves around how to put something like "WHERE Operating_System= Operating_System" OR  "WHERE Operating_System= TRUE" in the query, when passed through variable they are sent as Strings or NULL.
    Thats why WHERE 1=1 also doesnt work, because it has "WHERE Operating_System= NULL" in AND.
    Logically when NULL is passed default value of variable should comeinto picture, but tha isnt happening.
    Thanks again for answering. hope I was able to explain my problem.

  • Dependant Dropdown - Format string as date?? And hopefully two dates as a range?

    I'm stuck - been trying to figure this out all afternoon and with a launch in 2 days am probably missing something obvious....so please help me!! hehe<br />I have the a dependent drop down.  The first one is a list of Locations and the second one is then populated by a list of dates that events will be at those locations.<br /><br />1st problem:  when I've been hand coding this drop down I am able to show the start and end date with something like:<br />echo date( 'l, M j', $row_getalldates['date_start']).' - '.date( 'M j',$row_getalldates'date_end']);<br /><br />b How do I translate that into one string to display in wdg:displayfield=""<br /><br />2nd:  Right now since I can't get the two values in...I'm just going with one value so I can continue with development till I figure it out.  <br /><br />I cannot get the date formatted as I usually do with the date() function I usually use. See: http://camp.studentlife.com/housing2/index.php?op=addinfo<br /><br />b SQL STATEMENT:<br />$query_getalllocations = "SELECT distinct(b.title),locationid FROM calendar a LEFT JOIN sllocations b USING (locationid) WHERE b.title is NOT NULL and a.date_start>$mstart_date and a.date_start<$mend_date AND (a.calid='1' ) GROUP BY b.title ORDER BY b.title ";<br />$getalllocations = mysql_query($query_getalllocations);<br />$row_getalllocations = mysql_fetch_assoc($getalllocations);<br />$totalRows_getalllocations = mysql_num_rows($getalllocations);<br /><br />$colname_getalldates = "-1";<br />if (isset($_GET['locationid'])) {<br />  $colname_getalldates = $_GET['locationid'];<br />}else{<br />     $colname_getcalendar = "-1";<br />     if (isset($_GET['eventid'])) {<br />       $colname_getcalendar = $_GET['eventid'];<br />     }<br />     <br />     $query_getcalendar = sprintf("SELECT * FROM calendar WHERE eventid = %s", GetSQLValueString($colname_getcalendar, "int"));<br />     $getcalendar = mysql_query($query_getcalendar);<br />     $row_getcalendar = mysql_fetch_assoc($getcalendar);<br />     <br />     $colname_getalldates =$row_getcalendar['locationid'];<br />     mysql_free_result($getcalendar);<br />}<br /><br />$query_getalldates = sprintf("SELECT a.* FROM calendar a WHERE locationid = %s and a.date_start>$mstart_date and a.date_start<$mend_date ORDER BY a.date_start ASC", GetSQLValueString($colname_getalldates, "int"));<br />$getalldates = mysql_query($query_getalldates);<br />$row_getalldates = mysql_fetch_assoc($getalldates);<br />$totalRows_getalldates = mysql_num_rows($getalldates);<br /><br />b ABOVE MY HEAD TAG:<br />//begin JSRecordset<br />$jsObject_rs_alldates = new WDG_JsRecordset("rs_alldates");<br />echo $jsObject_rs_alldates->getOutput();<br />//end JSRecordset<br /><br />b AND INSIDE MY FORM:<br /><select name="location" class="required" id="location" tabindex="1"><br />   <option value="0" <?php if (!(strcmp(0, $row_rs_alllocations['locationid']))) {echo "selected=\"selected\"";} ?>>SELECT LOCATION</option><br />   <?php<br />do {  <br />?><br />   <option value="<?php echo $row_rs_alllocations['locationid']?>"<?php if (!(strcmp($row_rs_alllocations['locationid'], $row_rs_alllocations['locationid']))) {echo "selected=\"selected\"";} ?>><?php echo $row_rs_alllocations['title']?></option><br />   <?php<br />} while ($row_rs_alllocations = mysql_fetch_assoc($rs_alllocations));<br />  $rows = mysql_num_rows($rs_alllocations);<br />  if($rows > 0) {<br />      mysql_data_seek($rs_alllocations, 0);<br />       $row_rs_alllocations = mysql_fetch_assoc($rs_alllocations);<br />  }<br />?><br />    </select></span></label></p><br />  <p><label><span><br />    <select name="date" class="required" id="date" tabindex="2" wdg:subtype="DependentDropdown" wdg:type="widget" wdg:recordset="rs_alldates" wdg:displayfield="date_start" wdg:valuefield="eventid" wdg:fkey="locationid" wdg:triggerobject="location" wdg:selected="SELECT YOUR CAMP DATE" ><br />    </select></span></label></p><br />1st I though it was the wdg:selected parameter that I could just throw make echo date( instead of just echo.   But no...that would be too easy ;)<br /><br />I figure its either in the "echo $jsObject_rs_alldates->getOutput();" above the head or hard coded into the included ADDT javascript files. Don't mind if I have to hard code as the site's lifespan is short

    Hi Amanda,
    how about preparing that within your query by using a CONCAT function and by formatting the dates right in here, like:
    SELECT CONCAT(DATE_FORMAT(date_start, '%I, %M %j')," - ",DATE_FORMAT(date_end, '%M %j')) AS date_range ?
    The wdg:displayfield expects one table column, and in this case it would be the alias column "date_range".
    Works ?
    Cheers,
    Günter Schenk
    Adobe Community Expert, Dreamweaver

  • Text field not showing record set options

    I entered the following php code to a text field in a form:
    <p>
          <label for="date">Select Available Date</label>
          <select name="date" class="text" id="date">
            <option value="0" selected="selected">select your preferred travel date</option>
                <?php while ($row_rsDep = mysql_fetch_assoc($rsDep)) {
                      echo '<option>' . date('d.m.Y',strtotime($row_rsDep['Start_Date_Eur'])) . ' - ' . date('d.m.Y',strtotime($row_rsDep['End_Date_Del'])) . '-' . $row_rsDep['Itinerary_Code'] . '</option>';
              ?>       
          </select>
        </p>
    In the text field it shows only the option=0 "select your preferred travel date" and does not show the rest of the options as available from the database.
    Any idea what is wrong with my code?
    Thanks,
    zabberwan

    I do have it showing in the sidebar showing as a repeating region. I commented it out and entered your code, but this time it shows nothing at all, not even an error!
    The problem may have to do with "VIEWS" as I am working partly with Views on the external server. The server guys are having problems allowing Views. They did allow it for my account, but somehow this is not working. So I update my database leaving out the 3 tables created as views out of a total of 8. On the contrary on the local server the database is working fine, so that may not be the problem after all.
    I had got it work a fortnight back, but lost it as I had to redo a few things with the forms it is in. On the sidebar it is working fine otherwise as a repeating region and showing all the dates of all itineraries. Only it's not working in the form, where it shows the preselected string (select your preferred travel date), but not the rest of the options.
    About changing the email, one has to change the whole ID  and profile etc. and then you can't log into your own account with the same user name, you have to have a different one, so that your own thread is no longer your own. What a pile of goons at the wheels! And what a disappointment with otherwise such a great bunch of forums.. I'll now have to contact the staff and would like them wipe out all my ID's and Profiles at Adobe and make a new one. It's such a rotten mess. This thing even ruined my ID at Adobe Browser Lab.
    I suppose we'll leave it for Mr. Nobody to fix it, like so many other things especially around Christmas!
    zabberwan

  • How to upload an image in a directory using PHP code generated by Dreamweaver?

    I have created a dynamic website with Dreamweaver and PHP, i have also created a insertform page using dreamweaver's 'Record Insertion Form Wizard' i have a field named prod_img in my MySQL database and on my form but this is a text field and i have to enter the path of the image directory to display it but this needs to have the image in the directory, i want to add a browse file field so that the image uploads to the directory by PHP.
    My code is as follows:
    <?php require_once('../Connections/dwtltd.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;
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
      $insertSQL = sprintf("INSERT INTO special_offers (spec_img, spec_head, spec_desc, spec_call, spec_price, spec_rtn) VALUES (%s, %s, %s, %s, %s, %s)",
                           GetSQLValueString($_POST['spec_img'], "text"),
                           GetSQLValueString($_POST['spec_head'], "text"),
                           GetSQLValueString($_POST['spec_desc'], "text"),
                           GetSQLValueString($_POST['spec_call'], "text"),
                           GetSQLValueString($_POST['spec_price'], "text"),
                           GetSQLValueString($_POST['spec_rtn'], "text"));
      mysql_select_db($database_dwtltd, $dwtltd);
      $Result1 = mysql_query($insertSQL, $dwtltd) or die(mysql_error());
      $insertGoTo = "../specialoffers.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $insertGoTo));
    mysql_select_db($database_dwtltd, $dwtltd);
    $query_insertRS = "SELECT * FROM special_offers ORDER BY spec_id ASC";
    $insertRS = mysql_query($query_insertRS, $dwtltd) or die(mysql_error());
    $row_insertRS = mysql_fetch_assoc($insertRS);
    $totalRows_insertRS = mysql_num_rows($insertRS);
    ?>
    <form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
      <table align="center" cellpadding="5">
        <tr valign="baseline">
          <td align="right" nowrap="nowrap">Add Image:</td>
          <td><span id="sprytextfield1">
          <input type="text" name="spec_img" value="" size="32" />
          <span class="textfieldRequiredMsg">A value is required.</span></span></td>
        </tr>
        <tr valign="baseline">
          <td nowrap="nowrap" align="right">Offer Heading:</td>
          <td><input type="text" name="spec_head" value="" size="32" /></td>
        </tr>
        <tr valign="baseline">
          <td nowrap="nowrap" align="right">Offer Description:</td>
          <td><input type="text" name="spec_desc" value="" size="32" /></td>
        </tr>
        <tr valign="baseline">
          <td nowrap="nowrap" align="right">Phone:</td>
          <td><input type="text" name="spec_call" value="" size="32" /></td>
        </tr>
        <tr valign="baseline">
          <td nowrap="nowrap" align="right">Price:</td>
          <td><input type="text" name="spec_price" value="" size="32" /></td>
        </tr>
        <tr valign="baseline">
          <td nowrap="nowrap" align="right">RTN:</td>
          <td><input type="text" name="spec_rtn" value="" size="32" /></td>
        </tr>
        <tr valign="baseline">
          <td nowrap="nowrap" align="right"> </td>
          <td><input type="submit" value="Insert record" /></td>
        </tr>
      </table>
      <input type="hidden" name="MM_insert" value="form1" />
    </form>
    Help greatly appreciated.
    I have googled, yahooed, binged etc etc and tried many tutorials but nothing goes in my favor please do not suggest to search on search engines or websites.

    Years and months later, apparently Dreamweaver CC 2014 has a "File" Form object that has a text box and Browse button.  Now I'm looking for the part that does the actual upload (which is why I wound up here).  I'm sure by now you have found a way to resolve your issue, but there it is....

  • Tutorial Dreamweaver Cs5.5 The Missing Manual (Pg 998 - 1018) about adding dynamic data to your page

    Hallo,
    I did Tutorial: Displaying Database Info in the Missing Manual for Dreamweaver CS5.5.
    My problem is with "Editing a Recordset and Linking to a Detail Page" (which starts at pg 1002:
    I did this exercise ,over 5 times nowe, but every time with "Building the Detailed Product Page" at pg 1007, I get a bad result.
    I only get one page (the default one with productID = 1) for every link on the indexpage.
    In the adressbar (Live View) I see the right adress: for example: http://localhost/cos...hp?productID=16, but for all productID's only the detailspage for productID are shown.
    There is also a message: Notice: Use of undefined constant ‘productID’ - assumed '‘productID’' in E:\xampp\htdocs\cosmo_shop\product.php on line 34
    But I don't understand what could be wrong in this line.
    Here is the code lines 33 -48: is is about the second line:
    $varProduct_rsDetails = "32";
    if (isset($_GET[‘productID’])) {
      $varProduct_rsDetails = $_GET[‘productID’];
    mysql_select_db($database_connCosmo, $connCosmo);
    $query_rsDetails = sprintf("SELECT products.productID, products.productName, products.price, products.`description`, products.inventory, products.image, vendors.vendorName FROM products, vendors WHERE products.vendorID = vendors.vendorID AND products.productID = %s ", GetSQLValueString($varProduct_rsDetails, "int"));
    $rsDetails = mysql_query($query_rsDetails, $connCosmo) or die(mysql_error());
    $row_rsDetails = mysql_fetch_assoc($rsDetails);
    $totalRows_rsDetails = mysql_num_rows($rsDetails);
    mysql_select_db($database_connCosmo, $connCosmo);
    $query_rsCategories = "SELECT * FROM categories ORDER BY categoryName ASC";
    $rsCategories = mysql_query($query_rsCategories, $connCosmo) or die(mysql_error());
    $row_rsCategories = mysql_fetch_assoc($rsCategories);
    $totalRows_rsCategories = mysql_num_rows($rsCategories);
    ?>
    Can someone tell me what is going on here?
    Kind regards, Ans Hekerman

    I can manually type in double brackets, like this:
    $varProduct_rsDetails = "1";
    if (isset($_GET["productID"])) {
      $varProduct_rsDetails = $_GET["productID"];
    this is accepted; no syntax-error report.
    I can manually type in single brackets, like this:
    $varProduct_rsDetails = "1";
    if (isset($_GET['productID'])) {
      $varProduct_rsDetails = $_GET['productID'];
    this is also accepted; no syntax-error report.
    Dreamweaver itself made this code:
    $varProduct_rsDetails = "32";
    if (isset($_GET[‘productID’])) {
    $varProduct_rsDetails = $_GET[‘productID’];
    this was not OK; there was a syntax-error report.
    But strange enough, when I do paste this now from here, it is accepted.
    So the problem has been, that DW created code that gave a syntax error.
    I could repair it by replacing the single qoutes of DW, by typing single quotes in DW manually, or by typing in in DW manually double qoutes!!!
    So maybe everybode was right!!!
    But is was a very bad problem; maybe a "bug" of the program?
    I repeated this about 10 times before I got the solution frome this Forum.

Maybe you are looking for