-
Posts
16,734 -
Joined
-
Last visited
-
Days Won
9
Everything posted by PFMaBiSmAd
-
http://dev.mysql.com/doc/refman/5.0/en/time-zone-support.html Unless you have root access to change the system_time_zone or global time_zone, you would need to set the Per-connection time zone using a query in your script before you execute any queries that are time zone dependent.
-
The behavior is controlled by the strict mode settings - http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html
-
http://www.phpfreaks.com/forums/index.php/topic,280549.0.html
-
You are asking it to check the result of an assignment statement.
-
The parameter that mysql_affected_rows() takes is a link identifier, not the value that mysql_query() returns. The value returned by a INSERT/UPDATE/DELETE query is just a TRUE (the query executed without any errors) or FALSE (the query failed to execute because of an error, like a syntax error or a problem with the database) value anyway. You can have a case (depends on the mysql server configuration or the use of the IGNORE keyword) where an INSERT query executes without error but the row will not be inserted.
-
You do understand that the $_SESSION variables are only present on the server? Only the session id (usually via a cookie) that identifies the corresponding session data is in the hands of the client.
-
You already have a thread for this problem. Don't start another one.
-
Time in the format 00:00:00 is a mixed number base and you cannot directly do any math on it. You need to convert it into a single number base (i.e. seconds) in order to do math on the value, then convert it back to a time format. See the mysql TIME_TO_SEC() and SEC_TO_TIME() functions.
-
Programming requires a great amount of inference ( http://en.wikipedia.org/wiki/Inference ). Here is the code from the readfile() example, with only those things which I wrote above that are needed (content-type header and readfile() function) - <?php $file = 'your_file.jpg'; if (file_exists($file)) { header('Content-Type: application/octet-stream'); readfile($file); } ?> Here is the content-type header that matches your file type from the imagecreatefromjpeg/imagejpeg example (what your existing code seems to be based on) in the php manual - header('Content-Type: image/jpeg'); Inferred code - <?php $file = 'your_file.jpg'; if (file_exists($file)) { header('Content-Type: image/jpeg'); readfile($file); } ?> You would of course need to add the logic to get the proper file name and path to where the files are actually located into the $file variable.
-
http://dev.mysql.com/doc/refman/5.0/en/cast-functions.html
-
foreach ($_POST as $key => $val) { $key = mysql_real_escape_string($val); } I'm going to guess that your form is invalid in some way and is not sending the expected data.
-
So, did your query (which you did not bother to post) select the columns in the order in which your code is expecting them? You have not exactly provided any specific information in your post that would allow someone to help you with what you are doing.
-
if (!$res) The above conditional test only checks if the query was executed without error. It does not test if any row(s) were actually updated. You need to use mysql_affected_rows to find out if the UPDATE query actually changed a row. However, if the row is not being updated, that would imply that the WHERE condition did not match any rows in your table. Have you checked what $match actually contains so that you know the query should find a row in your table? mysql_query(), for your SELECT query, returns a result resource (if the query executes without any errors.) You need to use one of the mysql_fetch_xxxx() functions to actually get a row from the result set. If you were developing and debugging your code on a system with error_reporting set to E_ALL and display_errors set to ON, you would have received error messages when you referenced $checkresult[match_date], $checkresult[Opposition], ... that would have alerted you to the fact that they don't exist as part of the $checkresult variable.
-
Don't use the GD functions to simply read and output an image. That will take up a huge amount of unnecessary server resources. You also need to output the correct content-type header before you output the image data. To do what you are trying (use a php script to output your images that are stored in a location that will not accept direct http requests) all you need to do is output the correct content-type header, then read and output the actual image file. The readfile function is normally used to read and output a file.
-
From the include() page of the php manual -
-
The query that is failing is the last one because you are reusing the $music variable in one of the earlier queries, so when you put $music into the last query it actually contains a whole query statement, not the contents from the form field. I recommend always building your query statement in a variable named $query (there is no need to make up a different variable name for each independent query.)
-
Everything you posted that is before the first opening <?php tag and after the last closing ?> tag is the offending content. When you output an image (the content-type header followed by the image data) you cannot output anything else. To output an image on a web page you must put the URL of the image into an <img src="..." alt=""> tag - http://w3schools.com/html/html_images.asp For the case were you are dynamically producing the image using GD functions, the URL you put into the src="..." attribute is the URL of your .php file that contains the GD code.
-
Read the error - Your file is outputting some content at or before line 10 in the file. You cannot output anything but another header before a header() statement. You would need to find and eliminate whatever is causing the output that is occurring before the header() statement. You would would need to post the full file if you want anyone in the forum to help find what the offending content is.
-
passing a variable to the url in with the serialize function
PFMaBiSmAd replied to co.ador's topic in PHP Coding Help
Another member is current fighting problems with a book/tutorial where ALL the results (both expected and errors) that are produced on a page are being passed on the end of the URL to a page where those results are used, rather than just making the page where the results are produced be the same page where the results are finally used. Too many people redirect all over the place, which just makes their site slower (each redirect is another HTTP request from the browser) and results in writing and testing more code. If you are making a real application (not just something for a programming class) you need to make the form and the form processing page be the same page. You will note that every page on this Forum is index.php with the parameters on the end of the URL defining what the page should do, not what data is on the page. -
The only way the posted query statement could produce the posted error is if $rock contains a single-quote or something else that would break the syntax of the query statement. Echo the $music variable to see exactly what is in it. Best guess is that your code between where you set $rock and where you put it into the query statement is screwing up the value in it.
-
The only known ways of getting the MAC address is if you install a 'helper' application on the client. Either an Active X Object (which is essentially what ym_chaitu posted) or a Java applet (not to be confused with Javascript) (requires the Java VM to be installed on the client as well in order to run the Java applet.) Why exactly do you need a fool proof unique identifier, because you cannot install own application that you create to do this, an Active X Object, or a Java applet/Java VM on a client without their interaction and approval.
-
php.ini SMTP setting ignored
PFMaBiSmAd replied to jamesm6162's topic in PHP Installation and Configuration
What exact method did you use to install PHP? The .zip package, the .msi installer package, or one of the all in one xAMP packages? I'm going to guess the .msi installer? If so, please be advised that the .msi installer is retarded, should not be used by anyone, and it places a bunch of setting in the Windows registry that override the php.ini settings. -
Where on your web server did you find the c99 scripts? Where they only in the folder you are putting uploaded files in? What exact file names did they have? Here is another recent thread on the c99 script - http://www.phpfreaks.com/forums/index.php/topic,270592.0.html It was discovered that some combinations of operating system/web server (I suspect primarily when php is running as an Apache module, not enough specific information was posted in that thread to definitively identify which) cause file names such as c99.php.ext, where ext is an extension that your upload script allows, to be parsed as php code when requested. The best protection is to disable the php engine for the upload destination folder.