-
Posts
5,448 -
Joined
-
Days Won
174
Everything posted by mac_gyver
-
it's likely that your code is being requested twice and you are seeing the output from the second execution, but since you didn't share what your data is and what you saw or what you expected to see from that data, this is just a guess. how about posting sample data in $currentrooms0 and what incorrect value you see when you echo $indexnum0 so that we have the same knowledge about what you saw in front of you?
-
phpmailer script isn't working since switching to another host
mac_gyver replied to btrp's topic in PHP Coding Help
i kind of thought the thread you started after this one was based on the input given in this thread. -
you changed the name of your submit button in the form, so the code if(isset($_POST['submit])) no longer works.
-
posting your code would be the quickest way of helping you find what it is doing that might be server specific. best guess is you got caught using php's short open tags <?
-
so, the posted code isn't the code that produces the error. the part you didn't post is what is producing the error. the posted code doesn't produce that error on the latest php5.4 version. you need to post the actual code that produces the error and posting the actual file name and line number from the error message would help those trying to help you.
-
Fatal error: Cannot redeclare mime_content_type()
mac_gyver replied to kostanza's topic in PHP Coding Help
your function name is the same as a php built in function. use a different name for your function. @PravinS, the back-tick syntax in php is used for executing an operating system shell command. -
what do you see that is wrong with the following lines from your code that might cause the update query to be executed two times? $result = mysql_query($query) or die(mysql_error()); if(mysql_query($query)){
-
generally, edit means to read, modify, update something, so the intent is probably for $edit_record to indicate that an update should be performed. however, i just looked closer at that code and it is using !(NOT)$edit_record to run the update logic. this would require that $edit_record evaluate to a false value (empty, not set, or a zero...) in order to run the update logic. so the question still is -
-
have you checked if the $edit_record variable in the following statement is a true value so that the update logic is even running - if (!$edit_record) { the update query logic is here ... } where in your code is the $edit_record variable being set to indicate that the update query logic should be executed? the only occurrence of $edit_record in the code is setting it to the string "no", but the string "no" is a true value and the update query logic would run. where did you find this code at?
-
to display an image on a web page you must use an <img > tag, like your league_1.php file is doing on line 49. you cannot just include the get_league_1.php file on a web page since the http request for the image must output the image content-type header (so that the browser knows what to do with the content) followed by the image data. the http request for the image must be a completely separate request.
-
did you check and answer this question - the php warning and lack of a matching language file might be the expected operation that the authors of the script intended, but that they didn't write the script to handle the condition properly and your system is displaying all the errors the code produces when it runs. you are having a series of basic errors when running a third party script. based on the code posted so far, it is poorly written and its lack of support by the authors speaks for itself. if you don't have any basic php coding and troubleshooting skills to attempt to track down the cause of any of these problems yourself, you need to hire a programmer as it's not this forum's job to find and fix a series of errors for you in some third party script.
-
PHP Drop Down menu will not show array value?
mac_gyver replied to Dicko_md's topic in PHP Coding Help
your loop variable is $i you are just using the letter i in your code and that's not the php variable $i -
mutliple Warning: Cannot modify header information
mac_gyver replied to jonnyfortis's topic in PHP Coding Help
saving your file without the Byte Order Mark characters has nothing to do with a HTML <meta tag. it's how you save the file in your editor. -
mutliple Warning: Cannot modify header information
mac_gyver replied to jonnyfortis's topic in PHP Coding Help
since the OUTPUT is still occurring on line 1 of your file, you either have some character(s) in your file before the <?php tag OR your file is saved as a UTF-8 encoded file with the Byte Order Mark characters as part of the file. make sure you have nothing before the <?php tag in your file and make sure that if you must save the file as a UTF-8 encoded file that you save it without Byte Order Mark charters or save the file as an ascii encoded file (i.e. not a UTF-8 encoded file.) -
you already have a thread for this or for similar processing of your data. if this is the same type of processing, but for a different key in your array, the method will be exactly the same as in your previous thread. continue your problem in your existing thread.
-
did you read the error messages and TRY to determine why the errors are occurring on your server? does the path and filename listed in the first error exist? i find it hard to believe that they would have a language file named 0.inc.php. the LANG defined constant is apparently a 0 (but could be evaluated as zero value if it is not defined.) LANG is apparently defined in the config.inc.php file. is it?
-
mutliple Warning: Cannot modify header information
mac_gyver replied to jonnyfortis's topic in PHP Coding Help
change your first line of code to the following so that you can determine if the problem is before the <?php tag or due to something in the required file - <?php require_once('Connections/lotties.php'); where does the error message state the output is occurring at after you make this change? -
multidimensional associative array stalls in nested foreach loops
mac_gyver replied to geno11x11's topic in PHP Coding Help
whenever you find yourself doing a lot of work for any one programming task, it is a sign that you are doing something wrong. either your data definition isn't suitable for the task and needs to be reworked or you are layering on code that doesn't have anything to do with the goal you are trying to achieve. this forum regularity helps people reduce and simplify code and data by identifying the underlying problems with that code and data, but that requires having specific details of what that code and data is and how it is being used. posting an example of your data (the input) and what result(s) you are trying to get from that data (the output) would allow someone to help specifically with what you are doing and why your code might be having a problem after x number of iterations. BTW - what does this thread have to do with Regex, the forum section it is posted in? -
ok, i fixed the form problem almost completley.
mac_gyver replied to btrp's topic in PHP Coding Help
are you setting a reply-to mail header in your code? -
as a continuation of the above reply: i just thought of another possibility for a second execution of that query that would be exposed by having all the code on your page. you may be running another mysql_query($query) statement after the code you posted.
-
duplicate execution of your code is usually caused by - 1) you are running your code twice by including it or looping over it two times. what's all the code on your page (less any database credentials)? basically your page isn't doing what you expect, you need to provide all the code on your page that duplicates the problem if you need someone else to determine if this is what is causing the problem. 2) the browser is requesting your page twice or your web server setup is causing your code to be executed two times. after you eliminate #1 as the cause, tackle this possibility. for both of these possibilities, you may want to consider logging some information in your code (see the error_log() statement) with at least the the microtime() value and the update query that is in $query so that you can see when and how many times the code is running and what the values are. this would pin the problem down to the php side (i/we have seen cases where people have used triggers in the database to perform actions and the problem is actually occurring in the database and not in the php code.)
-
Arrays from MySQL database contains no data? (Simple Q)
mac_gyver replied to rjt90's topic in PHP Coding Help
do you have php's error_reporting set to E_ALL and display_errors set to ON in your php.ini? i can see 3-4 different things that could produce errors in the posted code. that you are using a foreach() loop on $var_hook indicates it ISN'T an imploded list. it's an array and it cannot be used directly in the query statement like you have shown in your code or the foreach() loop isn't doing what you expect. do you have a column named `data` in your data table so that $new_row["data"] actually exists to use as an array index? since you haven't shown what your input data is, what result you got, and what result you expected from that input data, it's not really possible to help you with what you are doing. you need to share more details. -
Need help wont display database first result
mac_gyver replied to davidolson's topic in PHP Coding Help
to test if a PDO query that executed without any errors returned any rows at all, use the ->columnCount() method (a zero means no result set since you cannot select nothing/no-columns in a query.) if you are going to actually use all the rows a query returned, but you also want to test if there are/are-not any rows, just use the ->fetchAll() method and use count() to determine how many rows there are. -
since you forgot to tell anyone what "it doesn't work" means, we cannot help you. we don't have an account to try ourself and it would be unwise for you to give anyone here access to your actual account, so you are the only person here who can run your code and observe what result it produces. but if you don't communicate what result your code produced, you are on your own with this problem.
-
it all depends on what the code in graph.php is doing. if graph.php is dynamically producing an image, you must use an <img src=' ... '> tag for each image you put onto a web page and since graph.php apparently expects a get parameter, you would do something like - <img src='graph.php?mrn=1'> <img src='graph.php?mrn=2'>