PHP MYSQL KEYWORD SEARCH HELP

Im creating a search for a image gallery and I want it to be able to pull up an image based on the keyword assigned to the image you searched. I have 4 fields in my DB, (id,layout"or image",description,key_words). My problem is when I enter a keyword in my textfield when the results page loads all I get is the field names (id,layout,description,key_words) instead of the actually data within those fields.
I believe my problem lies within this line of code:
$query_Recordset1 = sprintf("SELECT * FROM images2 WHERE key_words = %s ORDER BY id DESC", GetSQLValueString($colname_Recordset1, "text"));
this code displays my DB field names, but not the data I inserted in those fields.
So I tried changing the code to this:
$query_Recordset1 = sprintf("SELECT * FROM images2 WHERE key_words LIKE '%$keyword%' ORDER BY id DESC", GetSQLValueString($colname_Recordset1, "text"));
This code did display my mysql data, but not the data I entered in my textfield. With this code I don't even have to enter any keywords in the text field, I can simply click the search button and my mysql data would show up, even though I didn't enter a keyword...?
Im very confused  I've been working on this off and on for  about a month now and have been in 3 different forums and know one seems to  be able to help. It would greatly appreciated if someone could help me  through this.
Here is all my code for a better understanding:
SEARCH PAGE:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="get" action="r.php">
  <label for="textfield"></label>
  <input type="text" name="keyword" id="textfield" />
  <input type="submit" name="button" id="button" value="search" />
