Jump to content

Err

Members
  • Posts

    1,009
  • Joined

  • Last visited

Everything posted by Err

  1. No problem. Using arrays sure beats doing "$username1", "$username2", etc...http://www.w3schools.com/php/func_array.asp
  2. They are in their own variables already. You can call a specific username by simply calling out which key it is assigned to in the array. echo $username[1]; Change the 1 to another number until you get the username you are trying to get to.
  3. Put it in an array. // variable i starts with the number 0$i = 0;// initialize username array which will hold all usernames$username = array();while($row = mysql_fetch_array($result)) { echo $row[0],"<br />\n"; // assign the username into the array $username[$i] = $row[3]; // add 1 to i with each loop, this makes sure your assigning incrementing keys to your username array $i++;} Once you have all the usernames in an array, you can call them out. foreach ($username as $key => $val) { echo $val;}
  4. What if you want your content to expand past 800 pixels? width:800px will limit the width, but min-width will allow the minimum width to be 800 and allows it expand past that.
  5. Err

    Adding data...

    Remove the outer-most single quotes around '$_COOKIE['authenticate']'
  6. There is, add this code in the <table> style: border-collapse: collapse;It removes the spacing from the invisible table borders which should get you closer to the top.
  7. The dots or periods are for classes, the # is for id's. The way you are using the CSS there... even if you changed it to id's it still won't work because you are saying that the id is in the link (<a href="#" id="ankare">)However, for your CSS, #ankare a:link will work because it's calling the id, then the link.
  8. Instead of adding an extra line to space out your text, you can add a spacer, so instead of this: <span style="font-size:14px; color:#FFFFFF; ">-</span><br/> You can do this: <div style="height:30px;"></div> You can then change the height to whatever you think looks good.Also, you incorrectly used the width attribute on your middle cell. It should be width="15" or style="width:15px;"
  9. By 'colon' you mean 'column', right? Not sure why the text isn't aligning to the right but it may have to do with all the CSS mess you have there. Some of that CSS is not even needed. If you were aiming to put this in a signature I don't think you can use CSS the way you were using it here. You can use inline styles (style="") to get around that. I know you are just a beginner on this but you have a lot of code you don't need. I took 5min to do the same thing you were doing using less code. Compare this with your code to figure out what was not needed. <table style="width:350px; font-size:12px; color:#808080; font-family:Arial; border-top:1px solid gray; border-bottom:1px solid gray;"> <tr> <td style="font-size:19px; text-align:right;"> Prenom Nom<br /> <span style="font-size:12px;">Fonction</span><br /> <p style="color:black; font-weight:bold;">Societe</p> </td> <td style="vertical-align:middle;"> Tel: +00 00 00 00<br /> Fax: +00 00 00 00<br /> Mobile: +00 00 00 00<br /> Email: <a href="#" style="text-decoration:none; border-bottom:1px dotted gray; color:gray;">Prenom.Nom@societe.com</a><br /> Site: <a href="#" style="text-decoration:none; border-bottom:1px dotted gray; color:gray;">www.societe.be</a> </td> </tr></table>
  10. Newest first: ORDER BY date ASC Oldest first: ORDER BY date DESC
  11. Err

    ul link style HELP!

    You have your unordered list setup wrong. You have a parent <li> and it's direct child is another <li>.You have it: <ul> <li> <li> ... etc.It should be: <ul> <li> <ul> <li> ... etc.
  12. Actually, that is a surprise. I've never even heard that IE had that ability.
  13. Err

    Backslash

    What boen_robot is saying is: when you are sending data to a database you should escape it. mysql_real_escape_string() is a PHP function that automatically escapes the data for you. It will add backslashes to everything in your data that needs it. In his above example he escaped all the data except the IP address. I would suggest reading on how exactly this function works by clicking on boen_robot's link.
  14. I usually indent child elements with two spaces. It makes the indention stand out more.When I work with PHP generated code I try my best to go with the flow of the indention of the source code. I usually do the below format to keep my indentions consistent. Doing this also helps me spot the generated HTML code faster and is visually easier to read. $txt .= "<table>\n". " <tr>\n". " <td></td>\n". " </tr>\n". "</table>\n";
  15. We need to see the links then.
  16. Err

    Query messages?

    If you want your data to last more than 2 pages (back and forth included), you will need sessions or may use the GET method. However those methods aren't very effective for what you're trying to do. Have you tried to validate your data on the same page where the form is? Basically, if you put the code of RegisterClient.php inside of Register_Form.php you can resolve this issue.
  17. Err

    Query messages?

    I'm confused. You said you want the error message in a different page, yet later on you say you want them on the same page.At any rate, you just need to use a variable and add on error messages that way. Once your done, just echo out the variable wherever you want the error message to appear. // initializes $err with a empty string.$err = "";// assign error messages to $errif ($a != 1) {$err .= "Variable A is not equal to one. <br />";}if ($b != 2) {$err .= "Variable B is not equal to two. <br />";}// display your error messagesecho $err; Personally, I use an error function. It allows me to format the error message with red/green colors and proper spacing before they are assigned to the variable.
  18. Thank you! With a bit a tweaking I got it to display in the correct order. But there is a problem, the only reason I was using GROUP BY there was to filter out the repeats. When I run this query I get 462 results, I'm only suppose to get 83 (the number of total topics), how can I keep the latest date for only one topic id each? SELECT top.*, com.*FROM blog_topic AS topINNER JOIN blog_comments AS comON top.blog_topic_id = com.blog_topic_idWHERE com.comment_datetime > top.blog_datetimeORDER BY com.comment_datetime DESC, top.blog_datetime DESC
  19. I have two tables. One for topic titles with dates, another one for topic comments with dates. I want to list the topic with the most recent comment first. Much like how the forums here work, where a thread bumps up after a user posts in it even though the thread might be old.Here is what I have so far: SELECT top.*, com.*FROM blog_topic AS top, blog_comments AS comWHERE com.comment_datetime > top.blog_datetimeGROUP BY top.blog_datetimeORDER BY com.comment_datetime, top.blog_datetimeASC I haven't had any luck with this. I could use some help.Here is an example of what I'm working with.Table: blog_topic blog_topic_id blog_title blog_info blog_datetime 208 Title Example description of title. 2010-05-10 12:24:48 Table: blog_comments blog_comments_id blog_topic_id comment comment_datetime1 208 Example comment. 2010-05-19 11:52:56
  20. I personally would like to know what approach you took. Even though I'm not creating anything like what you're doing, it seems like something notable.
  21. Are you escaping your data? Things like quotation marks inside the data can cut it and do a lot of crazy things.
  22. Functions are easy to use. It's plug-n-play really. Once you have a function all you have to do is call it. $old_str = "a string with lots of spaces.";$new_str = TrimStr($old_str);
  23. If you are interested in trimming inner spaces, I use this handy function which has worked great for me. function TrimStr($str) { $str = trim($str); $ret_str = ""; for ($i = 0; $i < strlen($str); $i++) { if (substr($str,$i,1) != " ") {$ret_str .= trim(substr($str,$i,1));} else { while (substr($str,$i,1) == " ") {$i++;} $ret_str .= " "; $i--; } } return $ret_str; }
  24. Err

    error checking

    if (strlen($_POST['password1']) < 6 && strlen($_POST['password1']) > 16) This above line should not have an OR operator. You wanted AND. $password = mysql_escape_string($_POST['password']); You are sure you don't mean "password1" or "password2"?
  25. Err

    error checking

    Please post your code.
×
×
  • Create New...