Jump to content

madcrazy1

Members
  • Posts

    48
  • Joined

  • Last visited

    Never

Everything posted by madcrazy1

  1. I need to order by row parameter then by another row parameter then finally order these results by DESC is it possible? one row called "animaltype" holds one of 5 variables either:(tiger,owl,whale,monkey,dog) Another row holds one of 5 other variables either: (blue,black,orange,pink,gold) the last row holds the "id" which tells desc to order by "time" or "date" i want to run a query to bring back a result of:\ only blue owls in descending order by their "id" please cobstruct this ORDER Statement for me. Many Thanks
  2. hi i cant get the javascript to work inside echo. i need the window to pop up. echo ("<a href='.$zeb.' onclick=\"window.open('.$zeb.','popup','width=440,height=290,left=165,top=140'); return false\"><img src='.$ICON.' border='0'></a>"); thanks!
  3. novice here-not sure how thats supposed to fit in with the code above. thx
  4. hi, how can i replace the ampersand with & before it gets stored in the database. i have an existing function the actually strips the script tags, can something be added to this bit of code to get this accomplished? <?php function escape_string($string) { return get_magic_quotes_gpc()?mysql_real_escape_string(stripslashes($string)):mysql_real_escape_string($string); } function html2txt($document){ $search = array('@<script[^>]*?>.*?</script>@si'); $text = preg_replace($search, '', $document); return $text; } ?> thank you
  5. I tried them and they said they have limited php knowledge, they gave me this code, it works but a seach engine spider sees it as not found. help please. $requested = ereg_replace("/", '', $_SERVER['REQUEST_URI']); $RunThisQuery = "SELECT username, userid from frm_users where username = '$requested'"; $result = $connector->query($RunThisQuery); if ($connector->fetchNumResult($result) > 0) { $RunThisQuery = "SELECT username, userid from frm_users where username = '$requested'"; $result = $connector->query($RunThisQuery); while ( $row = $connector->fetchArray($result) ) { $_GET['id'] = $_REQUEST['id'] = $id = $row['userid']; } include('/var/www/html/biz/blog.php'); } else { header('Location: http://' . getenv('HTTP_HOST') . '/browse.php', true, 301); }
  6. i tried &amp; but this only delays the problem. one edit returns & second edit returns & 3rd edit returns feed error
  7. a user types the ambersand into text field as & the xml page gets updated correctly because the ambersand symbol is correctly formatted in the sql database as & but when user makes a request for that information, it returns the ambersand as a regular ambersand so when user clicks submit again the ambersand gets sent to the database as & and consequently outputs an error to the xml page. I need to know how to return the ambersand from the sql database so it echos & and NOT & thank you
  8. Hi, I have a php script that redirects the url input into the address bar by a surfer user types in address bar: mysite.com/usersite user gets to user site but the address bar now shows the redict url mysite.com/redir?usersiteid=389 this is the bit -o- code : header("Location: http://" . $_SERVER['HTTP_HOST'] . "/redir?usersite=$usersiteid"); } else { header("Location: http://" . $_SERVER['HTTP_HOST'] . "/infoseek.php");[ /code] what i want to happen is: the address bar keeps what the user types in and not the redirect url help please
  9. OK,Igave it a shot,will this work, if not whats wrong with it? $RunThisQuery = "SELECT post1, post1a, post2, post2a, post3, post3a, post4, post4a, post5, post5a, post6, post6a, post7, post7a, post8, post8a, post9, post9a, post10, post10a, post11, post11a, post12, post12a, post13, post13a, post14, post14a, post15, post15a FROM frm_blog WHERE userid=".$_REQUEST['id']." LIMIT 1"; $results = $connector->query($RunThisQuery); $num=mysql_numrows($result); $i=0 + 1; while ($row = $connector->fetchArray($results)){ while ($i < $num) { $blog_comments = htmlentities($row['post,$i,a']); $xml_item .= "<item>\n"; $xml_item .= "<title>".$row['post,$i']."</title>\n"; $xml_item .= "<description>$blog_comments</description>\n"; $xml_item .= "</item>\n"; $i++; } }
  10. Exactly, i tried making it work before, and had no success, but now with the way the query is set up i might be able to display an extra input field. you think that would work? anyway back to the math problem i think i may have gotten lucky when i named the rows. they happen to be in perfect numerical order. I need to output an rss feed with this data. but i am unsure how to run a counter loop inside the query. Please help. $RunThisQuery = "SELECT post1, post1a, post2, post2a, post3, post3a, post4, post4a, post5, post5a, post6, post6a, post7, post7a, post8, post8a, post9, post9a, post10, post10a, post11, post11a, post12, post12a, post13, post13a, post14, post14a, post15, post15a FROM frm_blog WHERE userid=".$_REQUEST['id']." LIMIT 1"; $results = $connector->query($RunThisQuery); while ($row = $connector->fetchArray($results)){ $blog_comments = htmlentities($row['post1a']); $xml_item .= "<item>\n"; $xml_item .= "<title>".$row['post1']."</title>\n"; $xml_item .= "<description>$blog_comments</description>\n"; //$xml_item .= "<comments>$feed_link</comments>\n"; $xml_item .= "<pubDate>".$row['date']."</pubDate>\n"; $xml_item .= "<link>$absurl"; $xml_item .= "#".$row['id']."</link>\n"; $xml_item .= "</item>\n"; i need it to count two fields from 1 to just 15. titles are post1 comments are post 1a (with the letters after) is it something like this? ".$row['post1.1[+1]']. ".$row['post1.1[+1][a]']. can i put the correct expressions before this line? $blog_comments = htmlentities($row['post1a']); i am not sure why its there anyhow, but i am pretty sure i wont be able to count using just $blog_comments Thanks again
  11. I ended up adding 20 more rows that produces 20 editable fields (not hidden)and used update. did the trick. although limiting, its not really. for the majority of users. i was looking for something like i++ because i wanted these fields to be user orderable, but they are fully editable close enough. unless you can tell me how to create a seperate row that will hold a value from 1 to 20 then let the user order these by having a 2 digit field that the user could reverse the order displayed, based on putting 20 in the text field for box 1 19 for box 2 etc.. any ideas? if not thx for the help anyway
  12. ok so is a badge but security wears them right? haha anyway, i need to get this problem solved. how can you say hidden fields are poor security when you dont even know how the script is put together? hidden filelds inside a user session? how can a malacious user benefit from a hidden field that only works on a few int(s) inside a session? or are you saying that the hidden field itself could have a script run in it? that would be an SQL design problem, don't you think? all i am trying to do is have x user be able to edit y data output from a row based on z id get it?
  13. thanks for the reply, sounds like good info. Something i thought i needed to do but i am not good at math ??? I want to use the hidden fields idea because i am pretty certain i wont have hacking problems. in fact i think i will have to use these anyway because the data is fetched via a sql select statement then populated with value="<? if(isset($Blog1)){print $Blog1;} ?>" the variables connected to the db. a users output could 10 of these fields another users could be 100 fields. There is a row called 'id' that generates a unique id for every field. can i use this variable row? if so can you give me an example?
  14. before the user submits the form, the user is presented with say 20 editable form fileds each with different titles. the page the user is on, is supposed to allow the user to edit any title in any one of the text fields. when a user edits a text field and clicks submit. all the titles get changed instead of just the one they clicked submit on. the query is reading all identities for the user and making the same edit to all the titles. I need to have a variable somewhere in the form that the query can read so it knows which field to make the edit to. <form method="post" action="index.php"> <input type="hidden" value="[b]posts3[/b]"> [b]example: this is 1 form field of 20 each having diffent titles:[/b] [code]<input type="text" name="p1" value="<? if(isset($Blog1)){print $Title;} ?>" style="width:100%"> <input type="submit" value="Submit" class="button"> </form> here is the Sql query: [b]case "posts3"[/b]: { @mysql_query("UPDATE my_posts SET title='".$_POST['p1']."', date='$today_date', time='$today_time' WHERE `id` ='[b]IDENTITY[/b]'"); [/code]
  15. $query_add="UPDATE `frm_blog_posts` SET fOrder='".$_POST['p3a']."' WHERE `id`=". $row['id']." and userid =".$_SESSION['logid']; THIS IS WHAT I DID BEFORE I SAW YOUR LAST POST. can you rewrite this with primary key in the where clause. i am not sure how to do it. i just put $row['id'] in it. Thanks
  16. The trouble i am having is when the user submits the form the column id is automatically incremented and not being edited directly, thus giving a somewhat duplicate result. the column id needs to be set as auto inc because there are other users ???
  17. i tried that, but it updated all the columns with the same title. i need it to just update one column for the user not all the users columns in that same row i already tried this: ############################################################################################################################################### $query_add="UPDATE `frm_blog_posts` SET title='".$_POST['p1a']."' WHERE `userid` =".$_SESSION['logid']; ##################################################################################################################################### i tried substituting session id with column id also with no luck
  18. I have a script that produces a text field with contents of say row8 based on a user columnid when i edit the row contents and click submit, it produces another columnid example: what user sees after clicking submit in quotes userid300 row8 column id28: "This is the text content of column28 in row8" userid300 row8 column id29: "This is the edited text content of column28 in row8" see the column id29? i dont want it, i want the edited info to appear in column id28 to replace it in other words ((I just want row8id28 edited without creating a new rowid)) this is what i am working with: <u>This is the code that produces a user friendly text box to edit the row</u> $RunThisQuery = "SELECT id, title, comments FROM frm_blog_posts WHERE userid=".$_SESSION['logid']." order by id limit 100"; $results = $connector->query($RunThisQuery); while ($row = $connector->fetchArray($results)){ $Blog1= $row['title']; $Blog1a= $row['comments']; $Blog4= $row['id']; <form method="post" action="getindex.php" > <input type="hidden" name="do" value="posts2"> <td><strong>Title</strong><br><input name="p1a" type="text" id="p1a" value="<? if(isset($Blog1)){print $Blog1;} ?>" style="width:85%"></td></tr><tr> <td><strong>Entry</strong><br><input name="p2a" type="text" id="p2a" value="<? if(isset($Blog1)){print $Blog1a;} ?>" style="width:100%"><br></strong><input type="submit" name="Submit" value="Submit" class="button"></form></td> </tr> <? } ?> <u>This is the function that works on the user submitted data</u> $query_add="INSERT INTO `frm_blog_posts` ( `userid` , `title` , `comments` , `date` , `time` ) VALUES ('".$_SESSION['logid']."', '$p1a', '$p2a', '$today_date', '$today_time')"; $result=mysql_query($query_add); $_REQUEST['page'] = "posts2"; $ErrorMessage = "posts updated successfully"; I tried using: REPLACE INTO and UPDATE `frm_blog_posts` SET But could not get these to work for me. Please help. Thanks
  19. Hi, I am trying to control how many times a user can insert the same info I can control output using select distinct but if the user accidentally or intentionally repeatedly kept inserting the same info, that user would have to click the delete button that many times to get rid of it, istead of just once. this is the bit of code i tried adding if not exists to without any luck. ## ADD NEW ENTRY INTO THE DATABASE $query_add="INSERT INTO `files3` (`logid` , `name` , `bigimage` ) VALUES ('".$_SESSION['logid']."', '$l1', '$l2')"; $result=mysql_query($query_add); $_REQUEST['page'] = "links"; $ErrorMessage = "link updated successfully"; }break; Please help Thank you.
×
×
  • 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.