</form>
</body>
</html>
RESULTS PAGE:
<?php require_once('Connections/MyConnection.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_Recordset2 = 3;
$pageNum_Recordset2 = 0;
if (isset($_GET['pageNum_Recordset2'])) {
  $pageNum_Recordset2 = $_GET['pageNum_Recordset2'];
$startRow_Recordset2 = $pageNum_Recordset2 * $maxRows_Recordset2;
$colname_Recordset2 = "-1";
if (isset($_GET['key_words'])) {
  $colname_Recordset2 = $_GET['key_words'];
mysql_select_db($database_MyConnection, $MyConnection);
$query_Recordset2 = sprintf("SELECT * FROM images2 WHERE key_words = %s ORDER BY id DESC", GetSQLValueString($colname_Recordset2, "text"));
$query_limit_Recordset2 = sprintf("%s LIMIT %d, %d", $query_Recordset2, $startRow_Recordset2, $maxRows_Recordset2);
$Recordset2 = mysql_query($query_limit_Recordset2, $MyConnection) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
if (isset($_GET['totalRows_Recordset2'])) {
  $totalRows_Recordset2 = $_GET['totalRows_Recordset2'];
} else {
  $all_Recordset2 = mysql_query($query_Recordset2);
  $totalRows_Recordset2 = mysql_num_rows($all_Recordset2);
$totalPages_Recordset2 = ceil($totalRows_Recordset2/$maxRows_Recordset2)-1;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<table>
  <tr>
    <td>id</td>
    <td>Layouts</td>
    <td>Descriptions</td>
    <td>key_words</td>
  </tr>
  <?php do { ?>
    <tr>
      <td><?php echo $row_Recordset2['id']; ?></td>
      <td><?php echo $row_Recordset2['Layouts']; ?></td>
      <td><?php echo $row_Recordset2['Descriptions']; ?></td>
      <td><?php echo $row_Recordset2['key_words']; ?></td>
    </tr>
    <?php } while ($row_Recordset2 = mysql_fetch_assoc($Recordset2)); ?>
</table>
</body>
</html>
<?php
mysql_free_result($Recordset2);
?>

$query_Recordset1 = sprintf("SELECT * FROM images2 WHERE key_words LIKE '%$keyword%' ORDER BY id DESC", GetSQLValueString($colname_Recordset1, "text")); 
Why are you using the $keyword variable rather than the sprintf parameter? I don't know php, but it seems like that is your problem. Maybe try something like this:
$query_Recordset1 = sprintf("SELECT * FROM images2 WHERE key_words LIKE %s ORDER BY id DESC", GetSQLValueString("%" . $colname_Recordset1 . "%",  "text"));

Similar Messages

  • Dreamweaver 8, PHP, multiple keyword search problem

    Hello, I've successfully set up a search form, and a
    recordset which retrieves results when a keyword is added to the
    search form text field and the form is submitted. What I'm trying
    to do is allow tourists to enter one or more keywords, such as
    Istanbul Ankara, to get tours which include either or both of these
    keywords. The search function works fine if I just put in one
    keyword, like "Istanbul" or "istanbul." But if I enter two
    keywords, there are no results, even though there are several tours
    with both of these destinations in their itinerary. If I enter
    istanbul AND ankara, I get results with the boolean method, but I
    don't expect most of my site visitors to know how to do that.
    Is there a way to modify the recordset, so that the user gets
    results when they search with multiple keywords? Here's my SQL
    code:

    Ben Densin wrote:
    > Is there a way to modify the recordset, so that the user
    gets results when
    > they search with multiple keywords?
    Add a FULLTEXT index to the column that you want to search,
    then change
    the SQL like this:
    WHERE MATCH (tours.long_itinerary) AGAINST ('keywords') AND
    tour_category.cat_id=tours.category_id AND
    tours.agency_id=travel_agency.agency_id
    http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS3" (friends of
    ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • Macromedia Dreamweaver "Unidentified Error" PHP MySQL, help please

    Ok,
    I've been developing web applications with with PHP/MySQL for some time now, but had been unable to afford dreamweaver to help me out. Thus every website I made came from strait "notepad" style typeing. Everything always worked just fine. Recently though I got my hands on Macromedia Studio MX, but have been having troubles ever since then.
    I wrote my own PHP script to connect to my MySQL database on my computer (localhost), and it worked like a charm. Then I went over to dreamweaver, followed all the steps, entered the information, clicked the "test" button and I get the an error "an unidentified error occured".
    At this point I checked everything tried again, and then that rendered the same result, I went online and found the same problem at Macromedia's webstie: http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_16515
    I've tried everything mentioned there to no avail. I was hopeing someone out there would know what is wrong with my connection. Quick summary:
    Trying to connect with Dreamweaver to localhost MySQL database, with PHP MySQL settings. I get "an unidentified error occured". But the informaiton has been verified as correct with my own PHP script.

    Sorry, but it doesn't help JTANNA.
    What is your definition of "more efficiently"? If it's limitation of search results, branded search, and limitation of styling your results then google search is more efficient. Real developers rely on their own developments. For example: how can google search display results from a password-protected site? They can't.
    best,
    Shocker

  • I need help with DW, PHP & MySQL please.

    Hello, I am new to website development and am trying to set up a form for collecting data on my website and have a question that I can’t find an answer to anywhere else. I was wandering if someone there would be kind enough to help?  I am using Dreamweaver in CS4 and my host already has PHP & MySQL installed on the server that I can use.  My question is: Do I need to download XAMP or WAMP on my computer before trying to connect my form to the server?  Also, do I need to change the page I am putting the form on to .PHP extension or can I just embed the PHP form into an existing HTML page?
    Most of the training tutorials I’ve read don’t start at the most basic beginning but rather expect people to already have a basic knowledge of the topics they are trying to learn.  If anyone knows the best place to get answers to the most basic questions like this one or a beginners guide to working with DW, PHP & MySQL I will gladly go there rather than waste your time on questions you’ve probably already answered a bezillion times.
    Thank you for the help.

    Strictly speaking, you don't need XAMPP or WAMP on your local computer. But if you're serious about getting involved with PHP/MySQL, you should definitely set up a local testing environment with one or the other. It's safer and more efficient. Don't expose all your errors on a live server. You can find instructions on  how to set up a testing environment here: http://www.adobe.com/devnet/dreamweaver/articles/setting_up_php.html.
    To develop with PHP, you should always use a .php file name extension. Any other choice is very rare.
    There's a tutorial on building your first dynamic website with DW here: http://www.adobe.com/devnet/dreamweaver/articles/first_dynamic_site_pt1.html.
    For more in-depth help, you might want to consider grabbing hold of a copy of "The Essential Guide to Dreamweaver CS4 with CSS, Ajax, and PHP". (Yes, I wrote it, so it's a bit of shameless self-promotion, but you'll find it answers many of your questions - and probably a lot you hadn't even thought of.)

  • Apache2, PHP, MySQL Help

    Hi,
    Sorry if this is a bit of a newbie thing todo but I am not too good with solaris configuration yet.
    Can anyone supply a decent step by step and easy tutorial/how-to on how to set up Apache, PHP, MySQL and PHPmyadmin on a SPARC solaris 10 box please...
    Thanks Rob

    Can anyone supply a decent step by step and easy
    tutorial/how-to on how to set up Apache, PHP, MySQL
    and PHPmyadmin on a SPARC solaris 10 box please...Setting up Apache is very easy since all it takes is setting it up. Its installed by default, you can check /etc/apache for an example configuration file. Next to that www.apache.org/docs/ is also a very valuable read.
    <blunt SPAM>
    You could also consider looking into the Java webserver (formely SunONE). Its currently being made available for free with the Java Enterprise System and compares very well to Apache. If you'll also be doing some Java it would be a better choice (IMO its a better choice than Tomcat) and it can also do PHP.
    http://www.sun.com/software/products/web_srvr/home_web_srvr.xml
    http://www.zend.com/sun/?article=/sun/index.php&kind=&id=6179&open=1&anc=0&view=1
    http://www.php.net/
    </SPAM>
    As you'll note I included the PHP website because with the above setup you'd also need to manually setup PHP. If you have the companion CD present you can install the PHP module which will end up on /opt/sfw/apache. This directory will also present you a php.ini example which will need to be placed in /etc/apache as well. Setting it up is basicly following the documentation in the ini file, and the Apache documentation on adding an extra module (/opt/sfw/apache/libexec/libphp4.so).
    MySQL. Also very easy since its shipped with Solaris as well. Look into /etc/sfw/mysql for a README which covers the most essential steps to set it up. In short you'll need to setup a few directories for MySQL to work and optionally (but recommended) copy the default config file to /etc (/etc/my.cnf) which will define certain basic settings. The readme explains. Next you're likely to need the MySQL guide (if you're new with MySQL) which can be located at http://dev.mysql.com/doc/refman/4.1/en/index.html.
    This applies to the version (close enough anyway) which is shipped with Solaris. From personal experience I can say that MySQL 5 will also run very well on Solaris 10.
    Finally the PHPMyadmin... That really is an RTFM issue, once you have your environment setup (Apache and the likes) its likely you only need to copy it to your document root and point your browser to it.
    Hopes this helps somewhat.

  • PHP/mySQL code help please

    Hi all,
    Thanks to David Powers fab tutorial I am now well on my way to competeing my first dynamique website using PHP/mySQL, (thanks David ), however I am stuck on one particular area....can anyone please help?
    I know that the mySQL database uses the format YYYY/MM/DD for dates, and that is fine. I've sorted out how to display in a more regular format (eg. 1st September 2011) for my application, but I am stuck on how to convert a more regular formatted date entered by the site user into the mySQL format.
    Ideally I would like for the users entry or say either 1/9/11 or 1-9-11 (or something along those lines, to be recognised and displayed on the entry form, but to have a backend function that converts the data to mySQL format. I seem to be reading plenty of forum posts which say this can be done, but unfortunately I can't quite seem to fathom how, or where the code should sit. Would someone mind taking a look at my code page to actually identify what I need to insert, and equally as importantly...where!!!
    Along these lines...is it possible to have a mini-calendar date picker that could be embedded next to the date entry field to ensure that a valid date is entered and in the correct format? Where could this be sourced?
    Thanks in advance of some much needed help
    Mark

    This is becoming really frustrating for me (so god knows how I am to you!!!!), but I usually pick things up so fast and yet this whole PHP/SQL thing is eluding me!!
    I can see (I think) how the code would work, but am struggling to see where it fits into place with my own Dreamweaver 'Update Record' code, as follows. I have spent a couple of days trawling through PHP.net and various other sites and forums before bringing my stupidity to the public domain, but I just can't seem to crack it.
    This one last time then i'll leave you in peace??????
    <?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_update"])) && ($_POST["MM_update"] == "form1")) {
        $updateSQL = sprintf("UPDATE gig_guide SET `date`=%s, town=%s, venue=%s, private_or_public=%s, start_time=%s WHERE `index`=%s",
                           GetSQLValueString($_POST['date'], "date"),
                           GetSQLValueString($_POST['town'], "text"),
                           GetSQLValueString($_POST['venue'], "text"),
                           GetSQLValueString($_POST['type'], "text"),
                           GetSQLValueString($_POST['start_time'], "text"),
                           GetSQLValueString($_POST['index'], "int"));
      mysql_select_db($database_online, $online);
      $Result1 = mysql_query($updateSQL, $online) or die(mysql_error());
      $updateGoTo = "index.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
        $updateGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $updateGoTo));
    $colname_updatePost = "-1";
    if (isset($_GET['index'])) {
      $colname_updatePost = $_GET['index'];

  • PHP/MySQL Help Needed

    I'm a beginner with this PHP/MySQL language, but I'm using
    Dreamweaver CS3 to help things along. I've set up my database with
    my host (using PHPmyAdmin) and put in a table with some fields.
    Then I went into Dreamweaver and set up everything and it saw the
    database name perfectly. Then I made a recordset and it saw the
    fields just fine. I then made an input page to put the data into
    the database and that went off without a hitch. I then made a basic
    webpage with nothing but the call to display 2 of the fields in my
    database (I did the test in dreamweaver and it saw all the data I
    populated my database with perfectly). I then told it to preview in
    Firefox and got a blank page... Ok I must have done something
    wrong, so I put in some basic text just so I could see if even that
    would show up correctly. Then I previewed in Firefox again and not
    only did it show up, but the 2 fields showed up as well! Yea! So I
    made some changes to the fields I wanted to show and again did a
    Preview in Firefox. I was again treated to a blank page. Not even
    my basic text was showing up. I went back to Dreamweaver and added
    some more text... preview... works perfectly showing everything. I
    refresh the page and it's blank. I close Firefox and preview again.
    It's a blank page, but for the heck of it I decide to View Source
    and lo and behold all the data is there. I close the source and try
    reloading the page... blank. I'm at a loss. Any idea why this might
    be happening?

    jays99 wrote:
    > Thanks, David. I have your PHP5-Flash 8 book and egerly
    await your newest. I
    > installerd MySQL 5.027 for 10.4 intel which but it does
    not come up
    > automatically and there is no MySQL control on the
    Preferences. I read
    > somewhere that I have to open a file and change some
    lines of code in a config.
    > file. Do you have any insight to that? Thanks again, Jay
    Sorry, I haven't tested anything on an Intel Mac yet. Testing
    everything
    on Vista for my new Dreamweaver book has given me enough of a
    headache.
    However, I'm pretty sure that my editor has an Intel Mac, and
    he
    followed the instructions in "PHP Solutions" without any
    major hiccups.
    (They're pretty much the same as in the Flash book.)
    Isn't there a MySQL.prefPane icon in the MySQL installation
    package? I
    have found that MySQL won't start automatically on 10.4 (it
    did on
    10.3), but as long as you install the prefPane, you should be
    able to go
    in and start it manually.
    David Powers, Adobe Community Expert
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • Dreamweaver newbie - php & mysql help

    hi,
    new to dremweaver, have used .net in past with vwd and found it straight forward to drag over grid view etc to view data from sql database.
    i want to use php and mysql now and looking at dreameaver cs4 i really want to know what each navigation is. i.e. how do i create my mysql database and drag say a grid view in dreamweaver cs4 over to view?
    basically just need to know the basics navigation of what buttons i need for to interact using php and mysql?
    any help would be great, and also if anyone can recommend a good book on php/mysql with dreamweaver cs4 as a by the by then would greatly appreciate it.
    many thanks
    andy

    Take a look at this book:
    http://www.amazon.com/Essential-Guide-Dreamweaver-Ajax-Essentials/dp/1430216107
    I didn't read it, but I am currently reading the author's another book (David Powers: PHP Object-Oriented Solutions) and he is good.
    David is also a community expert on these forums.

  • I have downloaded MAMP for Mac and want to use it for working with Wordpress. I had mysql installed before this and would like to uninstall it and use MAMP. It was easy to turn off Apache and PHP but don't know how to uninstall mysql. Please help!!

    I have downloaded MAMP for Mac and want to use it for working with Wordpress. I'm on an Imac with Maverick OS 10.9. I had mysql installed before this and would like to uninstall it and use MAMP. It was easy to turn off Apache and PHP but don't know how to uninstall mysql. Please help!!

    It depends on how you installed it. You have to shutdown the MySQL service first. If you used the standard, but obsolete Startup Item, you can do that with the Startup Item. If you created a launchd script, you can do it with launchctl. Once MySQL is no longer running, you can delete the Startup Item or launchd script and the rest of MySQL.

  • PHP / MySQL help

    Hello all,
    I've got an update record form on one of my pages (it is a
    php / MySQL site). I followed the tutorial in dreamweaver 8, it
    works, but it does not work like I want it to work.
    I am hoping that when a user logs into the site, and they
    want to update their information, they can go to a page that has an
    update record form. This form will have all the fields empty. When
    the user enters information, only the fields that have been entered
    will update the record in the database (and all of the fields that
    are left blank will have no effect on the record in the database).
    How it is now, when the user goes to that page, all the text
    fields are filled with the information contained in the database.
    If they make a mistake, and delete any of those fields, that
    information will be deleted from the database.
    Is this possible to do? If so, is there a tutorial that I
    have not found yet that I can learn how to do this?
    Thank you

    >Is this possible to do?
    Sure it's possible, but I don't really think it's necessary.
    What if the user wants to completely remove the contents of the
    field? And if you don't want to allow that, then you should
    validate those fields anyway.
    Another workflow would be to have the form retrieve the
    database row into static text fields, so at least the user can see
    what is stored. Adjacent to the static fields would be normal text
    fields that they can enter text into if they want to make changes.
    Of course your form processing script would then need to evaluate
    each field for contents. It would then dynamically build the update
    sql based on the filled in fields. I don't know of a specific
    tutorial, but if you know sql and php it should be a piece of
    cake.

  • Help:DataGrid + PHP + Mysql

    I want to konw how to show the data in DataGrid , and data
    from PHP + Mysql.
    where is a example?
    PS:I home make all code in the .as file,not at .mxml
    file.

    You'll probably find something in that thing called the
    developer center:
    http://www.adobe.com/devnet/flex/flex_php.html

  • Help with php mysql connect script

    Ok guys im new to php mysql and i'm trying to insert some
    form information in my database. Im using a script from sitepoint
    in which i went through the tutorial did some experiments of my own
    and it worked....
    but now i'm getting this error which i cant figure out....
    Error placing order: You have an error in your SQL syntax;
    check the manual that corresponds to your MySQL server version for
    the right syntax to use near 'order SET product ='1',
    size='medium', color='', quantity = '1' at line 1
    here is the page
    http://vaughntucker.com/imagecon/hats.php
    and this is the script
    <?php
    //default page display
    //connect to database
    $dbcnx = @mysql_connect('p3nl41mysql7.secureserver.net',
    'imagecon', 'Dub*boss_1');
    if (!$dbcnx) {
    echo '<p> Unable to connect to the '. 'database server
    at this time.</p>';
    exit();
    //select database
    if (!@mysql_select_db('imagecon')) {
    exit('<p>Unable to locate the ' .
    'database at this time.</p>');
    //Mysql query add joke
    if (isset($_POST['submit'])) {
    $product = 1;
    $size = $_POST['size'];
    $color = $_POST['color'];
    $quan = $_POST['quantity'];
    $sql = "INSERT INTO order SET
    product ='$product',
    size='$size',
    color='$color',
    quantity = '$quan',
    date = CURDATE()";
    }else{
    echo 'No data submited';
    if (@mysql_query($sql)) {
    echo '<p>Your order has been submited.</p>';
    } else {
    echo '<p>Error placing order: ' .
    mysql_error() . '</p>';
    ?>
    thanks in advance

    $sql = "INSERT INTO order SET
    product ='" . $product . "',
    size='" . $size . "',
    color='" . $color . "',
    quantity = '" . $quan . "',
    I believe there are other more elegant ways to do this, as
    well.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "beatzMalone" <[email protected]> wrote in
    message
    news:[email protected]...
    > Ok guys im new to php mysql and i'm trying to insert
    some form information
    > in
    > my database. Im using a script from sitepoint in which i
    went through the
    > tutorial did some experiments of my own and it
    worked....
    >
    > but now i'm getting this error which i cant figure
    out....
    >
    > Error placing order: You have an error in your SQL
    syntax; check the
    > manual
    > that corresponds to your MySQL server version for the
    right syntax to use
    > near
    > 'order SET product ='1', size='medium', color='',
    quantity = '1' at line 1
    >
    > here is the page
    >
    http://vaughntucker.com/imagecon/hats.php
    >
    > and this is the script
    > <?php
    > //default page display
    > //connect to database
    > $dbcnx = @mysql_connect('p3nl41mysql7.secureserver.net',
    'imagecon',
    > 'Dub*boss_1');
    > if (!$dbcnx) {
    > echo '<p> Unable to connect to the '. 'database
    server at this
    > time.</p>';
    > exit();
    >
    > }
    >
    > //select database
    > if (!@mysql_select_db('imagecon')) {
    > exit('<p>Unable to locate the ' .
    > 'database at this time.</p>');
    > }
    >
    > //Mysql query add joke
    > if (isset($_POST['submit'])) {
    > $product = 1;
    > $size = $_POST['size'];
    > $color = $_POST['color'];
    > $quan = $_POST['quantity'];
    > $sql = "INSERT INTO order SET
    > product ='$product',
    > size='$size',
    > color='$color',
    > quantity = '$quan',
    > date = CURDATE()";
    > }else{
    > echo 'No data submited';
    >
    > }
    > if (@mysql_query($sql)) {
    > echo '<p>Your order has been submited.</p>';
    > } else {
    > echo '<p>Error placing order: ' .
    > mysql_error() . '</p>';
    > }
    >
    >
    >
    > ?>
    >
    > thanks in advance
    >

  • HOW TO CREATE A KEYWORD SEARCH FORM

    Hi, I'm creating a image gallery and I'm about 90% complete. One of my  final objectives is to create a keyword search for my image gallery. I  have 4 fields in my DB, (id,image,description,keywords) I want to be  able to enter keywords into the text field  and the images with there  descriptions show up. I already have the  keywords in my mysql, I already know how to use mysql, I just need to learn how to add a search form that pulls keywords from my mysql. THIS DOES NOT REQUIRE ANY CODE so please do not respond with code. I just need a step by step on what type of form to insert, (dynamic text field or text field) what paramaters to pass etc. NO CODE, this whole thing can be done in design veiw.
    For this project I'm using Dreamweaver Cs5, I'm not really an  experienced coder I rely heavily on dreamweaver for my code, I just make  minor tweaks. So if anyone has an answer to my problem please break  down and simplify your answer I'm still a beginner. Thanks in advance.
    ps
    If anyone knows of any other video tutorials of this process please inform me, it would be greatly appreciated, thank you.(not php acedemies)

    This is helpfull but I'm still running in to some problems. I believe everything on my search page is correct, I think it's my results page thats giving me issues.  When I view my search page in firefox and type in a keyword in the text field, when the results page loads all I get is the field names of DB table (id,layouts,desription,key_words) instead of the actual data...??
    On my search page in the action box I have my results page "search_results.php". In the method box I have "GET".  On my "search_ruselts.php" page I created a recordset, selected all columns, and filtered "key_words". (im not sure if I filtered correctly) I placed this in a dynamic table. Where did I go wrong?
    this is my code if it helps any
    search page:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    <body>
    <form id="form1" name="form1" method="get" action="search_results.php">
      <label for="textfield"></label>
      <input type="text" name="textfield" id="textfield" />
      <input type="submit" name="button" id="button" value="Submit" />
    </form>
    </body>
    </html>
    results page:
    <?php require_once('Connections/test_db.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;
    $colname_Recordset1 = "-1";
    if (isset($_GET['key_words'])) {
      $colname_Recordset1 = $_GET['key_words'];
    mysql_select_db($database_test_db, $test_db);
    $query_Recordset1 = sprintf("SELECT * FROM images2 WHERE key_words = %s ORDER BY id DESC", GetSQLValueString($colname_Recordset1, "text"));
    $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
    $Recordset1 = mysql_query($query_limit_Recordset1, $test_db) 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;
    $colname_Recordset2 = "-1";
    if (isset($_GET['id'])) {
      $colname_Recordset2 = $_GET['id'];
    mysql_select_db($database_test_db, $test_db);
    $query_Recordset2 = sprintf("SELECT * FROM images2 WHERE id = %s ORDER BY id DESC", GetSQLValueString($colname_Recordset2, "int"));
    $Recordset2 = mysql_query($query_Recordset2, $test_db) or die(mysql_error());
    $row_Recordset2 = mysql_fetch_assoc($Recordset2);
    $totalRows_Recordset2 = mysql_num_rows($Recordset2);
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    <body>
    <table cellpadding="4" cellspacing="4">
      <tr>
        <td>id</td>
        <td>Layouts</td>
        <td>Descriptions</td>
        <td>key_words</td>
      </tr>
      <?php do { ?>
        <tr>
          <td><?php echo $row_Recordset1['id']; ?></td>
          <td><?php echo $row_Recordset1['Layouts']; ?></td>
          <td><?php echo $row_Recordset1['Descriptions']; ?></td>
          <td><?php echo $row_Recordset1['key_words']; ?></td>
        </tr>
        <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
    </table>
    </body>
    </html>
    <?php
    mysql_free_result($Recordset1);
    mysql_free_result($Recordset2);
    ?>

  • PHP / MySQL / Stored Procedures

    I'm trying to call a stored procedure on my site which uses
    php / mySQL 5.x. I've got the procedure working in the database so
    that when I call it from within a MySQL client it executes and
    returns the results I need, but Dreamweaver doesn't even "see" the
    stored procedure.
    By this I mean If I use the recordset wizard, go to advanced,
    select the relevant database and then expand the Stored Procedures
    tab none are listed.
    Searching through Adobe help, it lists nothing about Stored
    Procedures with PHP/MySQL apart from that MySQL doesn't support
    them. The later versions of MySQL do support Stored Procedures, but
    has anyone got them working with Dreamweaver? If so how!??!!
    Any help much appreciated.

    Talk Rowing wrote:
    > Well thanks for setting me straight - even if you are
    the bearer of bad news.
    > I've filed a feature request as you suggested. Can't
    believe Adobe don't offer
    > this.
    Stored procedures have been available in MySQL only since
    version 5.0,
    which was released in October 2005, one month after
    Dreamweaver 8. It
    would have been nice to include support for stored procedures
    in CS3,
    but no new functionality was added to any of the server-side
    features of
    Dreamweaver. I have my fingers crossed for next time.
    > On another note I don't suppose you could point me in
    the direction of some
    > tutorials on how to create a recordset from a stored
    procedure manually? I've
    > tried google and not come across a lot...
    My server doesn't support MySQL 5.0, so apart from the
    information in
    the MySQL documentation, I don't know a great deal about
    using stored
    procedures:
    http://dev.mysql.com/doc/refman/5.0/en/stored-procedures.html
    One of the problems is that many hosting companies are still
    using older
    versions of MySQL (a lot still offer only 3.23). I'm
    currently in the
    process of moving to a new server with support for both PHP 5
    and MySQL
    5.0. Once I've had time to experiment, I hope to know a lot
    more.
    David Powers, Adobe Community Expert
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • [php+mysql] best way to integrate a tree category menu base on db?

    Hi all,
    I have a products catalog where all products are organized in
    categories.
    The category structure is something similar to this:
    category 1
    subcategory 1.1
    sub-subcategory 1.1.1
    sub-subcategory 1.1.2
    sub-subcategory 1.1.3
    sub-subcategory 1.1.4
    sub-subcategory 1.1.5
    subcategory 1.2
    subcategory 1.3
    category 2
    subcategory 2.1
    subcategory 2.2
    sub-subcategory 2.2.1
    sub-subcategory 2.2.2
    sub-subcategory 2.2.3
    sub-subcategory 2.2.4
    subcategory 2.3
    ...and so on...
    In general, I have 3 category levels.
    I manage these catagories with only one table using self
    foreign keys.
    Now I need to add a tree menu that will reflect the above
    category
    structure.
    I use php + mysql to store the tables (products and
    categories.
    I found several javascript samples that allow you to do
    something similar
    but with static data.
    I'm searching for a tree menu that is easily customizable and
    that can use
    dynamic data from mysql db.
    Is there a tutorial or smple that would do the trick?
    TIA very much!
    tony ;).

    The page I'm trying to create is here www.hollisterairshow.com/plan-results.php and the questionnaire is here www.hollisterairshow.com/helpusplan.php .
    I went ahead and created recordsets using advanced recordsets and these seem to be working, here's a sample SQL
    SELECT *
    FROM plan
    WHERE Saturday = 'Saturday' AND plan.howArriving = 'Auto'
    I created a recordset for each combination of day and transportation mode - six in all
    This selected the correct records.
    To display the count of how many records selected I then used in DW Insert/Data Objects/ Display Record Count/Total Records which generated the following code:
    <?php echo $totalRows_rsSatAuto ?>
    This worked OK - not elegant but OK and I repeated it for each combination of Day and Transportation mode!!
    So there are two problems I'm having:
    I know I can select the records I want but how do I display the sum of the column containing "How many in your party" - i.e. in the PHP code generated above what do I replace $totalRows_rsSatAuto with?
    There are two questions using radio buttons where I'd like to display the count and % for each option selected. I can select all records for these questions but what code do I put to sum the number of selections for each option and what code do I put to calculate the percentage
    I understand the arithmetic involved which is pretty simple but it's the mechanics of coding that has me stumped. It would really help if you could give me a sample for say the "Are you camping overnight" question which has a "Yes/No" option only. In my mundane way I would create two recordsets, one for "Yes" and one for "No", and use the same technique I describe above for counting Total Records in each recordset, but then I'm stuck with how do I calculate and display the percentages. I must be missing something very obvious as I'm sure there just has to be a more elegant solution.
    Thanks so much for your continued interest.
    Tony

Maybe you are looking for

  • Bug in apple dvd player?

    has anyone epxerienced this? I am experiencing a strange thing where buttons are intermittently not highlighting. Like after viewing a track, and pressing menu, I am on my menu with nothing highlighted (and menu targets are set to specific buttons).

  • Looking for HP ProtectTools 6.X

    I am looking for a download for HP ProtectTools for my HP Elitebook 850 G1.  I used ProtectTools on my Elitebook 8470p and it worked great, but now I need a different version for my new machine.  I am using Windows 7 Professional 64-bit. All I want t

  • Language in appstore suddenly german, cant update apps, what to do

    read topic

  • Types of function Modules

    What are different types of function modules ?? Please tell in detail about Normal function modules and RFC enabled functional modules ? I have searched other threads also but did not get the enough descriptions of the same. Please respond !

  • Endnote bibliography transfer from word to page not aligned?

    I have a word document with endnote bibliography that I need to transfer to my page document which also has its own bibliography. Somehow, after I copy and paste the content from word to page, the bibliography is not coordinate. It became two separat