-
Posts
16,734 -
Joined
-
Last visited
-
Days Won
9
Everything posted by PFMaBiSmAd
-
The variable birthday and telephone are not INSERT INTO
PFMaBiSmAd replied to co.ador's topic in PHP Coding Help
If you would stop making new threads for your current problem (this is like the 4th one in a series), you wouldn't need to keep explaining what you are doing or showing the code you are trying to make work. -
From the mysql documentation for what you are trying to do -
-
http://dynamicdrive.com/dynamicindex7/jasoncalendar.htm
-
Don't give the visitor a choice of how the value gets entered, either use a pop-up date-picker that supplies the YYYY-MM-DD format and/or use three individual drop-down-select lists, one for year, one for month, and one for the day.
-
Queries failing in PHP runing successfully in PHPMyadmin
PFMaBiSmAd replied to Farelski's topic in MySQL Help
That's because you are or'ing a string with the mysql_query() returned value. I suspect you meant to use or die(....) on the line after your mysql_query() statement. -
Unable to load php_sqlsrv_53_nts_vc6.dll
PFMaBiSmAd replied to mallen1's topic in Microsoft SQL - MSSQL
Your php.ini extension_dir setting is apparently set to C:\php, not C:\PHP\ext -
Fatal error: Allowed memory size of 67108864 bytes exhausted
PFMaBiSmAd replied to Zephni's topic in PHP Coding Help
Developing and debugging your code with error_reporting set to E_ALL will generally help point out things like typos and mismatched variable names. -
I am having problem Inserting data. improper function help!
PFMaBiSmAd replied to co.ador's topic in PHP Coding Help
mysql_num_rows() expects a result resource because it is used with SELECT/SHOW queries. An INSERT query only returns a true/false value. To find out if an INSERT query actually inserted a row, after you check that the query executed without any errors, you would use mysql_affected_rows -
Fatal error: Allowed memory size of 67108864 bytes exhausted
PFMaBiSmAd replied to Zephni's topic in PHP Coding Help
Your code either contains a logic error that is causing it to loop forever, thereby taking up all available memory or you are doing something that consumes a huge amount of memory and you either need to optimize/manage the available memory or allocate more memory. In any case, you would need to post your code that duplicates/reproduces the problem for anyone here to be able to specifically help you with what you are doing in your code that is causing this problem. -
Or more generically - <?php $choices = array(0=>'Coke',1=>'Root Beer',2=>'Pepsi',3=>'Dr. Pepper',4=>'Sprite',5=>'7up',6=>'Cream Soda',7=>'Club Soda',8=>'Water',9=>'Milk'); echo "<form method='post' action=''>"; foreach($choices as $key => $value){ echo "<input type='checkbox' name='drinks[]' value='$key' />$value<br />\n"; } echo "<input type='submit'>"; echo "</form>"; // validate list of checkbox fields if(!isset($_POST['drinks'])){ echo "You must select at least one!"; } else { // at least one picked if(count($_POST['drinks']) > 5){ echo "You may pick a maximum of 5!"; } else { // a valid number picked echo "You picked - <br />"; foreach($_POST['drinks'] as $key){ // use the value here to form your query... echo "$choices[$key]<br />"; } } } ?>
-
for ($i=0; $i<60; $i++) { $i = sprintf("%02d",$i); echo "<option value=".$i.">" . $i . "</option>\n"; }
-
One other reason you would want to simply fix this problem, would be that you apparently intend to include/require the include.php file on all your pages and it will currently cause an error with every session_start(), header(), and setcookie() statement that you put in your code after it. Being able to use these three statements would be kind of important since you are working on a login script.
-
You would use sprintf with a %02d format specifier - http://us.php.net/sprintf
-
In programming, it's always better to find and fix what is causing an error, than to throw a bunch of code at it and hope the 'fix' works at all or works in all situations. The solution to this problem is to read the error message and find and fix what is causing the output that is preventing the header from working - hodgey87, what is the code in your include.php file? I'll guess line 18 is either that last line in the file and you have a blank line after the ?> tag or you are echoing something on line 18 in your code.
-
If you rename your function to something a little less like a built in function name, your code will work.
-
Your AccountRelated() function calls itself (forever) and eventually produces a fatal runtime error and results in no output being sent to the browser, which is kind of what - ERR_EMPTY_RESPONSE suggests. You should be developing and debugging your code on - 1) A system with error_reporting set to E_ALL and display_errors set to ON in your master php.ini, so that all the errors php detects will be reported and displayed, you will save a TON of time. 2) A local development system, so that you don't waste time constantly uploading your files to a server just to see the result of each change. You will save a TON of time.
-
LOL - 1b
-
The following are the most likely causes (from most to least likely) - 1) That's not the whole actual code and you either have - 1a) a line of code, between where you execute the query and where you start the loop, that is fetching and discarding a row, or 1b) some code in the while() loop that is overwriting the result resource so that it doesn't exist the second time through the loop, 2) You actually only have one matching row in your database table, or 3) That's not the actual query that is producing the result resource that your loop is using, or 4) Something in your data looks like HTML and is breaking the HTML and the other row of data might be visible in the 'view source' of the page in your browser.
-
using foreach to break a list into groups
PFMaBiSmAd replied to johnmerlino's topic in PHP Coding Help
Assuming you want the approved ones first - select * from vanity_urls order by approved desc Add any other ORDER BY condition after the approved desc, for example - select * from vanity_urls order by approved desc, url asc -
Using a HTML template with includes can't read from $_GET
PFMaBiSmAd replied to rpmorrow's topic in PHP Coding Help
To get the quickest solution, you would need to post a sample of your code that demonstrates/reproduces what you are doing and shows what does not work. A template should be just that - "a pattern, used as a guide in making something." A template should not be doing anything itself. Your main code should be producing the content that goes into the template, replaces your placeholders in the template with the appropriate content, and output the results. -
Using a HTML template with includes can't read from $_GET
PFMaBiSmAd replied to rpmorrow's topic in PHP Coding Help
You would use file_get_contents() with a file system path to read the contents of the template into a variable. -
Using a HTML template with includes can't read from $_GET
PFMaBiSmAd replied to rpmorrow's topic in PHP Coding Help
^^^ That's making a separate HTTP request back to your server to request the file, so it is not search.php where the included code is executing at, it is search-template.htm where the included code is executing at. Why would you use CURL to do this? That would be extremely slow compared to using the file system to include the template. -
A) I could not repeat your symptom using my own login script under the latest FF4 or IE8. In the first case, logging out in the second tab resulted in the first tab being logged out when it was refreshed. B) You didn't tell us which browser you used or if you tried this in other browsers or if this is repeatable after completely closing your browser or if you have set the session.cookie_lifetime to a non-zero value to make a session last when the browser is completely closed... C) You didn't post enough of your code so that someone could reproduce the problem using your code, D) Your symptom is that of having two different sessions, probably due to different host-names/sub-domains (one with and one without the www. on it) from previous testing or redirects/links within your code (some with and some without the www. on them.)
-
How do I take input and put it into a table.
PFMaBiSmAd replied to VinceGledhill's topic in PHP Coding Help
In Your_path_to_joomla_install\components\com_mad4joomla\mad4joomla.php, there is a send() function that processes the from data. At about line 559 (in the version of mad4joomla that I just downloaded) is the point where the code attempts to send the email (all the data/uploaded files have been processed.) At about line 519 is the start of the loop that gets the element name/value and forms the email message body. You could add code to that loop to get the data into an array that you could then use to form an INSERT query. At about line 541 is the start of the loop that processes any uploaded files. You would need to add code to move the uploaded files to the location where you are placing them now. -
In reply #6 in this thread, kenrbnsn posted some code that would have displayed the actual sql that is failing. However, I'll take a guess that the error means that $row['id'] is empty. Do you even have a column named id in your subjects table?