rofl90 Posted March 13, 2008 Share Posted March 13, 2008 heres the error: 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 'using = 'FlashandDesignandStyle' WHERE clientname = 'Hilbre Kirk'' at line 1 and heres the query extract from php: $clientname = $_POST['clientname']; $description = addslashes($_POST['description']); $price = addslashes($_POST['price']); $link = addslashes($_POST['link']); $using = addslashes($_POST['using']); $query = "UPDATE sales SET clientname = '$clientname', description = '$description', price = '$price', link = '$link', using = '$using' WHERE clientname = '$clientname'"; mysql_query($query) or die(mysql_error()); echo "Edited Sale!"; Link to comment https://forums.phpfreaks.com/topic/95899-mysql-syntax-error/ Share on other sites More sharing options...
derrick1123 Posted March 13, 2008 Share Posted March 13, 2008 Try: $clientname = $_POST['clientname']; $description = addslashes($_POST['description']); $price = addslashes($_POST['price']); $link = addslashes($_POST['link']); $using = addslashes($_POST['using']); $query = "UPDATE 'sales' WHERE clientname = '$clientname' SET clientname = '$clientname', description = '$description', price = '$price', link = '$link', using = '$using'"; mysql_query($query) or die(mysql_error()); echo "Edited Sale!"; Link to comment https://forums.phpfreaks.com/topic/95899-mysql-syntax-error/#findComment-490959 Share on other sites More sharing options...
trq Posted March 13, 2008 Share Posted March 13, 2008 USING is a reserved word in mysql. Either (and prefered) change your field name to something more suitable, or surround it with `backticks`. Link to comment https://forums.phpfreaks.com/topic/95899-mysql-syntax-error/#findComment-490963 Share on other sites More sharing options...
rofl90 Posted March 13, 2008 Author Share Posted March 13, 2008 Oh ok, thanks man also I don't know if you can but heres my script, what it does is well.. you can see it this is what it echos http://www.codeetech.com/go/portfolio/ heres the code <?php session_start(); require("../../inc/connectdb.php"); $settings = mysql_fetch_array(mysql_query("SELECT * FROM settings")); $siteonline = $settings['maintenance']; if($siteonline == '0' && $_SESSION["access"] != 'granted') { header("Location: http://www.codeetech.com/maintenance.php"); } else { ?> <!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=iso-8859-1" /> <meta http-equiv="description" name="description" content="<?php echo $settings['description'];?>" /> <meta http-equiv="keywords" name="keywords" content="<?php echo $settings['keywords'];?>" /> <title><?php echo $settings['sitetitle'];?> » Portfolio</title> <link href="http://www.codeetech.com/css/style.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" language="javascript" src="http://www.codeetech.com/backend/js.php"></script> </head> <body> <div class="container"> <div class="innercontainer"> <div class="toppart"> <div class="innertoppart"> <div class="logo"><img src="http://www.codeetech.com/go/images/headerimg.gif" alt="Codeetech" width="200" height="69" /></div> <div class="myslogan"> <div class="innermyslogan"><?php if(isset($_SESSION["user"])) { echo "Welcome, "; echo $_SESSION["user"]; echo ". <a href='http://www.codeetech.com/backend/'>Admin Panel</a>"; } else { ?><form method="post" name="login" action="http://www.codeetech.com/backend/validate.php"> <input name="userid" type="text" id="login_username" value="username..." onfocus="clearText('username...',this.value,this.id);" onblur="fillText(this.id,'username...');" /> <br /> <input name="password" type="password" id="login_password" value="password..." onfocus="clearText('password...',this.value,this.id);" onblur="fillText(this.id,'password...');"/> <br /> <input type="submit" id="login_button" value="Login" /> </form><?php } ?></div> </div> </div> </div> <div class="backlinker">Go » Portfolio</div> <div class="stuff"> <div class="leftmargin"> <div class="indentmebitch"> <?php $finalisedpage = mysql_fetch_array(mysql_query("SELECT * FROM portfolio")); echo "<h1>"; echo stripslashes($finalisedpage['title']); echo "</h1>"; echo "<p>"; $query = "SELECT * FROM sales"; $result = mysql_query($query); // how many rows to show per page $rowsPerPage = 5; // by default we show first page $pageNum = 1; // if $_GET['page'] defined, use it as page number if(isset($_GET['page'])) { $pageNum = $_GET['page']; } // counting the offset $offset = ($pageNum - 1) * $rowsPerPage; $query = "SELECT * FROM sales LIMIT $offset, $rowsPerPage"; $result = mysql_query($query) or die(mysql_error()); // print the random numbers while($row = mysql_fetch_array($result)) { echo "<table width='100%' border='0' align='center' cellpadding='5' cellspacing='5'>"; echo "<tr><td colspan='3'><hr size='1' noshade color='#CCCCCC'></hr></td></tr>"; echo "<tr>"; echo "<td align='center' width='126'><a href='javascript:screenWindow('http://www.codeetech.com/go/portfolio/thumbnails/"; echo $row['id']; echo ".php')'><img src='http://www.codeetech.com/go/portfolio/thumbnails/"; echo $row['id']; echo ".png' width='126' height='124' alt='"; echo $row['clientname']; echo "' border='0'></a>"; echo "</td><td> </td><td style='vertical-align: top; width: 100%;'>"; echo "<strong>"; echo $row['clientname']; echo "</strong><br>"; echo "| <a href='javascript:screenWindow('http://www.codeetech.com/go/portfolio/thumbnails/"; echo $row['id']; echo ".php')'>View</a> | <a href='javascript:screenWindow('http://www.codeetech.com/go/portfolio/out/index.php?id="; echo $row['id']; echo "')'>Launch Site</a> <br>"; echo "<table cellpadding='0'>"; echo "<tr><td>Client:</td><td nowrap> </td><td width='100%'>"; echo $row['clientname']; echo "</td></tr>"; echo "</table>"; } echo '<br>'; // how many rows we have in database $query = "SELECT COUNT(id) AS numrows FROM sales"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result, MYSQL_ASSOC); $numrows = $row['numrows']; // how many pages we have when using paging? $maxPage = ceil($numrows/$rowsPerPage); $self = $_SERVER['PHP_SELF']; // creating 'previous' and 'next' link // plus 'first page' and 'last page' link // print 'previous' link only if we're not // on page one if ($pageNum > 1) { $page = $pageNum - 1; $prev = " <a href=\"$self?page=$page\">[Prev]</a> "; $first = " <a href=\"$self?page=1\">[First Page]</a> "; } else { $prev = ' [Prev] '; // we're on page one, don't enable 'previous' link $first = ' [First Page] '; // nor 'first page' link } // print 'next' link only if we're not // on the last page if ($pageNum < $maxPage) { $page = $pageNum + 1; $next = " <a href=\"$self?page=$page\">[Next]</a> "; $last = " <a href=\"$self?page=$maxPage\">[Last Page]</a> "; } else { $next = ' [Next] '; // we're on the last page, don't enable 'next' link $last = ' [Last Page] '; // nor 'last page' link } // print the page navigation link echo $first . $prev . " Showing page <strong>$pageNum</strong> of <strong>$maxPage</strong> pages " . $next . $last; ?> echo "</p>"; ?> </div> </div> <div class="right"> <div class="navigation">Menu:</div><?php $navop = mysql_fetch_array(mysql_query("SELECT * FROM sitenav")); ?><?php $navoplinks = mysql_fetch_array(mysql_query("SELECT * FROM sitenavlinks")); ?> <div class="nav-link"><a href="<?php echo $navoplinks['aa']; ?>"><?php echo $navop['a']; ?></a></div> <div class="nav-link"><a href="<?php echo $navoplinks['bb']; ?>"><?php echo $navop['b']; ?></a></div> <div class="nav-link"><a href="<?php echo $navoplinks['cc']; ?>"><?php echo $navop['c']; ?></a></div> <div class="nav-link"><a href="<?php echo $navoplinks['dd']; ?>"><?php echo $navop['d']; ?></a></div> <div class="nav-link"><a href="<?php echo $navoplinks['ee']; ?>"><?php echo $navop['e']; ?></a></div> <div class="nav-link"><a href="<?php echo $navoplinks['ff']; ?>"><?php echo $navop['f']; ?></a></div> <div class="nav-link"><a href="<?php echo $navoplinks['gg']; ?>"><?php echo $navop['g']; ?></a></div> <div class="nav-link"><a href="<?php echo $navoplinks['hh']; ?>"><?php echo $navop['h']; ?></a></div> <div class="nav-link"><a href="<?php echo $navoplinks['ii']; ?>"><?php echo $navop['i']; ?></a></div> <div class="nav-link"><a href="<?php echo $navoplinks['jj']; ?>"><?php echo $navop['j']; ?></a></div> </div> </div> </div> <div class="footer"> <?php echo $settings['footer']; ?> </div> </div> <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> var pageTracker = _gat._getTracker("UA-3718570-1"); pageTracker._initData(); pageTracker._trackPageview(); </script> </body> </html> <?php require("../inc/closedb.php"); } ?> Link to comment https://forums.phpfreaks.com/topic/95899-mysql-syntax-error/#findComment-490973 Share on other sites More sharing options...
rofl90 Posted March 13, 2008 Author Share Posted March 13, 2008 I don't know why its going diagonally Link to comment https://forums.phpfreaks.com/topic/95899-mysql-syntax-error/#findComment-491002 Share on other sites More sharing options...
rofl90 Posted March 13, 2008 Author Share Posted March 13, 2008 Also its doubled, so theres I mean check ti @ http://www.codeetech.com/go/portfolio you can see the overlap Link to comment https://forums.phpfreaks.com/topic/95899-mysql-syntax-error/#findComment-491016 Share on other sites More sharing options...
trq Posted March 13, 2008 Share Posted March 13, 2008 Have you got new question? You haven't described your problem. Link to comment https://forums.phpfreaks.com/topic/95899-mysql-syntax-error/#findComment-491025 Share on other sites More sharing options...
rofl90 Posted March 13, 2008 Author Share Posted March 13, 2008 It should display <hr> Thumbnail, well not now because of its not uploaded details Client name links | links and it should loop that but only for 5 each page, and then it should page it for pages, eg 1, 2, 3 linking... Link to comment https://forums.phpfreaks.com/topic/95899-mysql-syntax-error/#findComment-491026 Share on other sites More sharing options...
rofl90 Posted March 13, 2008 Author Share Posted March 13, 2008 Fixed Link to comment https://forums.phpfreaks.com/topic/95899-mysql-syntax-error/#findComment-491035 Share on other sites More sharing options...
derrick1123 Posted March 13, 2008 Share Posted March 13, 2008 I like the design on your site ^.^ Link to comment https://forums.phpfreaks.com/topic/95899-mysql-syntax-error/#findComment-491038 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.