Page 1 of 1

transmit and retrieve data from mySql for a specific cstmr.

Posted: Fri Jun 26, 2009 1:48 pm
by podarum
I'm trying to pass through data to mySQL and then back from mySQL to another php page..but only the values that apply to that one customer in that session.. So let me explain... A customer comes to my site and fills in a form, then he gets directed to a confirmation.php page and his data is trnsmitted to mySQL...I want to retrieve his information from mySQL in yet the 3rd page process.php.. kind of like FormPage->Confirm.php->MySql->Process.php .. Does anyone know how I can achieve this? The reason is because I want to put in PayPal in between Confirm.php and Process.php .. I am able to trnsmit the data to mySql , so I've gotten that far, I just don;t know how to retrieve it and only ask for the pertaining customer info. Thanks

Re: transmit and retrieve data from mySql for a specific cstmr.

Posted: Fri Jun 26, 2009 2:53 pm
by califdon
With no disrespect, you are asking such a basic question that I must assume that you know absolutely nothing about using a database. That's nothing to be ashamed of, it's just a particular technical area that you haven't yet studied. But you're not going to learn it by asking here in a developer's forum, you need to read some tutorials or books or attend a class. There are some good online tutorials, although you would learn much more, and more quickly, if you could attend a class. Try searching for terms like php mysql tutorial basic.

Re: transmit and retrieve data from mySql for a specific cstmr.

Posted: Fri Jun 26, 2009 3:15 pm
by podarum
Yes I admit I don't know much about databases, but my question is not as much about databases as much as it is about linking some sort of user id to be able to be identified throughout the pages that folow.. like using a cookie or something like that.. and thst is not widely covered in classes or books...

Re: transmit and retrieve data from mySql for a specific cstmr.

Posted: Fri Jun 26, 2009 3:48 pm
by califdon
Oh, you're talking about sessions. It is indeed widely explained and discussed online. You only need to use that term in your searches. Just Google php sessions.

Re: transmit and retrieve data from mySql for a specific cstmr.

Posted: Sat Jun 27, 2009 8:13 am
by podarum
Thakns Califdon.. it worked using sessions..I was able to create a session_Id and pass it along to my next page. Now I have some questions, it seems you know about this.. 1) How can I customize the session_id to be more compact and look like an account number format I choose? and 2) How can I pass along other information as well, not just the session_id, like variables I have from my form and lastly 3) How can I pass this session_id to my mySql?

Thanks.

Re: transmit and retrieve data from mySql for a specific cstmr.

Posted: Sat Jun 27, 2009 11:29 am
by califdon
podarum wrote:Thakns Califdon.. it worked using sessions..I was able to create a session_Id and pass it along to my next page. Now I have some questions, it seems you know about this.. 1) How can I customize the session_id to be more compact and look like an account number format I choose? and 2) How can I pass along other information as well, not just the session_id, like variables I have from my form and lastly 3) How can I pass this session_id to my mySql?

Thanks.
The session_id is a temporary internal identification that has meaning only during that session, so you shouldn't store it in a database. Generally you can ignore the value of the session_id, in most cases. Once you have a session open, you can add whatever session variables you want, with whatever names and values you want. In other words, you might decide to store session variables like username, password, page, accountnumber, etc. Then, during that session, other scripts that begin with session_start() can read or write those variables. Take a look at http://www.tizag.com/phpT/phpsessions.php.

Re: transmit and retrieve data from mySql for a specific cstmr.

Posted: Sun Jun 28, 2009 12:39 am
by podarum
I'm still having some problems with passing data over to another php page. For example, I have a form with 20 user variables, and I use session_start (); to move these variables (and the values) to a process.php page. I want to now continue sending the same variables and it's values to yet another process2.php.
I've made it work, but it seems like way too much coding.... How can I make it simpler.?.. and no, that's not a typo on process2.php, that I have to type it twice for some reason for it to work...

Form Page

Code: Select all

<form action="process3.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
<label for="Score"></label>
<input type="text" name="Score" id="Score">
Process.php

Code: Select all

<?php
session_start();
$_SESSION[Score]=$_POST[Score];
$Score = $_POST['Score'];
?>
Process2.php

Code: Select all

<?php
session_start();
print "Your Score is : " .$_SESSION[Score'];
?>
<?php
print "Your Score is : " .$_SESSION['Score];
print "<br />"
?>

Re: transmit and retrieve data from mySql for a specific cstmr.

Posted: Sun Jun 28, 2009 12:24 pm
by califdon
If your actual code is the same as what you posted here, your problem is simply syntax. You have omitted the required quotation marks in several places.

I strongly advise you to use a code editor that highlights syntax and will often reveal such slips immediately. I have found the open source Windows editor PSPad to meet my needs.

When you post code here in the forums, please use [syntax=php]...[/syntax] or the equivalent [syntax=php]...[/syntax] tags to surround your code. That would have also revealed your mistakes.

I don't know what you mean about "way too much coding" or making it simpler. In your 3rd script, the duplication was necessary only because the first time, the error was such that it didn't even execute. When something doesn't work, it is better to find out what's wrong, not just write it a second time.