Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. The 4th parameter of mysql_connect() is NOT the database name. You must have a separate mysql_select_db() function call or specify the database name in your query along with the table name.
  2. For the second method, you would not need to store the three values separately, you could for example use str_split() to break the 6 hex digits into the three sets of two.
  3. You could also create a dummy zero'th element, then remove it after the other elements have been added.
  4. No it's not, or you would not be getting that error message. Just because you have an include_once() statement that is supposed to cause your connection code to be executed, does not mean that it did. What's your code in connect_to_mysql.php, because it is relevant to the problem as well. xxxxx out any connection details, but otherwise post the while content of the file, including the opening php tag.
  5. The error means that at the time or place in your code where you executed the mysql_query() statement, you did not have a valid connection to the mysql server. You would need to troubleshoot why your code did not have a mysql connection at that time or place in your code. If you want someone on a forum to help find the problem, you would need to post your actual code.
  6. $_SERVER['SERVER_NAME'] is only 'localhost' Because the href= syntax that you are using is for a relative URL, the browser prepends the URL of the current page. You need to specify an absolute URL- <a href="<?php print 'http://' . $_SERVER['SERVER_NAME'] . '/index.php';?>">LINK TO SERVER'S HOME PAGE</a>
  7. LOL, similar code - main code - <img src="image.php" alt="" width="1000" height="1000"> image.php code - <?php $img = imagecreatetruecolor(1000,1000); $c[1] = imagecolorallocate($img,0xff,0xcc,0x00); $c[2] = imagecolorallocate($img,0xff,0xff,0x99); $c[3] = imagecolorallocate($img,0xcf,0xee,0xf6); $c[4] = imagecolorallocate($img,0xb2,0xeb,0xc5); $c[5] = imagecolorallocate($img,0xff,0xff,0xff); $c[6] = imagecolorallocate($img,0xd7,0xeb,0xff); $c[7] = imagecolorallocate($img,0xdf,0xce,0xb9); $c[8] = imagecolorallocate($img,0xb3,0xcc,0xc5); $x = 0; while ($x < 1000) { $y = 0; while ($y < 1000) { $number = rand(1,; //imagefilledrectangle(resource $image , int $x1 , int $y1 , int $x2 , int $y2 , int $color) imagefilledrectangle($img, $x, $y, $x + 5, $y + 5, $c[$number]); $y+=5; } $x+=5; } header ('Content-type: image/png'); imagepng($img); ?>
  8. Each image on a web page must use an <img src="..." alt=""> tag. The src attribute must be a URL that results in an image being output that the browser then receives and renders on the page in the correct location. You cannot directly output binary image data on a html web page. Since you would be dynamically generating one image or several images using php the URL that you put into the src attribute would be to a .php script that outputs the correct content-type header followed by the image data. If you are doing this for more than one image, you typically use a GET parameter on the end of the URL to indicate the correct image so that you can use the same .php file to generate all of the images. If you were using one 1000px x 1000 px image, you would first create a 'canvas' image that size, then merge each smaller 5 x 5 image onto that 'canvas' at the correct y and x coordinate. If you were using one image per row, you would first make a 1000 x 5 'canvas', then merge each of the 5 x 5 images that make up that row.
  9. What's the whole current code for the page? Given that the posted code is using $sql10, 11, and 12, you likely have a bunch of other queries on the page and at least one of them could be putting back in original text (from the form field or from the $row11[col_techcomments] variable) and overwriting the UPDATEed text. You could also put a die; statement in after the UPDATE query has been executed to see if the code is doing what it should.
  10. No one can help you with what is wrong with your code unless you post your code. 113 different people could have written your post above and there could be something different wrong with each of their code that they came up with to accomplish this but they all have the same symptom.
  11. Actually, that's not much of an example to show what you are trying to do. However, I'll guess that you want the latest row for each user. If so, see this link - http://dev.mysql.com/doc/refman/5.1/en/example-maximum-column-group-row.html
  12. What's the column definition for col_techcomments and what data do you already have in it (nothing printed at the point where the existing contents should have been when you posted the query that was being used to update it.) Edit: Also, what method or code are you using to display the data that leads you to believe it is not changing?
  13. You would need to use SUBSTRING_INDEX() to get the parts before and/or after the -. You would then order by those parts. Ref: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html#function_substring-index
  14. Given that your code is using mysqli_query() but it is using mysql_error(), it would be a little hard to get any actual error information. If you switch to use mysqli_error(mysqli $link) you can probably find out why the queries are failing.
  15. If you echo mysqli_error( mysqli $link ) it will tell you why your query failed. You should actually have error checking and error reporting logic in your application now that would already be telling you this.
  16. Your form is not setting a field named - 'mem_id' so it will be a little hard for the where clause in your query to match anything - ... WHERE mem_id='".$_POST['mem_id']."'"
  17. Nothing. How could you possibly tell if any particular visitor was just on the URL unless the visitor tells you that information when he makes the request to your page? Are you having problems with actual visitors or with a script making requests to your page? What real problem are you having, and 'I am trying to block a specific site from referring traffic.' is not a problem it is what you are attempting to do.
  18. No one can really help you without seeing the current code. You either added the name="..." attribute incorrectly or you did not bother to refresh your browser to incorporate the change into the html the browser is operating on.
  19. The only information you receive about any http request is what the browser (or script) supplies when it makes the http request to your site. If 'HTTP_REFERER' is not set, then there is nothing you can do because there is no information to base a comparison on.
  20. DISTINCT is not a function. It does not apply to a single column you select. It applies to all the columns you select. It simply removes duplicate rows from the result set. What exactly are you trying to do, please show an example of some data and the expected results.
  21. It's not a matter of hiding anything. A script or a browser must explicitly set the HTTP_REFERER header for it to even have a value. $_SERVER['HTTP_REFERER'] is an optional header. It can be present or not and it can be set to anything. For example, most of the web proxy scripts set it to match the domain being requested, so a request passing through such a proxy script would look like is is coming from someone who is already browsing pages on your site. What sort of problem are you having that you are trying to solve?
  22. Your <input type='submit' field does not have a name='...' attribute so $_POST['submit'] will never be set.
  23. There's something going on that you are not showing or telling us. Either that's not the actual code that exhibits the problem or your full code is doing something unusual or your data isn't what you are showing or implying.
  24. This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=305845.0
  25. You do realize that outputting a simple math problem as plain text on a web page is extremely easy for another computer to solve. It can be done using a simple eval() instruction in php. I would display the math problem as a dynamically generated image so that it would both be necessary for a computer to 'read' the image and then solve the math problem.
×
×
  • 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.