-
Posts
2,134 -
Joined
-
Last visited
-
Days Won
42
Everything posted by benanamen
-
The last part could use some cleanup. if (mysqli_num_rows($result)) { return $result; } return false;
-
OP, What is the point of adding another layer (Javascript) just to get a random value? Why not just generate in Php? And rather than tell us about your attempted solution to the real problem, how about tell us what the real problem is.
-
For those of you that have not gotten the word, GitHub now offers FREE repository’s as of today.
-
Small business needs help creating PHP interview questions
benanamen replied to aadamsx's topic in PHP Coding Help
You could save yourself the trouble and just hire me. My posts on this forum and other coding forums speak for themselves as to my level of expertise.- 7 replies
-
- application
- full-stack
-
(and 1 more)
Tagged with:
-
Select & checkbox values don’t show up in submitted form
benanamen replied to ThatGuyRay's topic in PHP Coding Help
You STILL have not added any VALUES to your Select. -
Select & checkbox values don’t show up in submitted form
benanamen replied to ThatGuyRay's topic in PHP Coding Help
What makes you think ID's are in the POST array? The checkbox array is vehicle and the Select is missing the name attribute so nothing from that will be in the POST array. -
saving a variable from the selected option in a datalist
benanamen replied to michaelfurey's topic in PHP Coding Help
What you are talking about is called a Chained Select. Look it up. -
Where do you put opening curly braces when defining a method?
benanamen replied to NotionCommotion's topic in PHP Coding Help
There are actually several common styles that have names. I personally prefer Whitesmith. Pick one and stick with it. http://www.terminally-incoherent.com/blog/2009/04/10/the-only-correct-indent-style/ -
You have several problems. For one, the from is not the email in the form, it is the server sending the email. You have variables for nothing and the code is vulnerable to a header injection and you should be using POST, not REQUEST.
-
For starters, your logic is off. Where does the data for $lender_list come from? A database?
-
Warning: mysql... expects parameter 1 to be resource, boolean given
benanamen replied to wintech's topic in PHP Coding Help
Beat me to it. Continuing the cycle of obsolete code and bad practices does not help anyone. A much better response would be to post an example up to current coding standards. -
Warning: mysql... expects parameter 1 to be resource, boolean given
benanamen replied to wintech's topic in PHP Coding Help
Que the same old story... Your code is obsolete and has been completely removed from Php. You need to use PDO. https://phpdelusions.net/pdo -
That is the WORST way to ask for help. You have over 7 thousand posts and don't know how make a proper request for help? WHAT isn't working? What is the error message you get? What is the result? Is the missing brace actually in your code and you didn't post it here?
-
No need to escape, just use single quotes on the elements.
-
Where is the data coming from? A database?
-
I smell an XY problem. OP, where does this array data come from? A database? How about showing the code how you come up with this array.
-
Add 60 days to date <?php $date = new DateTime('2016-09-01'); $date->add(new DateInterval('P60D')); echo $date->format('Y-m-d'); ?>
-
Help with php to display a list from a SQL Query
benanamen replied to ricmcdonald's topic in PHP Coding Help
NO!, You always select the specific column names you want. DO NOT SELECT * Modify this to use the results of your query <!DOCTYPE html> <html> <head> <title></title> </head> <body> <form action="<?= $_SERVER['SCRIPT_NAME'] ?>" method="post"> <select name="sort_by"> <option value="">Select Option</option> <?php $array = array('id' => 'ID', 'name' => 'Name', 'amt' => 'Amount', 'status_filter' => 'Status'); foreach ($array as $key => $value) { $selected = isset($_POST['sort_by']) && $_POST['sort_by'] == $key ? 'selected' : ''; echo "<option value='$key' $selected>$value</option>\n"; } ?> </select> <input name="submit" type="submit" value="Submit"> </form> </body> </html> -
You are not going to get any help until you make a coherent post that includes a question
-
Run SQL Query via button click on user input
benanamen replied to Jawanaut's topic in PHP Coding Help
Email me. See my Profile. Site wont allow you to get PM's yet. -
Run SQL Query via button click on user input
benanamen replied to Jawanaut's topic in PHP Coding Help
Forget about ajax. Lookup Mysql CRUD tutorials. You need to learn basic form html first. -
Run SQL Query via button click on user input
benanamen replied to Jawanaut's topic in PHP Coding Help
Yes. The form values will be available in the POST array. e.g $_POST['first_name'] -
Run SQL Query via button click on user input
benanamen replied to Jawanaut's topic in PHP Coding Help
Your query is not valid. More importantly you are using obsolete mysql code that has been completely removed from Php. You need to use PDO. https://phpdelusions.net/pdo -
Forget about making a function, just learn how to use PDO. Start with a basic select. * In practice, you will not be using a variable for the table name. This is a really basic example. <?php $hostdb = 'localhost'; $dbname = 'your_DB'; $username = 'root'; $password = ''; $table = 'YOURTABLE'; $pdo = new PDO("mysql:host=$hostdb;dbname=$dbname", $username, $password); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql = "SELECT * FROM $table"; $stmt = $pdo->prepare($sql); $stmt->execute(); $result = $stmt->fetchAll(); echo '<pre>'; print_r($result); echo '</pre>'; ?>
-
Yeah, but you might as well start using PDO now. Study the link I posted.