You are here: Re: UPDATE and increment by 10 « PHP Programming Language « IT news, forums, messages
Re: UPDATE and increment by 10

Posted by Jerry Stuckle on 12/16/76 11:57

version2 wrote:
> Jerry you are the only one so far to understand,
>
> And i do think this is a good idea.
>
> I have implemented the code but there was an error with
> "mysql_fetch_result"
>
> here is the current setup. Could you have a look and tell me what i am
> doing wrong
>
> index.php
>
> $HTMLOutput .= "<tr>
> <td align=\"center\">".$record[exerciseName]."</td>
> <td align=\"center\"><a href =
> 'item_position.php?action=moveup&ID=".$record[ID]."&muscleName=".$record[ArtistType]."'>move
> up</a>".$record[position]."</td>
> </tr>";
>
>
> item_position.php
> <?
>
> if ($_GET["action"] == "moveup") {
>
> $muscleName=$_GET['muscleName'];
> $ID = $_GET["ID"];
> $rank = 10;
>
> //this is where i am adding in the 15
> $phase1 = "UPDATE ".DB_PREFIX."".TBL_PREFIX." SET position = position +
> 15 WHERE ID = $ID;";
> //this is where i am calling the $phase1 to run
> mysql_query($phase1);
>
>
> //this is your code i am tring to implement
> $result1 = mysql_query("SELECT id, position FROM
> ".DB_PREFIX."".TBL_PREFIX." ORDER BY position");
>
> while ($data = mysql_fetch_result($result1)) {
> $result2 = mysql_query("UPDATE ".DB_PREFIX."".TBL_PREFIX." SET
> position=$position WHERE id = {$data['id']}");
> $rank += 10;
> }
> header("Location: index.php");
> exit;
>
> }
>
> ?>
>

OK, what error do you get?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация