-
Posts
16,734 -
Joined
-
Last visited
-
Days Won
9
Everything posted by PFMaBiSmAd
-
None of - <?php//NOTE?> or <?php//NOTE ?> or <?php //NOTE ?> produce a parse error (edit: on a system with short_open_tags turned off, I did not test on a system with them on.) You likely have some other syntax error prior to that point that is being detected when the <?php tag is being encountered. Please post the actual error and the code up to the point where the error is being reported. edit: on a system with short_open_tags turned ON, you do get runtime notices for the <?php//NOTE?> and <?php//NOTE ?> versions about php being an undefined constant, but those are not parse errors.
-
Form Data Not Appearing in MySQL Database
PFMaBiSmAd replied to Skelly123's topic in PHP Coding Help
Add the following debugging code to your form-data.php code to see if the $_POST data is being received - echo "<pre>"; echo "POST:"; print_r($_POST); echo "</pre>"; -
Form Data Not Appearing in MySQL Database
PFMaBiSmAd replied to Skelly123's topic in PHP Coding Help
The form you posted works as expected and submits the three $_POST['...'] variables - If it didn't work for you, are you sure you updated the correct file and refreshed the form in your browser so that any changes made to the HTML source would take effect? -
"Unknown column" when I'm sure the column exists
PFMaBiSmAd replied to lange513's topic in MySQL Help
You probably have some white-space/non-printing character (tab, space, cr, lf, ...) either in the column name or in the query. -
"Unknown column" when I'm sure the column exists
PFMaBiSmAd replied to lange513's topic in MySQL Help
Yes, but does it exist in that database, that table, with that spelling, and with that capitalization (assuming you are on an operating system that is case-sensitive.) You wouldn't be getting that error if mysql found the column you referenced in the query. -
You can store anything (made up of data) you want in a database table, as long as it makes sense. Do you want to store the page name (URL) of the page or do you want store the actual source php code or HTML that makes up the page? Storing the actual source php code in a database table doesn't make a lot of sense unless you are making a php script site and you want to display the code instead of execute it.
-
Form Data Not Appearing in MySQL Database
PFMaBiSmAd replied to Skelly123's topic in PHP Coding Help
^^^ There's at least 5 values in the form HTML that are surrounded by curly/smart quotes and would need to be corrected. -
You are also using htmlentities() on pieces of your SQL syntax. Why? You escape the data values put in a query. You don't escape the actual SQL syntax that makes up the query.
-
If line 3 is an opening <?php tag, what ARE lines 1 and 2, because they are content that is being sent to the browser and is preventing the cookie from being set.
-
Define: it doesn't work. What does it do? Is the cookie being set in your browser when you check? Is the cookie being set but the value is empty? Is your form setting $_POST['rem']? Have you checked by echoing it in your php code? Is $mem['userid'] set to an expected value? Have you checked by echoing it in your php code? Is that all the code on your page that sets the cookie (in case you are outputting something to the browser that would prevent the setcookie() from working on your live server)?
-
A) You can just try it to see if it does work or what it does do, B) I don't think it (the second case) will work because the $_POST[...] index names have escaped single-quotes, C) That's an awful lot of extra typing, D) The following should work - $select_date = "date1='{$_POST['date1']}', date2='{$_POST['date2']}', date3='{$_POST['date3']}', date4='{$_POST['date4']}', date5='{$_POST['date5']}',"; $select_map = "map1='{$_POST['map1']}', map2='{$_POST['map2']}', map3='{$_POST['map3']}', map4='{$_POST['map4']}', map5='{$_POST['map5']}',";
-
How can i use a variable to get an array from another php file?
PFMaBiSmAd replied to Jarid's topic in PHP Coding Help
Also, the global keyword has absolutely no meaning except when used inside of a function definition, is not doing anything in the code you posted, and the line using it should be removed. -
Share Session with 2 Different Websites Residing on Same Server
PFMaBiSmAd replied to dlebowski's topic in PHP Coding Help
If you force php to pass the session id on the end of the URL, the constant SID will contain the session name and the session id. You can then append this onto the end of the URL. If you are also passing other GET parameters on the end of the URL you will need to take that into account. In just playing with this (setting 'session.use_cookies',0 and 'session.use_trans_sid',1 in the script), you would also need to test and use $_GET['PHPSESSID'] to set the session_id() in order to resume the session on the different domain. -
Share Session with 2 Different Websites Residing on Same Server
PFMaBiSmAd replied to dlebowski's topic in PHP Coding Help
So, you altered your code so that it would put the session id on the end of URL's and redirects, started a session on the first domain, switched to the other domain, observed that the session id was on the end of the URL being requested on the other domain, started a session on the other domain, and it was or was not the same session data? Are you using the default \tmp session.save_path on both domains so that the session data files would be available to both domains? -
Share Session with 2 Different Websites Residing on Same Server
PFMaBiSmAd replied to dlebowski's topic in PHP Coding Help
By default, the session id is propagated between pages using a cookie. Cookies are domain specific. To do what you want would require that you pass the session id as a GET parameter on the end of the URL. The can read the session handling section of the php.net documentation to find out how you might do that. -
You need to use $_GET['template'], $_GET['id'], ... The code you posted is dependent on register_globals to magically set program variables from the external data in POST, GET, COOKIE,... variables. Unfortunately, register_globals also magically lets hackers set your session variables by simply putting a same name GET parameter on the end of the URL when they request one of your pages. A lot of web sites have been taken over. Register_globals were turned off by default in php4.2 in the year 2002 and I am surprised that we are still seeing php code that has not yet been updated to run with register_globals turned off. Now is the time to update your code because register_globals are scheduled to be completely removed in an upcoming php version.
-
Where are the program variables $template and $id being set at in the code you posted?
-
You need to dynamically build your query string and only include the AND field_name LIKE '%$variable%' for those form fields that did have a value.
-
How to modify already echoed variable?
PFMaBiSmAd replied to Anti-Moronic's topic in PHP Coding Help
The cases where you have seen something like this WORK are those cases where there are not echo statements in the code. This works when you build/assemble/concatenate content and then echo that content at the end of the code on the page. -
php is not working with MySQL - can't add AND
PFMaBiSmAd replied to jeger003's topic in PHP Coding Help
The syntax for just the part you are adding should be - AND location = '".$_COOKIE["State"]."' Resulting in the whole query of - $this->sql_query = "SELECT * FROM ".$this->classifieds_table." WHERE category ".$this->in_statement." AND live=1 AND location = '".$_COOKIE["State"]."'"; -
Dreamweaver was never really intended to use with server side scripting languages and it doesn't really care if you have a session_start() on your page and you need to prevent the BOM characters from being saved as part of the file. You need to use a different programming editor in order to save your file without the BOM characters. If you are not using UTF-8 encoding on the page, save your page as an ANSI encoded page (should get rid of the BOM characters as well.)
-
If you read the sticky post that AbraCadaver posted the link to, was your file saved as a UTF-8 encoded file with the BOM characters and did saving it without the BOM characters fix the error? Your page might be functioning, but your sessions cannot be with the error. The error message with the output started on line 1 of your file, for the code you posted as being line 1, either has actual characters in the file before the <?php tag or it has the BOM characters as part of the file.
-
I'm not sure what the PHP Applications, Frameworks and Libraries forum section has to do with your code, but - A) You didn't bother to tell us what result you are getting. What do you see in front of you when you try this, and B) You are not testing the value being returned by your functions and outputting any user error messages, so you will never know, and we cannot possibly tell you either, if your query worked or not or if it matched zero rows, yet you are blindly attempting to process the data, which might not even have been returned. For some quick debugging, what does using var_dump($sites); in your main code show?
-
mt_rand is producing the same number instead of randomizing
PFMaBiSmAd replied to scmeeker's topic in PHP Coding Help
mt_rand() . mt_rand() produces a rather large number and is probably exceeding your column definition. Show us the value that is being inserted (seeing it might help someone help you), show us some of the values that are being generated for $transaction_id, and show us the column definition.