-
Posts
6,906 -
Joined
-
Last visited
-
Days Won
99
Everything posted by ginerjm
-
Simple PHP Include Question - I think my host changed something
ginerjm replied to kirkdickinson's topic in PHP Coding Help
What is the name of the file you are executing? If it is showing raw php code you are not running a php file and make sure that if you are that the opening tag is a full php tag as in: <?php -
Simple PHP Include Question - I think my host changed something
ginerjm replied to kirkdickinson's topic in PHP Coding Help
If the echo line is properly placed (near the beginning?) it HAS to show if the script is running - that's why I gave it to you. Show us the code. No links Don't care about your phpinfo at this point. -
Simple PHP Include Question - I think my host changed something
ginerjm replied to kirkdickinson's topic in PHP Coding Help
One error in the above. Change : in last line to ;. Works for me but I'm only running 7.4. -
Simple PHP Include Question - I think my host changed something
ginerjm replied to kirkdickinson's topic in PHP Coding Help
If you are having problems trying to do what we have asked try this: <? error_reporting(E_ALL); ini_set('display_errors', '1'); $ext = ".php"; if (isset($_GET['con'])) { $id = $_GET['con']; if ($id == 'show') { echo "Now running startup script"; exit(); } else { $id .= $ext; if (file_exists($id)) include($id); else include("main.php"); } } else { echo "No con argument provided"; exit(): } Save this revised version of your script as a tester. Give it a new name. Then execute it using 'show' as the con value (?con=show) and see if the script gives you a message. That means that it is working so try it again with you desired con value. My guess is that it is not running and testing it as I suggested just now will show you nothing. If so, may I suggest you post the full script (if it is not too large) for us to review? -
Simple PHP Include Question - I think my host changed something
ginerjm replied to kirkdickinson's topic in PHP Coding Help
But we haven't seen all of the code.... If he is making a big jump in versions there might be some issues, no? Let's see what happens when he tries to get my echo in his current code. If that doesn't show then he's got more trouble. -
Simple PHP Include Question - I think my host changed something
ginerjm replied to kirkdickinson's topic in PHP Coding Help
Did you make the addition that I gave you and run it? Errors? What was the previous version? What happens if you simply try to run the script that you are trying to include? Or - add the following line to the top of your script; echo "Now running in script (your script name)"; At the very least (if you have no errors) that should give you that message. -
Simple PHP Include Question - I think my host changed something
ginerjm replied to kirkdickinson's topic in PHP Coding Help
Actually you need another line as well. error_reporting(E_ALL); ini_set('display_errors', '1'); The '1' is an 'On' value for actually displaying the errors on your client. -
It is standard practice to not close the php mode. That seems to be mentioned here quite often. I think it also may cause issues with included modules possibly. It truly is not required and hasnt' been since I began using php some 7+ years ago. That being said - as a noob you may wonder how you can write non-php code easily. I suggest reading up on the 'heredocs' operand in the manual. Comes in very handy to write your big blocks of html or js code and not worrying about entering and leaving php mode.
-
Ask him what modules/extensions need to be installed in YOUR php install. Perhaps there is something he expects you to have and your installation doesn't.
-
I would use a decimal type in the table and then add a currency name column. Then I would write a function that handles the exchange rates separately but how to know when it needs updating is your problem. Leave out your Code column and Num column since the code can be part of your function and the num is not necessary with a true mysql decimal type.
-
My code is using the heredocs operator to avoid all the echos. If you look it up in the manual you can see how it works. My code should work just fine except if a I have any typos of my own. You have to be php mode for ALL of it. If it doesn't work, post it again as is and let's see it. And be sure that the heredocs; line is in column 1 !!! I do see where the image tags are showing but since you didn't provide any size values it may not be showing. Do an echo of your img tag src value so you can see what the actual image file name looks like.
-
PS - I would use the case-insensitive version of this function: stripos. Never know when the url might be different.
-
Try this: $fname = isset($_POST['fname']) ? $_POST['fname'] : ""; $lname = isset($_POST['lname']) ? $_POST['lname'] : ""; $path = "Recordings/$fname*$lname.pdf"; echo "About to search in $path<br>"; $file=glob($path); See what the path turns out to be and see what you are dealing with.
-
All I see is a function that gives you something based upon what is in the url argument. What is your definition of a "metabox"? Is this some displayable tag or an input tag? ??
-
Did all that copying and never noticed that he was using id values. Whatever for I wonder? Try adding an alt attribute to the img tag. <td><img src="{$bild[$a]}" alt="img {$bild[$a]} not shown"></td> Let's see if there is a reason behind it not showing or simply an error in your reference.
-
Here is your code, a little cleaned up and more readable. $a = '1'; $b = '2'; $code=<<<heredocs <table border=1> <tr> <td id="2"> {$vorname[$a]}<br>{$name[$a]}</td> <td><img src="{$bild[$a]}"></td> <td id="2">{$vorname[$b]}<br>{$name[$b]}</td> <td><img src="{$bild[$b]}"></td> <tr> <td id="2">Nick:</td> <td id="4">{$nick[$a]}</td> <td id="2">Nick:</td> <td id="4">{$nick[$b]}</td> <tr> <td id="2">Geburtstag:</td> <td id="4">{$geb[$a]}</td> <td id="2">Geburtstag:</td> <td id="4">{$geb[$b]}</td> <tr> <td id="2">Wohnort:</td> <td id="4">{$ort[$a]}</td> <td id="2">Wohnort:</td> <td id="4">{$ort[$b]}</td> <tr> <td id="2">Hobby:</td> <td id="4">{$hobby[$a]}</td></td> <td id="2">Hobby:</td> <td id="4">{$hobby[$b]}</td> <tr> <td id="2">Torrausch-Verein:</td> <td id="4">{$club[$a]}</td> <td id="2">Torrausch-Verein:</td> <td id="4">{$club[$b]}</td> <tr> <td id="2">Liga:</td> <td id="4">{$liga[$a]}</td> <td id="2">Liga:</td> <td id="4">{$liga[$b]}</td> <tr> <td id="2">Seit wann<br>bei Torrausch:</td> <td id="4">{$date[$a]}</td> <td id="2">Seit wann<br>bei Torrausch:</td> <td id="4">{$date[$b]}</td> <tr> <td id="2">Wie zu Torrausch<br>gekommen:</td> <td id="4">{$wie[$a]}</td> <td id="2">Wie zu Torrausch<br>gekommen:</td> <td id="4">{$wie[$b]}</td> <tr> <td id="2">Beruf:</td> <td id="4">{$beruf[$a]}</td> <td id="2">Beruf:</td> <td id="4">{$beruf[$b]}</td> <tr> <td id="2">Sonstiges:</td> <td id="4">{$sonstiges[$a]}</td> <td id="2">Sonstiges:</td> <td id="4">{$sonstiges[$b]}</td> <tr> <td id="2">Mailadresse:</td> <td id="4">{$mail[$a]}</td> <td id="2">Mailadresse:</td> <td id="4">{$mail[$b]}</td> </table> <p><p> heredocs; echo $code; You have a few html errors in your table. Also a bad TD tag in one place as well as a bunch of missing tags. As for your missing img - does the rest of the table show up at all?
-
How do I combine values of same col inside a foreach loop?
ginerjm replied to imgrooot's topic in PHP Coding Help
The call to 'query' is a query execution. The call to execute is another form of running a query. Dump the execute and add some error checking to make sure your query is run before proceeding. Something like: if (!$get_records = $db->query(.....)) { handle a failure to run } now process your records -
How do I combine values of same col inside a foreach loop?
ginerjm replied to imgrooot's topic in PHP Coding Help
You do realize that you are running your query twice? And how it works surprises me . -
How do I combine values of same col inside a foreach loop?
ginerjm replied to imgrooot's topic in PHP Coding Help
Again I don't know what the purpose of this table is. It does however seem to be rather differently designed in that these records seem to represent transactions and the deposit and withdrawal columns are simply 'transaction amounts' and deserve only a single column. The balance is always a calculated amount which then comes from the collection of transactions (records) whenever it is needed, and would not be stored anywhere. -
How do I combine values of same col inside a foreach loop?
ginerjm replied to imgrooot's topic in PHP Coding Help
I"m curious. Are you actually saving a "balance" amount on your records? You are calling it balance but then you are adding them up so that sum total could not possibly be a balance. -
How do I combine values of same col inside a foreach loop?
ginerjm replied to imgrooot's topic in PHP Coding Help
But that leaves out the elimination of certain records whose individual balance is not > the given parm in the where clause? Of course I don't know why the concern on posted_date nor why the limit is 1..... -
Why don't you do an echo of that session var before the query executes and see what it is? Are you sure that you did a session_start at the start of your script (good habit)?
-
oops - out of habit I wrote my fetch line using $row but you are using $obj. Please switch. And - I realize that I am using $err as an array but echo ing it incorrectly. Try: echo "<pre>",print_r($err,true),"</pre>";
-
Here's an example of how I would do it. Can't promise it's error free but you can see how it would look: session_start(); require_once ("dbcfg.php"); //Retrieve the EMAIL and PASSWORD entries from the user via POST $email = filter_var($_POST["email"], FILTER_VALIDATE_EMAIL); $password = htmlspecialchars($_POST["password"]); //If the EMAIL variable is null or empty then throw an error if (!isset($email) || strlen($email) == 0 || $email == null) $err[] = "Email Address cannot be empty.<br>"; //If the PASSWORD variable is null or empty then throw an error if (!isset($password) || strlen($password) == 0 || $password == null) $err[] = "Password cannot be empty.<br>"; //If the array has values, then return the errors back to the user if (isset($err)) { echo $err; exit(); } //********************** //Now check the user's credentials with what is in the database $pdo = new PDO(DSN,DBUSER,DBPASS); $sql = "SELECT ID, FNAME, LNAME, EMAIL, PWORD FROM users WHERE EMAIL=:email AND IS_INACTIVE = 0 LIMIT 1"; if (!$stmt = $pdo->prepare($sql)) { echo "Could not perform Prepare on query"; exit(); } if(!$stmt->execute([":email" => $email])) { echo "Query failed to execute:<br>"; echo print_r($stmt->errorInfo()) . "<br>"; } if(!$row = $stmt->fetch(PDO::FETCH_ASSOC)) { echo "No rows found matching email<br>"; exit(); } if (password_verify($password, $row["PWORD"])) // I assume this is correct? { $_SESSION['user_id'] = $obj["ID"]; $_SESSION['user_firstname'] = $obj["FNAME"]; $_SESSION['user_lastname'] = $obj["LNAME"]; $_SESSION['user_email'] = $email; echo "success"; } Just noticed that you don't check that the incoming form was even received properly. Need to check that POST was received to avoid un-set errors on the input gathering lines. Add this: if ($_SERVER['REQUEST_METHOD'] == 'POST') { (do your input receiving and editing) } // now check for any error messages