close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

check if record exists

Thread began 10/22/2012 2:50 pm by randyw2394710 | Last modified 1/18/2013 9:10 am by Jason Byrnes | 2977 views | 17 replies |

randyw2394710

check if record exists

im trying to see if a record exists, if it does, then a div error with record name will appear. not insert it. if it doesnt exisit, then it will insert the record name, and create that folder, also give conformation of the name.
i have searched all the posts even mine still having problems!

Attached Files
chooseGallerytest.zip
Sign in to reply to this post

Jason ByrnesWebAssist

change lines 57 - 69:

php:
$colname_CheckRepeat = "-1";

if (isset($_POST['Gallery Name'])) {
  $colname_CheckRepeat = (get_magic_quotes_gpc()) ? $_POST['Gallery Name'] : addslashes($_POST['Gallery Name']);
}
mysql_select_db($database_PowerCMSConnection, $PowerCMSConnection);
$query_CheckRepeat = sprintf("SELECT 'Gallery Name' FROM pg1_gallery WHERE 'Gallery Name' = %s", GetSQLValueString($colname_CheckRepeat, "text"));
$CheckRepeat = mysql_query($query_CheckRepeat, $PowerCMSConnection) or die(mysql_error());
$row_CheckRepeat = mysql_fetch_assoc($CheckRepeat);
$totalRows_CheckRepeat = mysql_num_rows($CheckRepeat);
$query_CheckRepeat = "SELECT pg1_gallery.id FROM pg1_gallery";
$CheckRepeat = mysql_query($query_CheckRepeat, $PowerCMSConnection) or die(mysql_error());
$row_CheckRepeat = mysql_fetch_assoc($CheckRepeat);
$totalRows_CheckRepeat = mysql_num_rows($CheckRepeat);?>




to:

php:
$colname_CheckRepeat = "-1";

if (isset($_POST['Gallery Name'])) {
  $colname_CheckRepeat = (get_magic_quotes_gpc()) ? $_POST['Gallery Name'] : addslashes($_POST['Gallery Name']);
}
mysql_select_db($database_PowerCMSConnection, $PowerCMSConnection);
$query_CheckRepeat = sprintf("SELECT 'Gallery Name' FROM pg1_gallery WHERE 'Gallery Name' = %s", GetSQLValueString($colname_CheckRepeat, "text"));
$CheckRepeat = mysql_query($query_CheckRepeat, $PowerCMSConnection) or die(mysql_error());
$row_CheckRepeat = mysql_fetch_assoc($CheckRepeat);
$totalRows_CheckRepeat = mysql_num_rows($CheckRepeat);
?>
Sign in to reply to this post

randyw2394710

Now I get an error Unknown column '[Gallery Name]' in 'field list' which it does exist

Sign in to reply to this post

Jason ByrnesWebAssist

Spaces should be avoided in field names, and in form element names.

You have used a space in the Gallery Name column of your database, and in the name of the Form element.


i recommend using the camelCase naming convention to avoid the use of spaces.

Sign in to reply to this post

randyw2394710

check duplicate

  First, you need to create the recordset to filter the email address column on the email address form element.

the recordset will create a variable named:
$totalRows_RecordsetName

(where RecordsetName is the name of the recordset) with the number of records returned.

the idea is to use numeric validation to make sure that recordset does not return any records (is empty)

add server validation, chose numeric validation and set the server variable to:
$totalRows_RecordsetName

Set the minimum number to -1 and the maximum number to 0.


to show the error message, use the validation show if behavior.  


I have done this tutorial a few times now not working right
i have a page with model window for creating new gallery wich pops up after clicking add gallery enter the name it should pass or fail then confirm message or fail message should appear do i need the record sets on the main page or include

Attached Files
chooseGallerytest.zip
gallerypages.zip
Sign in to reply to this post

Jason ByrnesWebAssist

in your recordset, you are referancing a form element that does not exist.


you are using the GalleryName form element, but the text box:
<input type="text" id="addGallery" name="addGallery"/>


is named addGallery

Sign in to reply to this post

randyw2394710

ok got error to appear, how do i close this, if they go to another page then back.
also how do i get success to work, close, this if they go to new page then back. and if does not exist insert

Sign in to reply to this post

Jason ByrnesWebAssist

the validation failure is stored in a session.

you could add code to the page to clear the session after the </html> tag:

php:
<?php if(sset($_SESSION['WAVT_chooseGallerytest_522_Errors'])) unset($_SESSION['WAVT_chooseGallerytest_522_Errors']); ?>




to insert when the name does not exist, you need to add an insert record behavior.

Sign in to reply to this post

randyw2394710

now i get this message
Fatal error: Call to undefined function sset() in /home/content/96/8026696/html/admin_cms/chooseGallerytest.php on line 297

Sign in to reply to this post

Jason ByrnesWebAssist

sorry, i had a typo, the code should be:

php:
<?php if(isset($_SESSION['WAVT_chooseGallerytest_522_Errors'])) unset($_SESSION['WAVT_chooseGallerytest_522_Errors']); ?>
Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...