shaneg55
-
Posts
10 -
Joined
-
Last visited
Never
Posts posted by shaneg55
-
-
ok, and how do i re order the values after one is deleted? sortorder=1, 2, 3, 4, 5 etc. I remove the record with sortorder 3 now i need to re order the values so its sortorder = 1,2,3,4 etc not 1,2,4,5?
-
yes i could do $i ++ during the loop of the records but i want to keep the sort order which may change in tact. like if im listing 5 links under a parent link and i have defined them in the order that i want using a field but i remove say the record that is sort order #3 then i need to change so sort order for the links becomes 1,2,3,4 not 1,2,3,5 . How will a counter or even php know what order i want these links in? what if i add a link or change the order of them down the road. Dont i have to do it via mysql with an ORDER BY satement not with php as php will not know what order i want them in?
-
yeah. how was this comment helpful at all? Sorry to the almighty for not knowing all the rules or even finding the answer already posted (where?).
If i dont want to order the results with mysql by a field which contains the order show me how to do it in php then!
-
I posted this in mysql as well but maybe someone would know the php/mysql syntax to do this:
How to re order records after a delete or move?
I have table of navigational items. lets say under "about us" i have 5 sub links and i order them by a field called theorder. How can a re order them properly if one is deleted? orders are 1,2,3,4,5 and if i delete the record that is 3 then the order is 1,2,4,5 but i want it to now become 1,2,3,4. How do i do this properly?
Thanks
-
How to re order records after a delete or move?
I have table of navigational items. lets say under "about us" i have 5 sub links and i order them by a field called theorder. How can a re order them properly if one is deleted? orders are 1,2,3,4,5 and if i delete the record that is 3 then the order is 1,2,4,5 but i want it to now become 1,2,3,4. How do i do this properly?
Thanks
-
I have this html tag <navigation></navigation>. I want to find any and all references to <navigation></navigation>, retrieve the int value thats between the <navigation>3</navigation> (in this case the number 3), run an sql query and return a record where the id is the value between <navigation>3</navigation> (again in this case 3) and replace the entire tag with whatever was returned from the sql query.
note: there could be more than one navigation tag within my string. plus a bunch of other html. i want to keep all the other and find, build, and replace new text where the navigation tag is.
-
Still no thoughts on this from anyone?
-
I was thinking something more along the lines of this:
function getTextBetweenTags($string, $tagname, $lang) { $db = new Database(DB_SERVER, DB_USER, DB_PASS, DB_DATABASE); $db->connect(); $pattern = "/<$tagname ?.*>(.*)<\/$tagname>/"; preg_match($pattern, $string, $matches); $sql= "SELECT * FROM navigation, pages WHERE navigation.navigationID = '$matches[1]' AND navigation.pageID = pages.pageID"; $rows = $db->query($sql); while ($record = $db->fetch_array($rows)) { $newtext = "http://www.mydomain.com/".$lang."/".$record[navigationID]."/".str_replace(" ", "_", $record[linkname]); } return $newtext; } $str = '<p align="left">Go To This <a href="<navigation>3</navigation>">Page</a>.</p><p>This <a href="<navigation>4</navigation>">Page</a> is also good.</p>'; $txt = getTextBetweenTags($str, "navigation", "en"); echo $txt;
Which returns "http://mydomain.com/en/4/My_Link_Name"
I want it to return "Go To This Page. This Page is also good." With the words "Page" linked with the properly formatted url.
I think im missing incorporating an str_replace here somehow so i return the properly formatted urls and the rest of the string where applicable. Hope im making some sort of sense here.
-
how can i find reference to something like this "navigationID=3" or "navigationID=44" within a string and then re write it to become something like this "/en/content/3/Link_Name"?
there could be more than one reference within the string and the integer val (ie 3 and or 44) will not be known.
Any help with this would be greatly appreciated.
New Order After Delete
in MySQL Help
Posted
I apologize for posting in different boards (didn't know if this question would be best answered in mysql or php so i posted in both).
I posted in both prior to Fenway's offer to move so its not like i didnt take Fenway up on the offer and went out of my way to do it anyway.
I am still looking for an answer to this scenario if anyone is interested in posting.