Jump to content

halcyonalt

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

halcyonalt's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have a reccomendation system instead of a rating system, and I'm using PHP and mySQL. The tutorial I found requires commands, and mySQL doesn't support that, so I thought that I could use a form and the update function that dreamweaver offers to add to the reccomendation count row. Each time you press submit, it's supposed to add the value ("1") from a hidden field into the rec count row. All I need to make it do is add one instead of replace what is already in the row. I'm not sure how to do this, as I am quite a newbie when it comes to coding in PHP. I don't want to screw anything up. Here is the code Dreamweaver spewed for my update record function, if you can help me modify it, I'd be much obliged: [code] function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") {   $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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 = $HTTP_SERVER_VARS['PHP_SELF']; if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {   $editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING']; } if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"] == "recupdate")) {   $updateSQL = sprintf("UPDATE Fanfiction SET `Rec Count`=%s WHERE ID=%s",                       GetSQLValueString($HTTP_POST_VARS['newreccount'], "int"),                       GetSQLValueString($HTTP_POST_VARS['ID'], "int"));   mysql_select_db($database_altpanfics, $altpanfics);   $Result1 = mysql_query($updateSQL, $altpanfics) or die(mysql_error());   $updateGoTo = "justRated.php";   if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {     $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";     $updateGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];   }   header(sprintf("Location: %s", $updateGoTo)); } $colname_showFic = "1"; if (isset($HTTP_GET_VARS['ficShowID'])) {   $colname_showFic = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['ficShowID'] : addslashes($HTTP_GET_VARS['ficShowID']); } mysql_select_db($database_altpanfics, $altpanfics); $query_showFic = sprintf("SELECT * FROM Fanfiction WHERE ID = %s", $colname_showFic); $showFic = mysql_query($query_showFic, $altpanfics) or die(mysql_error()); $row_showFic = mysql_fetch_assoc($showFic); $totalRows_showFic = mysql_num_rows($showFic); [/code]
  2. Urk, nevermind. It seems that once I introduce URL parameters into the query, it doesn't seem to want to work. I'm not sure why that is. The query works fine with the parameter without the DISTINCT tag on it, but once I add it, nothing shows up in the query. I don't even get an error message.
  3. In Dreamweaver MX. I am creating a link index of different written works. I want the different viewing options to be flexible, such as browsing through written works based on the title, based on the author, and whatnot. I would like to create an author page, and I think I have most of it. I downloaded the Navigation suite so that I can use letters to help navigate. The problem is, a lot of the written works are written by the same authors. One author's name will show up several times in the database. How do I make it so that it only shows up once when the results display? If I can avoid coding, I would like to, because coding seriously baffles me. I am still very much a layman with PHP. If I can get it to only show up once, I think my problems are solved. I know how to create detail pages and such. It's just that tricky problem of making sure that my page isn't filled up with the same author for one particular letter.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.