-
Posts
16,734 -
Joined
-
Last visited
-
Days Won
9
Everything posted by PFMaBiSmAd
-
Connecting and selecting are two different verbs and since computers only do exactly what their programming tells them to do, everything in a program has significance. You cannot effectively write a program that does what you want if you skip over learning the basics of what each instruction you are using does or reading what error messages tell you.
-
Doesn't that suggest to you that you need to select a database? Have you read through a basic php/mysql book or gone through a basic php/mysql tutorial? They all show connecting to a mysql database server, selecting a database, then executing a query. You cannot execute queries for your data until you understand the code necessary to execute any query.
-
[URGENT] AuroraGPT MRV4 - PHP Script Help
PFMaBiSmAd replied to CashBuggers's topic in Third Party Scripts
You say you paid for this script? It uses short open tags which should never be used in any script, let alone a script that is intended to be distributed - -
Php drop down from sql and post result bellow
PFMaBiSmAd replied to randydg's topic in PHP Coding Help
Your code has no code in it to process the form submission and get the correct address to display. Any address it is currently displaying is just the address from the last row that was fetched when you built the drop-down menu. Building the form and processing the form are two separate operations and you need code to perform each operation. If you want the address to be updated without refreshing the whole page, yes you do need to use javascript (AJAX.) If you don't care if the page refreshes, you can just submit the form normally and let the whole page redisplay. Which method did whoever assigned this want you to use? And if you want the form to automatically submit when you pick a different selection in your drop-down, you will need to use an onchange event. That's also not all of your form and probably won't submit anything anyway. What is your full code on the page? -
You don't interface to paypal the way you are attempting. By reading paypal's documentation for the type of account you are trying to interface with.
-
You might have used code like that in an include()/require() statement (which is processed on the server), but $_SERVER['DOCUMENT_ROOT'] is a file system path and cannot be used in a header() redirect AND your header() redirect is also invalid. A header redirect is coded like - header("Location: http://www.example.com/your_path/your_file.php");
-
Actually, the Reply-To: email address CAN be the address that the visitor supplied. You should form the message body in a variable (i.e. $message) so that you can echo it to see what exactly it is. You then simply put the $message variable into the mail() function call as the 3rd parameter. I also recommend testing the value that mail() returns so that you can see if your mail server accepted the email or returned an error - if(mail(your parameters here...)){ // the mail was accepted by the server for sending echo "<div id='contactRightDone'> <h2>Thanks for your message</h2> <p>I'll respond to your inquiry as soon as possible.</p> </div>"; } else { // the mail was not accepted by the server for sending echo "Sorry, a server error occurred and your form submission could not be processed... "; } If you get the Sorry... message, you can troubleshoot further (by turning on full php error_reporting/display_errors) why the mail server is not accepting the email.
-
http://us.php.net/manual/en/faq.html.php#faq.html.form-image Using an image as a submit button causes the _x and _y coordinates where the image was clicked to be sent to the server. You can either detect that or you can use a hidden field in the form and detect if the form was submitted by detecting if the hidden field name is set.
-
fopen("w") creates file then fwrite on handle cause "Invalid Stream"
PFMaBiSmAd replied to MK27's topic in PHP Coding Help
Use OR instead of || Because || has a lower precedence than =, your code is or'ing the result of fopen() with die; (which is nothing) and assigning that to $dfile. If you had error_reporting set to E_ALL, you would also see the following Warning that would help you track down what your code is doing - -
You will find that when you have a set of data that you are trying to process, that using an array will result in the simplest and most efficient code (sets of data are what arrays are for.) Creating a series of named variables takes more code and then you must either keep track of how many you created and what they were named or hard-code the logic that references them (which defeats the point of using a programming language to simplify a repetitive task.)
-
^^^ your query failed due to an error of some kind and returned a FALSE value. You need to troubleshoot why your query is failing and your code has no error checking logic in it to test if the query worked before blindly attempting to use the results from the query (mysql_num_rows() in this case.)
-
A) At a minimum you need to provide a From: email address (there's no guarantee that a valid default from address is setup in the php.ini.) B) Have you examined your Joomla mail settings to see if there are any special requirements, such as SMTP authentication. C) Have you examined your web host FAQ section to see when method to use or if there are any special requirements to use the mail server?
-
mysql_query("DELETE $clan_name FROM clans");
PFMaBiSmAd replied to 3raser's topic in PHP Coding Help
Because the syntax for a delete query is (bold part is the most common usage) - A typical query would look like - DELETE FROM your_table WHERE some_id_column = some_id_value -
Browsers can only make HTTP requests to web servers. Using AJAX just means that the HTTP request is asynchronous (i.e. in the background) to what the browser is displaying in the foreground. So, you cannot directly call a php function from a browser. You must request a URL that causes the web server to process a php page and the php code on that page determines what action to take.
-
Just trying various pieces of code and throwing each away without troubleshooting why it does not work rarely leads to a quick solution to a problem because - A) You don't learn why any particular method does not work so that you can identify similar code and avoid using methods that don't have a chance of working (I'm going to guess that you have wasted time trying several logically equivalent pieces of code, all with the same result), and B) You could have a systematic problem (with sessions or your database) that until you identify why any particular code does not work, you can try hundreds of things, but the same unidentified underlying problem will prevent all of them from working.
-
Yes, well, the table name is empleados not plani
-
You would need to post the actual table definition in order to give someone enough information to help you. You either have a spelling error or a letter-case difference (assuming you are on an operating system that is case sensitive.)
-
The YYYYMMDDHHMMSS format should be recognized as a datetime value. What does the following produce - SELECT DATE_FORMAT('20100614062921', '%M %D, %Y %H:%i:%S');
-
Your php version is too far out of date (as of php5.1, date() works back to Fri, 13 Dec 1901 20:45:54 GMT.) The end of life and support of php4 was over two years ago. Your mysql version is way out of date as well.
-
From the mysql_real_escape_string() documentation -
-
For some logic that does do what you seem to be attempting, read this - <html> <head> <title>Review Tracks</title> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <center> <div class="holder"> <?php //connect to database mysql_connect("$mysql_host","$mysql_user","$mysql_password"); mysql_select_db("$mysql_database"); $id = isset($_GET['id']) ? $_GET['id'] : ''; // get the actual value or a default value // check for an id if(empty($id)){ // there is no id echo '<div id="signuptop">Error</div><div id="signup">Sorry, you must select a review to edit. Go back and select a review! <a href="index.php">Home</a></div>'; } else { // an id has been supplied (you would probably want to do additional validation here...) //passcode processing code $errors = array(); if(!empty($_GET['passcode'])){ // not empty, validate the length if(strlen($_GET['passcode']) == 6){ // length is correct, do any other validation here... // get the row matching the current $id $id = mysql_real_escape_string($id); $extract = mysql_query("SELECT * FROM reviews WHERE id='$id'"); $row = mysql_fetch_assoc($extract); // check if the passcode matches the table if($_GET['passcode'] != $row['passcode']){ // no match $errors[] = '<div id="signuptop">Error</div><div id="signup">Incorrect pass-code! Please try again!</div>'; } } else { // wrong length $errors[] = 'The entered passcode was not 6 characters'; } } else { // no passcode entered $errors[] = 'No passcode was entered'; } // set the passcode if no validation errors if(empty($errors)){ $passcode = $_GET['passcode']; } // display the form and any errors if(empty($passcode) || !empty($errors)){ if(!empty($errors)){ echo "Please correct the following error(s)-<br />"; foreach($errors as $error){ echo "$error<br />"; } } // output the passcode form echo '<div id="signuptop">Error</div><div id="signup">Please enter in the Pass-code to edit this review:<br/><br/> <form action="" method="GET"> <input type="hidden" name="id" value="'. $id .'"> <input type="text" name="passcode" maxlength="6"> <input type="submit" value="Enter"></form><br/><br/></div>'; } // the 'edit form' form processing code $errors = array(); if(isset($_POST['edit_submit'])){ $design2 = mysql_real_escape_string($_POST['design']); $designt2 = mysql_real_escape_string($_POST['designtext']); $grammar2 = mysql_real_escape_string($_POST['grammar']); $grammart2 = mysql_real_escape_string($_POST['grammartext']); $layout2 = mysql_real_escape_string($_POST['layout']); $layoutt2 = mysql_real_escape_string($_POST['layouttext']); $moderation2 = mysql_real_escape_string($_POST['moderation']); $moderationt2 = mysql_real_escape_string($_POST['moderationtext']); $activity2 = mysql_real_escape_string($_POST['activity']); $activityt2 = mysql_real_escape_string($_POST['activitytext']); $overall2 = mysql_real_escape_string($_POST['overall']); $overallt2 = mysql_real_escape_string($_POST['overalltext']); $ip = $_SERVER['REMOTE_ADDR']; // put your code to validate data and set elements in $errors[] = 'error messages'; ... // process the form data if no validation errors if(empty($errors)){ // put your code to UPDATE the row in the table here... echo "<div id='signuptop'>Success</div><div id='signup'>You have successfully edited the review!</div>"; } } // end of 'edit form' form processing code // display the form and any errors if((!empty($passcode) && !isset($_POST['edit_submit'])) || !empty($errors)){ // the $row data was fetched above when the passcode value was checked against the database $name = $row['name']; $site = $row['url']; $design = $row['design']; $designt = $row['designt']; $grammar = $row['grammar']; $grammart = $row['grammart']; $layout = $row['layout']; $layoutt = $row['layoutt']; $moderation = $row['moderation']; $moderationt = $row['moderationt']; $activity = $row['activity']; $activityt = $row['activityt']; $overall = $row['overall']; $overallt = $row['overallt']; $total = $row['total']; $views = $row['views']; $status = $row['status']; // output any validation errors if(!empty($errors)){ echo "Please correct the following error(s)-<br />"; foreach($errors as $error){ echo "$error<br />"; } } // output the form echo '<div id="signuptop">Edit a Review</div><div id="signup"><form action="'. "?id=$id&passcode=$passcode" .'" method="POST"><br/> Appearance: <select name="design"> <option value="'. $design .'">'. $design .'</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select> /10<br/> <textarea name="designtext" cols="30" rows="13" maxlength="450">'. $designt .'</textarea><br/> <br/><br/>Grammar Usage <select name="grammar"> <option value="'. $grammar .'">'. $grammar .'</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select> /10<br /> <textarea name="grammartext" cols="30" rows="13" maxlength="450">'. $grammart .'</textarea><br/> <br/><br/>Layout <select name="layout"> <option value="'. $layout .'">'. $layout .'</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select> /10<br /> <textarea name="layouttext" cols="30" rows="13" maxlength="450">'. $layoutt .'</textarea><br/> <br/><br/>Moderation <select name="moderation"> <option value="'. $moderation .'">'. $moderation .'</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select> /10<br /> <textarea name="moderationtext" cols="30" rows="13" maxlength="450">'. $moderationt .'</textarea><br/> <br/><br/>User Activity <select name="activity"> <option value="'. $activity .'">'. $activity .'</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select> /10<br /> <textarea name="activitytext" cols="30" rows="13" maxlength="450">'. $activityt .'</textarea><br/> <br/><br/>Overall Score <select name="overall"> <option value="'. $overall .'">'. $overall .'</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select> /10<br /> <textarea name="overalltext" cols="30" rows="13" maxlength="450">'. $overallt .'</textarea><br/> <input type="hidden" name="checker" value="1"> <br/><br/><br/> <input type="submit" name="edit_submit" value="Edit Review"></form></div>'; }// end of edit form code } // end 'there is an id' ?> </div> </center> </body> </html>
-
Is the following an accurate sequence of events (because it is simply impossible to design and write code or troubleshoot code if you have not defined what it is supposed to accomplish) - 1) $_GET['id'] is first received from the index.php page where a review is selected to be edited (and apparently a passcode is generated, saved in the corresponding table row, and displayed so that it can be entered on this page (edit.php.)) 2) This page (edit.php) displays a form to input the passcode (the id is passed through as a hidden field.) 3) When the passcode form is submitted, if the passcode matches the value in the table for the passed id, the edit form will be displayed. The id and passcode are passed through as hidden fields. 4) When the edit form is submitted, the data is validated and the the correct row (using the passed id and passcode) will be updated. And I recommend rewriting your logic so that it contains a section of code to perform each of those specific tasks (including checking which submit button has been pressed.)
-
Problems viewing an image retrieved from mysql database
PFMaBiSmAd replied to Fenhopi's topic in PHP Coding Help
Assuming your <img tag is like - <img src="getpicture.php?fid=1" alt=""> the php code that you put in getpicture.php must only output the correct header() statements followed by the binary image data. You cannot output anything else (i.e. html) in the getpicture.php file. -
INSERT INTO works fine but UPDATE returns errors
PFMaBiSmAd replied to gesseg's topic in PHP Coding Help
The syntax definition for an UPDATE query (with the most common usage in bold) -