-
Posts
6,906 -
Joined
-
Last visited
-
Days Won
99
Everything posted by ginerjm
-
Ok - perhaps you now realize that your post is very difficult to understand. And that code - please don't do that again. How about you just write down what you are trying to do and leave out the "code" part. Just use English and tell us what you want to do and why it is being hard to do. And when you do finally post code on this forum, use the <> icon above your post to place the code into its own window and post REAL code, not a print or an 'image' so that we can tinker with it ourselves while trying to help you.
-
Then why not CALL them such Lastname and Firstname and Nickname instead of leaving up to us to solve it? (and don't use the word 'name') So when you make these last updates can we see a new dump of your table structures? And then we can get back to solving your original problem(s) now that we know what you are talking about?
-
Write a little script to make a connection to your database and run this script for each of your tables so we can see what you/we are dealing with. // set a table name to be shown $tbl_name = '25_man_pool_names'; // run an sql command to dump the structure $q = "describe $tbl_name"; $qrslts = $pdo->query($q); // display the results echo "<table border=1>"; echo "<caption>Table: $tbl_name</caption>"; while($row=$qrslts->fetch(PDO::FETCH_NUM)) echo "<tr><td>{$row[0]}</td><td>{$row[1]}</tr>"; echo "</table>"; Cut and paste the results here using the <> tags of course
-
Those are the REAL names of your columns??? What is the id column in your users table - the person's id? What is the id column in the comments table - the person's who wrote the comment? What is the id on the news table - the same person again? if so what is the author - the guy who it was copied from? Trying to understand the connections here.
-
And I don't understand what you are trying to say. What do you mean by "expand the table"? Is that you way of saying "add a record"? Show us the layout of your table. I'm gonna guess that it has the comment column, a column for the person who posted it and a column for the date/time that it was first saved and perhaps another for the latest update. Anything else? Show us the actual structure. That would be a good start
-
to make an EXE file out of a PHP script? Did not know one could even do this.
-
Minor point but since we are learning: You don't need () around the require or include statement require_once PATH . 'index.php';
-
It is not the delete button that is a concern. It is how to do your query for either a single person or all users/admins. You need to return something from the login function to tell you what to query. If it is an admin drop the where condition and just say "Where 1" which will give you all records.
-
Here is how I would do it. Some question about your use of columns 'id' and 'user_id'. if(login()) { $id = $_SESSION['id']; // assuming that login function sets this value altho the // the more normal approach would be to return it from the function $query = "SELECT user_id, id, name, comment FROM comment WHERE user_id=$id"; // Why is there a user id and an id column? $res = $conn->query($query); if($conn->num_rows($res) > 0) { while($row = $conn->fetch_assoc($res)) { // show all of the related comments that match the id given // you will have to add some code to determine if the id is the admin echo " <div id='img'> <form method='POST' action'dcomm.php'> <label>Name: <input type='text' name='username' value='{$row["name"]}'> </label> <label>Comment: <input type='text' name='comment' value='{$row["comment"]}'> </label> <input type='hidden' name='user_id' value='{$row["user_id"]}'> <input type='submit' name='btn' value='Delete Comment' onclick='return confirmDelete()'> </form> </div> <hr> "; } } else { echo "<h3>No comments for user id $id</h3>"; } } else echo "<h3>User is not logged in</h3>"; At the end you will have a set of divs on your screen that each contain a form with a button and they will each call your delete script with the id value provide by the POST array. I would add a js function to the screen's page that makes the user confirm the delete is to happen
-
People usually POST their code to show us what they are having problems with. Use the <> icon to place the code in and indicate the error messages you are getting and the line number that we s/b looking at. You don't need to to show us everything -- just enough for us to make sense of your true code (not the css/js or tons of html), just the php you are having a problem with. What kind of process is your delete button doing? Is it a submit that calls your php script and passes in the key of the record to be deleted? Do you do a confirm of the submit to ensure the user means to do this?
-
And in case you didn't get this from mac-gyver's post, your 'terms' field is completely Wrong. One does not (as in never) store data in this kind of format. Apparently you want to convert that 'terms' field to a 'qty' and a 'total' field
-
Although now I have seen something in the FPDF docs that UTF-8 is not recommended. Hmmmm....
-
Where did you download the zip file from? Perhaps this can help you. http://www.fpdf.org/ And I noticed that you are using a less-than-common character set. Probably from looking at out-dated code examples. Switch to UTF-8.
-
Did you read the instructions when you downloaded it? It is really very simple but, like all things involved with coding, one has to read the instructions.
-
Your script is poorly constructed. You are sending something to the client prior to the pdf content. No can do. Probably a blank line outside of php mode. One trick? Never Leave PHP mode in your scripts PS - what line does the error message give you? That IS the problem.
-
1 - please post all code using the <> icon above. 2 - strongly suggest using PHPMailer as your mail tool It will make what you are trying to do soooo much easier.[ 3 - please us the <> tool above to post your code. (Get the point?)
-
Call to undefined function Login_sucess()
ginerjm replied to Ehsan_collboy's topic in PHP Coding Help
More than a bit -
Call to undefined function Login_sucess()
ginerjm replied to Ehsan_collboy's topic in PHP Coding Help
I've asked for that already and it was ignored. Or not understood. -
Call to undefined function Login_sucess()
ginerjm replied to Ehsan_collboy's topic in PHP Coding Help
OK - I took the code from the topmost post of this topic (Sunday at 1:50pm) and it ran just fine. Commented out the query code and faked a result and it not only ran the function but output the message telling me that it failed on the query. So - the code seems to be written properly. I have included my version to see. if($login = Login_sucess('user','pswd')) { $_SESSION["login_msg"] = "Login Sucess "; header("Location: login.php"); exit(); } else { $_SESSION["login_msg"] = "Username/Password Incorrect Please Try Again...!"; header("Location: login.php"); exit(); } //************************************ function Login_sucess($Username, $Password) { global $cn; $sql = "SELECT * FROM admin WHERE username=:username AND password=:password LIMIT 1"; /* $stmt = $cn->prepare($sql); $stmt->bindValue(":username",$Username); $stmt->bindValue(":password",$Password); $stmt->execute(); $Result = $stmt->rowCount(); */ $Result = 0; if($Result == 1) return $Found_Account = $stmt->fetch(); else return null; } Note how I modified your results message to be stored in just one variable. Saw no reason to have a different one for simply a different value. I do hope that the OP posts his findings when he solves this riddle. Would like to know where he went wrong. -
Call to undefined function Login_sucess()
ginerjm replied to Ehsan_collboy's topic in PHP Coding Help
So maybe the OP should post the raw code in its entirety for us to read instead if loading through a require? -
Call to undefined function Login_sucess()
ginerjm replied to Ehsan_collboy's topic in PHP Coding Help
AND you did not give us ONE COMPLETE BLOCK of code to look at. You gave us what looks like two separate scripts containing each piece of code which could be your problem.