Jump to content

hitman6003

Members
  • Posts

    1,807
  • Joined

  • Last visited

Everything posted by hitman6003

  1. Look at this block of code: [code]if(($totalrows - ($limit * $page)) > 0){         $pagenext = $page++;         echo '&nbsp;&nbsp;&nbsp;<a href="ourfamily.php&page=$pagenext">NEXT" . $limit . "</a>';     }else{         echo '&nbsp;&nbsp;&nbsp;NEXT' . $limit;     }[/code] Particularly, this line: echo '&nbsp;&nbsp;&nbsp;<a href="ourfamily.php&page=$pagenext">NEXT" . $limit . "</a>'; You are not escaping the single quotes to have the value of the variable inserted.  Change that line to be: echo '&nbsp;&nbsp;&nbsp;<a href="ourfamily.php&page=' . $pagenext . '">NEXT ' . $limit . '</a>'; And, looking again at your code, you are doing it with the similar blocks of code above that.  Make sure you change all fo them so that you are not trying to insert a variable while it is inside of the single quotes. Remember, single quotes means php will print EXACTLY what is there, double quotes it will substitute variable values for the variable.
  2. You really should use css and class declarations for all of your formatting rather than repeating the same stuff over and over...it makes it difficult to read. Anyway, what you want to do is: <a href="javascript: newWindow('http://www.mysite.com/contact.php?description={urlencode($story['description'])}')"> Then on your contact.php page, use: echo urldecode($_GET['description']); Remember that there is a limit to how much data can be passed in the url, so if the descriptions are long, you may not be able to do this.
  3. How are you tracking the number of votes for each article?  By incrementing a value in a field?  If you are, you shouldn't be.  The best way to do what you want, and this is simplified, is to have three tables: 1.  The table containing your users(tbl_user), including a user id 2.  The table containing the articles(tbl_article), including an article id 3.  A table containing votes(tbl_votes)...it only needs three fields...vote id, article id, and user id. When a user votes for an article, obviously insert the article id and the user id into tbl_votes. To determine if a user has previously voted for an article: SELECT COUNT(user_id) FROM tbl_votes WHERE article_id = '$id_of_article' To determine the number of votes for a particular article use sql similar to: SELECT SUM(vote_id) FROM tbl_votes WHERE article_id = '$id_of_article'
  4. What your asking doesn't really make sense.  Please clarify. Unless you are using a Microsoft server and can use COM there is no want to output a .xls file.  However, you can output a comma delimited file (CSV) that will open in Excel without COM.
  5. Double check how you have typed each instance of $_SESSION...in your post you typed it three different ways.  Also, make sure that session_start(); is at the top of your page. If you are sure that you are always using $_SESSION and that session_start(); is at the top of your page, then echo your sql statement to see what it looks like.  It may be an error in the configuration of your db field, among many other things... Make sure that you have "or die(mysql_error())" on the end of your "mysql_query" line too.  If you don't have that then you won't know if there are any errors.
  6. See if this helps: [code]<?php require_once('../../Connections/Punks_conn.php'); ?> <html> <head> <title>form variable insert</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php $name = $_POST['Firstname']; $surname = $_POST['Surname']; $group = $_POST['Group']; //folder creation using chmod change in permissions to 777 $file_dir = "../test7/uploads/"; if (!file_exists($file_dir)) { mkdir( $file_dir ); chmod( $file_dir, 0777 ); } $i = 0; foreach ($_FILES as $file_name => $file_array) {     echo "path: ".$file_array['tmp_name']."<br>\n";     echo "name: ".$file_array['name']."<br>\n";     echo "type: ".$file_array['type']."<br>\n";     echo "size: ".$file_array['size']."<br>\n";     if (is_uploaded_file($file_array['tmp_name'])) {         move_uploaded_file($file_array['tmp_name'], "$file_dir/$file_array[name]") or echo ("Couldn't copy!!<br><br>");         echo "file was uploaded!<br><br>";     } $photo{$i} = $file_array['name']; } mysql_select_db($database_Punks_conn, $Punks_conn); $sql = "INSERT INTO punks (FirstName, Surname, `Group`, Photo1, Photo2,Photo3,Photo4 ) VALUES ('$name','$surname','$group', '$photo1', '$photo2','$photo3','$photo4')"; //execute the SQL Statement if (mysql_query($sql, $Punks_conn)) { echo "new listing created"; } else { echo "This one never made it"; } ?> </body> </html>[/code]
  7. Have an onclick that does [code]document.getElementById('idofthetextbox').value = document.getElementById('idofthetextbox').value * 5[/code]
  8. The size of the images doesn't change.  Even if you could do this, and I don't know of a good way of doing it, you shouldn't...especially if you are running a business...because search engines can't read the text that's in an image, so that text would never be indexed. There is an image at the top, then below that is a div for the text that has a background color the same as part of the image, then below that is another image.  It makes it look like it is all a single image, but it is infact two images with text inbetween them. On their particular page they are using quite a few more pictures in the layout to acheive the rounded corners and such as well. Do a "View Code" on their page and search for one of the news headings, then look at the code around it, you will be able to see how they did it.
  9. you are missing the closing curly brace on your while statement: [code]<?php $favmovies = array("Life of Brian","Stripes","Office Space","The Holy Grail", "Matrix", "Terminator 2", "Star Wars", "Close Encounters of the Third Kind", "Sixteen Candles", "Caddyshack"); if (isset($_REQUEST['favmovie'])) {     echo "Welcome to our site, ";     echo $_SESSION['username'];     echo "! <br>";     echo "My favorite movie is ";     echo $_REQUEST['favmovie'];     echo "<br>";     $movierate=5;     echo "My movie rating for this movie is: ";     echo $movierate; } else {     echo "My top ". $_POST["num"]. " movies are:<br>";     if (isset($_REQUEST['sorted'])) {         sort($favmovies);     }     //list the movies     $numlist = 1;     while ($numlist <= $_POST["num"]) {         echo $numlist;         echo ". ";         echo pos($favmovies);         next($favmovies);         echo "<br>\n";         $numlist = $numlist + 1;     } //this is the missing curly brace } ?> </BODY> </HTML>[/code]
  10. You need to enable the mysql extension in your php.ini file. Just remove the semi-colon from the beginning of the line.
  11. Your space is in the wrong place: $x .= "def"; The . and = should be "touching"
  12. html = [code]<input type="submit" name="confirm" value="Yes"> <input type="submit" name="confirm" value="No">[/code] php = [code]if ($_POST['confirm'] == "No") {   do something } else if ($_POST['confirm'] == "Yes") {   do something else }[/code]
  13. You could do something using a url like: www.whatever.com/number=2&function=square Then your php would be: [code]<?php $func = $_GET['function']; echo call_user_func($func, $_GET['number']); function square_number($number) {   $square= $number * $number;   return $square; } ?>[/code]
  14. Remove the <?php and ?> from the beginning and end of your file. Or, put an echo statement around all of your html. There is no php in there, but you have it wrapped in php tags.
  15. This should work for you. You can add in things like removing the http:// from the displayed link using str_replace and such if you want. You could also very easily create a function from this. [code]$url = "http://www.oneverylongurl.com/longlonglonglonglonglonglonglonglong.html"; //pick a number for the max length //15 is kind of short, but should get the point across $maxlength = 15; //the number of characters to be displayed from the //beginning of the url...should be less than $maxlength $beginning = 8; //number of chars from the end of the url $end = 7; if (strlen($url) > $maxlength) {     $link = "<a href=" . $url . ">" . substr($url, 0, $beginning) . "..." . substr($url, -$end, $end) . "</a>"; } else {     $link = "<a href=" . $url . ">" . $url . "</a>"; } echo $link;[/code]
  16. Do you mean a select box? or do you mean a html div or td? If it's the latter, then you can use css to set the width. If you are using a select box, then the width is determined by the length of the text inside of it.
  17. Rather than using a for loop, use a while loop, then you don't need the extra $num: [code] <?php $query = "SELECT * FROM table order by amount desc"; $result = mysql_query($query) or die (mysql_error()); $current_price = 0; echo '<table cellpadding="5" cellspacing="0">'; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {     if($row['amount'] != $current_price) {         echo "             <tr>                 <td>".$row['amount']."</td>             </tr>";         $current_price = $row['amount'];     }     echo "         <tr>             <td>".$row['text']."</td>         </tr>"; } echo "</table>"; ?> [/code] Also, why did you have a period (.) at the end of your echo lines, after the closing quote, but before the semicolon?
  18. notice how the line [code]var $functions;[/code] is in there twice.... Try removing one of them.
  19. Look at the source code in your browser...the newline is there, it just doesn't print them in the html display...either do: [code]echo "<pre>line one\nlinetwo";[/code] or [code]echo "line one <br> line two";[/code] New lines are not html and therefor unless the pre is around it, the browser will ignore them in the display.
  20. It's telling you that "/articles/" does not exist. Where in your file structure is the articles folder? If it is subdirectory of the folder you are running the script in, change it to "./articles/", or just "articles". Familiarize yourself with relative paths...that will help greatly... "./" means the current directory. "../" means the parent directory. "../../" means two directories above. And so on. Using "/articles/" is telling php that the folder is a subdirectory of the document root, if it is and the folder exists, check permissions on the folder.
  21. That is someone attempting to use your email system for malacious purposes. Do some research on email header injections and things of that nature: [a href=\"http://www.nyphp.org/phundamentals/email_header_injection.php\" target=\"_blank\"]http://www.nyphp.org/phundamentals/email_h...r_injection.php[/a] Google "php email header injection" (minus quotes) and things of that nature.
  22. [!--quoteo(post=359512:date=Mar 28 2006, 09:03 PM:name=kengi_ikazuchi)--][div class=\'quotetop\']QUOTE(kengi_ikazuchi @ Mar 28 2006, 09:03 PM) [snapback]359512[/snapback][/div][div class=\'quotemain\'][!--quotec--] The link is coming from foo.com. [/quote] No, the referral is coming from foo.com, the user is following a link on foo.com's webpage, and therefor it is still the user, and the user's ip, that are visiting foo.com. Use the file commands, cURL, or sockets to connect from server to server and retrieve the information you are needing. Either that or have some words with your SA, and have him/her/them give access to your entire subdomain.
  23. Echo out your full query so that you can see it. If you don't see the problem, post it for us.
  24. Look at the query your creating.... [code]mysql_query("select * from PROPERTY '".$where."';");[/code] and [code]schooldist = '$_SESSION[schooldist]' AND bedrooms = '$_SESSION[bedrooms]' AND baths = '$_SESSION[baths]'[/code] If you echo that out, you get something like: [!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']select[/span] * [color=green]from[/color] [color=orange]PROPERTY[/color] schooldist [color=orange]=[/color] [color=red]'somevalue'[/color] [color=blue]AND[/color] bedrooms [color=orange]=[/color] [color=red]'somevalue'[/color] [color=blue]AND[/color] baths [color=orange]=[/color] [color=red]'somevalue'[/color] [!--sql2--][/div][!--sql3--] What's missing from the above? (the WHERE) The easiest thing to do when you get that error, is add "or die(mysql_error())" to the end of your mysql_query line: [code]$result = mysql_query("select * from PROPERTY '".$where) or die(mysql_error());[/code]
  25. Yes, it's possible, but I wouldn't recommend it. Use a WHERE clause to limit the mysql return to only what you want, then use a join, left or right depending, to retrieve all of the information in one query.
×
×
  • 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.