Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Retrieve A Data From My MySQL Database Using PHP And Save The Data In A Variable


How can I retrieve a data from my mySQL database using PHP and save the data in a variable in in my PHP code for example i have this table in the database

First name           Last Name
   Juan                  Punkista

I would like to store 'Juan' in variable $first and 'Punkista' in variable $last.




View Complete Forum Thread with Replies

Related Forum Messages:
How Do You Extract Data From The Database And Save It To A Variable
How do you take data out of the database for a particular field (the field will be of BLOB data type) and save it to a variable.?

View Replies !
Posting Variable Data Into MySQL Database
I have a form on my page with a few fields. For example reasons lets say one field is "FIRSTNAME" and the other is "LASTNAME" when my page is processed it take these two fields and make these two into one word "FIRSTNAMELASTNAME" I have a this data sent to variable ($names = FISTNAMELASTNAME).

How can I get this to post into my database from the variable so my insert will be "FIRSTNAMELASTNAME"

I have already established my database connection. I can get data from other forms fields directly into the database. So I guess what I am asking is how can I post the data from my varibale $names. What would be the correct line of code for it.

View Replies !
Use The $_POST Variable To Retrieve Data
If I want to pass a value I read from a file using firstPhpFile.php to something like secondPhpFile.php, how do I store this value so I can use the $_POST variable to retrieve it later? I know how to retrieve values from my HTML code using $_POST by using the HTML element's name but how do I do this if the variable is a PHP variable holding a value I need to pass to a different PHP file?

View Replies !
Is There A Another Way To Retrieve Data From My Database
Is there another way I can retrieve and display the data in the
database. Am completely exhausted by this script.

View Replies !
Retrieve Data From The Database And Populate
I know how to fill data in text boxes and submit to the database and retrieve from the database. But how do you retrieve data from the database and populate a drop down menu?

View Replies !
Retrieve Randomly Data From Database
I have store in a database some question with four answers for each question.
I want retrieve randomly 20 questions from the database. Also I have to mix the answers as I echo them out… Do you have any idea how can I do this?

View Replies !
Retrieve Data From Table With Multiple Returned Variable
I am trying to set up a function to recalculate prices for my products - (per product that is) The problem I am having is that I have a table that stores the prices for each client type (so one product can have multiple prices) so I need to be able to recalculate the price for each client. Code:

View Replies !
Retrieve Data From Mysql
i have this code:
<?php
// Connects to your Database
mysql_connect("localhost") or die(mysql_error());
mysql_select_db("eurialz") or die(mysql_error());

//This code runs if the form has been submitted
if (isset($_POST['submit'])) {

//This makes sure they did not leave any fields blank
if (!$_POST['username'] | !$_POST['pass'] | !$_POST['pass2'] | !
$_POST['name'] | !$_POST['gender'] ) {
header("location: register.php?error=yes");
exit;}

// checks if the username is in use
if (!get_magic_quotes_gpc()) {
$_POST['username'] = addslashes($_POST['username']);}
$usercheck = $_POST['username'];
$check = mysql_query("SELECT username FROM users WHERE username =
'$usercheck'")
or die(mysql_error());
$check2 = mysql_num_rows($check);

//if the name exists it gives an error
if ($check2 != 0) {

header("location: register.php?error2=yes");
exit;

}

// this makes sure both passwords entered match
if ($_POST['pass'] != $_POST['pass2']) {
header("location: register.php?error3=yes");
exit;
}

// here we encrypt the password and add slashes if needed
$_POST['pass'] = md5($_POST['pass']);
if (!get_magic_quotes_gpc()) {
$_POST['pass'] = addslashes($_POST['pass']);
$_POST['username'] = addslashes($_POST['username']);
}

// now we insert it into the database
$insert = "INSERT INTO users (username, password, name, gender,
dobmonth, dobday, dobyear)
VALUES ('".$_POST['username']."', '".$_POST['pass']."', '".
$_POST['name']."', '".$_POST['gender']."', '".$_POST['dobmonth']."',
'".$_POST['dobday']."', '".$_POST['dobyear']."')";
$add_member = mysql_query($insert);
header("Location: newmember.php");
?>

View Replies !
Save Session Shopping Cart Data Into Database
i have a running shopping cart and i need to save the data in the cart to a orders database. the items in the cart are stored in a session by their id and then are displayed in the cart by sending a query to the items database finding their name, price and product code. how can i put the carts data into a db called orders. Code:

View Replies !
Retrieve Data From Mysql Table And Put A Hyperlink For Download
I have created a database and a table and have stored the information in mysql table.
Now my question is how do I retrieve that data from the my sql table and have a php page that when someone goes to say:download.php, he/she will be able to download the data from my mysql table? Also what if I have multiple tables in mysql that I want to be able to download from the php file?

View Replies !
Retrieve Data From Mysql And Send Email To User
does anyone know how i could make php or sql retrieve data from mysql database and then send an email to the respective user the info that is in the database?

like a user request for forget password, i want the user to be able to receive a mail from me.

i have the mail stuff done and all the stuff are on my laptop (localhost) using php and apache.

View Replies !
Save Form Data - How To Temporarily Store The Form Data Of Page 1
i have separated a form into 3 separate php pages as step 1, step 2 and step 3. i would like to know how to temporarily store the form data of page 1 when the user is moving onto page 3 after completing form 2 on page 2?? then retreive and send the data of all 3 forms together in one email to the webmaster when the user clicks submit on page 3 after completing the 3rd form as well as the previous 2.

View Replies !
Naming A Variable By The Data In Mysql
I am trying to figure the best way to automate creation of radio buttions in an edit user page. If that can be accomplished, then it would need to also go in the sql statement below, the variable declaration, and the hidden input. Code:

View Replies !
Problem In Matching Php Variable Into Mysql Data
I would like to match php variable into mysql data, I have this code

$query="select DISTINCT artist from music WHERE artist REGEXP '$j'";

the variable does not match any value in mysql data instead the variable take a value from A-Z and match to mysql data.

View Replies !
Is It Data From The TEST Or From PROD And Will It Be Data From Database1 Or From Database 2?
<?php

I have a question about 2 connection strings to a ms sql database.

# TEST DATABASE

$connecttest = MSSQL_CONNECT("TEST", "sa", "123456") or exit("Unable to
connect to MS SQL Server at 10.0.10.58");

$select = mssql_select_db ("database1",$connecttest) or exit("Unable to
select database TEST");

# PRODUCTION DATABASE

$connectprod = MSSQL_CONNECT("PROD", "sa", "654321") or exit("Unable to
connect to database at 10.0.10.59");

$select = mssql_select_db ("database2",$connectprod) or exit("Unable to
select database PROD");

$SQL = "SELECT * FROM table1";

$RESULT = mssql_query($SQL);

// What data will i find here? Is it data from the TEST or from PROD and
will it be data from database1 or from database 2?

?>

View Replies !
Using MS Access To Hold The Data And PHP To Collect The Data From The Database
I am using MS Access to hold the data and PHP to collect the data from the database and display it on a website. I've got the results displaying in the normal way with data being displayed in a linear manner e.g. Code:

View Replies !
How To Use PHP To Retrieve Data From A PDF
I am looking for a tutorial, script about how to use PHP to retrieve data (Ex: filled customer input in a PDF file) from a PDF file and store it as a XML file.

View Replies !
Cannot Retrieve Data In Utf-8 From Php
I have a IIS server with php3 installed. I have SQL server database
and data stored in unicode format (nvarchar fields). In header of my
php I have the meta: <meta HTTP-EQUIV="content-type"
CONTENT="text/html; charset=UTF-8">.

I have the following problem:

- I trie to do a query using ODBC (version 3.525.1022.0) and SQL
Server odbc driver (version 200.85.1022.00). The query doesn't
retrieve information in utf format and accents and extra characters
aren't showed correctly.

- I trie to di the query usin native OLE DB. I use mssql funtions and
the problem is the same.

If I install php4 and I use "new
COM("ADODB.Connection",NULL,CP_UTF8);", then it works correctly.

Anybody knows if its posible to retrieve data from sql-server in utf-8
format using php3?

I see in other postings that odbc driver only accept utf-8 in version
3.7 or higher? Is it true? If is true, where I can download odbc
driver 3.7?

View Replies !
Retrieve The Data
All i want to do is retrieve the data from this pull down menu. and print it on a different form. hear is my pull down menu what do u reckon

<body>
<form action="calender.php" method="post">

<?php

//make the months array 
$months = array (1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');

//make the days and years array 
$days = range (1, 31);
$years = range (2007, 2020);

//make that months pull down menus
echo '<select name="months">';
foreach ($months as $key => $value) {

View Replies !
Retrieve Data From SQL
I am totally green in PHP and have recently bought a script which I hope to modify to suit my requirements. I am trying to use a SEARCH button with 'built-in' conditons to call up data. Try the search function but as it requires a form to work, it does not suit my needs. What I am looking at is for my visitor to click on a button and the results are displayed.




View Replies !
Retrieve Data
I'm currently run the following script:

<?php
mysql_connect("**", "**", "**") or die(mysql_error());
mysql_select_db("**") or die(mysql_error());
$data = mysql_query("SELECT * FROM world_cup WHERE username ='$username'")
or die(mysql_error());
while($info = mysql_fetch_array( $data ))
if ( $info['a'].$info['b'] == $info['c'].$info['d'] ) {
echo $info['e'];
}
?>

What do I need to change if 'a' and 'b' were on another table ie world_cup_scores?

View Replies !
Use Php To Retrieve Data
I have a table containing 3 columns 1.Slno(primary key) 2. Authors 3Books. Now in my website one page displays the alphabet listing, one each for authors and books. If I click one letter in the authors, I should get list of authors whose name starts with that letter. If I click the letter in the alphabet listing of Books, I should get list of books starting with that letter.

View Replies !
Data Not Posting To My Database Php/mysql
I am having a problem postion data from my form into my database. My users visit my site and fill out a form which is suppose to go into my mysql. I check phpMyAdmin to see if the data got there but nothing. Below is my Code. could someone help me out. Code:

View Replies !
Mailing Data From Mysql Database
I have searched, but didnt find what I need. I am trying to mail someone if a user changes data in my MySQL database, which is being written to by a php script. All is set up, just need to be notified of what data got changed.

View Replies !
Writing Data To MySQL Database Using PHP
Can anyone tell me why the following code isn't working?

$dbh = mysql_connect($host,$user,$pass) or die("Couldn't connect...");
$selected = mysql_select_db($db,$dbh);
$name = $_GET['name'];
$state = $_GET['state'];
$desc = $_GET['desc'];
$lat = $_GET['lat'];
$lng = $_GET['lng'];
$result = mysql_query("INSERT INTO re_cities (name, state, description,
lat, lng) VALUES ('$name','$state','$desc','$lat','$lng')");

The script doesn't die when I attempt to connect so I'm assuming that
isn't the problem. I'm pretty sure I also get a result because the
following code echoes "City Add Successful".

if ($result) {
echo "City Add Successful";
} else {
echo "City Add Unsuccessful";
}

However, the data doesn't show up in the database.

View Replies !
Check Mysql Database For Data
Need to check if some info matches from mysql database in two tables to see if the current session user is on a friends list for the profile page he or she is viewing. If they do not exist in field, return an error. Here is the structure and what i got so far: Code:

View Replies !
Delete Data From MySQL Database
I am new to PHP and MySQL but I have setup a MySQL database. I can view the information in an HTML table using PHP scripts and can delete an entry form the database table, but what i need to do is to be able to delete an entry by selecting a radio button next to the relevent information however when i try to add a form in the PHP script i get an error.

View Replies !
Selecting Data From Database(php/mysql).
Alright I've come to a point where I only want a DB for settings and nothing based on ID's on a sql table.

instead of say:

$setting = mysql_query("SELECT * FROM settings WHERE id='1' ");

Now i broken up all the sql into seperate settings like so:

settingname | value

boardonline | no

Thats basicaly how I got the sql set up instead of having it all in one table row I have them in seperate rows.

So how do I go about selecting data from SQL not based on ID but mainly on setting name? would I do

$settings = mysql_query("SELECT * FROM settings");
$settings = mysql_fetch_array($settings);
$settings['boardonline'][1];//would echo true/false according to my sql table instead of the row name?

View Replies !
Retreive Any Data From Mysql Database
I have been struggling to retreive any data from mysql database and then show it on a webpage.

<?
$username="root";
$password="";
$database="car";

mysql_connect(localhost,$username,$password);
mysql_select_db($database) or die( "Unable to select database");


$sql = "SELECT * car";
$query = mysql_query($sql);

while($row = mysql_fetch_assoc($query)){
    echo $row['name'].'
.........................................

View Replies !
Recieve Data From MySql Database
I am making a user registration that will automatically make the username the next number after the last username, and I would like after they register for the php to recieve pilot_id from the last row of the table and show it to the user, this is my current code to display successful: Code:

View Replies !
Pull Data From MySQL Database
I'm running a PHP script called phpOnDirectory on thsi website i'm creating so that people can have their companies listed in our directory. Currently, the script displayes the directory in a left-hand column, and the results in the center column.

When you access a category, the script displays the number of listings withing that category in parenthesis next to the title. What my client wants is to take that out(easy enough) and have the totals listed next to the categories on the left. Code:

View Replies !
Using A Hyperlink To Retrieve Data? Is It Possible Without?
I was wondering if it is possible to get data from a database using a hyperlink instead of a form? My situation is I have a page with a list of products (data from a mysql table) and I want to keep the info on the page small so I have limited the description and left out some info. what I want is a link at the bottom of each product that says "more details" and when clicked it creates a new page on the fly to show more info. is it possible to do this without javascript? If so How.

View Replies !
Can't Retrieve Data From The Net With File_get_contents ?!
for some reason i keep getting :

Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed:
Temporary failure in name resolution in
/home/rob/www/php/filegetcontents2.php on line 3

Warning:
file_get_contents(http://folding.stanford.edu/teamstats/team92.txt): failed
to open stream: Resource temporarily unavailable in
/home/rob/www/php/filegetcontents2.php on line 3

when trying to retrieve a page of text (stats for a distributed computing
project) from the Net like this :

$personal =
file_get_contents("http://folding.stanford.edu/teamstats/team92.txt");

i also tried implode/file ... same error.
but when i fill in the URL in Mozilla it is retrieved just fine and no
'temporary failures' at all ?!

what could be going wrong with the name resolution ?

View Replies !
Send Data To Db And Retrieve
After a visitors submits the form, the data is saved in database table in a new row and a unique ID will be given to that row.

I am trying to work with the data after it has been created by retrieving the ID. I want to send the ID to payment page, and after the payment is complete, change one field in that row to show that the payment is done). I don't know how can I get the ID for that record back from the database so I pass it on to next script.

View Replies !
Retrieve Data From An XML File?
How can I use PHP to retrieve data from an XML file?

View Replies !
Retrieve Form Data
All I am trying to do is use a form and insert the data from the form to mysql db. The code below shows the data is retreived and displayed properly but does not add any new records to the "Test" table in the database.

<?php
/* Start of PHP3 Script */
/* Data of SQL-server */
$server="server";/* Address of database server*/
$user="user"; /* Database username */
$password="password"; /* Database Password*/
$database="database"; /* name of database */
$table="Test"; /* Name of table, you can select that */

$county=$_POST['county'];
$township=$_POST['township'];

/* Accessing SQL-server */
...............

View Replies !
Retrieve Randomly Data
I have store in a database some question with four answers for each question. I want retrieve randomly 20 questions from the database. Also I have to mix the answers as I echo them outâ€.

View Replies !
Retrieve Data From Form?
I am doing an exercise to retrieve data from form. I followed this example. I didn't follow the exact coding order. I couldn't see the value for first_name text field. Code:

View Replies !
Name Of File That Stores MySQL Database Data
I need to recover my database from a backup after a system crash. What is the file name (extension) that stores the database information?

View Replies !
Import Data From Access Database To MYSQL
I have some data in access database. I wish to import it (keeping the same structure) in MySQL.

Also I want to know what will be procedure for importing data from databases like Oracle, Sybase, Informix etc.

View Replies !
Entering Data From A Form To A Mysql Database
I'm trying to enter data from a form with the fields name and email into a mysql database called newsletter, as you guess it's a newsletter sign up. this what I have at the moment: Code:

View Replies !
Inserting Data Into A Mysql Database Through A Php Interface
This questions relates to inserting data into a mysql database through a php interface that uses a normal html form...

If I press return a couple times to make a new paragraph when filling out the text field, it never puts those line breaks into the database.. it always returns the data as one long paragraph..

How do I make it so that when a user presses return in the form, the output of data from the database knows there are supposed to be line breaks there??

View Replies !
Use A Form To Insert Data Into A MySQL Database
When you use a form to insert data into a MySQL database, how can you
set it up so that the fields are not sent via the address bar.

For example:

page1.php
___________
<form action="page2.php">
<input type="text" value="whatever">
<input type="submit" value="Send">

page2.php
___________
// Inserts variable $whatever into database.

The problem that I have is that I don't want the address bar to appear
as http://web/page2.php?whatever=cheese but as http://web/page2.php

View Replies !
Insert Data From Form To MySQL Database
I have run createTable.php and everything is created. Now I want to run insertData.php. I want the user to enter stuff in the form & everything must be fill in before they click the submit button. It will call submitData() & all the information was enter will insert into the database. PHP Code:

View Replies !
Separate Extract Data From A MySQL Database
Is it at all possible to extract date from a MySQL database with a while loop and assign each value extracted to a new unique variable?

View Replies !
Structure Of Mysql Database And Sending Data Via Php
I have set up a database with a single table called referrals. It holds records of families referred for their children to receive services from my organization. The form collects one parent's name and anywhere from 1 to 6 kids (sometimes more).

So right now I have a single table with the fields parentLastName, child1name, child2name, etc. Code:

View Replies !
Problems Checking If Data Already In Mysql Database
I have been trying to figure it out myself and am at my wits-end. I am trying to test if a particualr data is already in mysql database before I will add the data to it. Code:

View Replies !
Problems Adding Data Into Mysql Database
Ok, i'm designing a site for a company that has a vendor directory. Up until now I've had no problems, but basically the vendors are sorted by category,a nd then can be filtered by region. Now, I went in and added all of the UK regions instead of just england, and now I get these errors when I try to add a site.

Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home/weddset2/public_html/mailto.php on line 19

Warning: Cannot modify header information - headers already sent by (output started at /home/weddset2/public_html/mailto.php:19) in /home/weddset2/public_html/mailto.php on line 53

I've attached the 2 PHP files renamed as text files that are responsible for adding the vendors so hopefully one of you amazing coders out there can tell me what the heck is going on.

View Replies !
Resource ID #5 - Select Data From MySQL Database Using PHP
I'm trying to select data from mySQL database using PHP and I encountered one problem. When I printed out the result after selecting data, it printed out "Resource ID #5" instead of the actual data. How can I fix this problem. Code:

View Replies !
Retrieve Data Into Html Form
I want to retrieve fields from mysql table into html form to update those fields.

View Replies !
Retrieve Data From Unlimited Level
I have a function to create unlimited sub sub folders, and now i want to retrive the sub sub folders according to their level in a drop down box. something to be display in a drop down box like below for user to select:

View Replies !
Php Forms - Retrieve Data And Update Them With New
i have 2 forms that communicate each other. the 1st has a drop down list with the categories and the 2nd form has another drop down list that i want to take values depends on the selection at the first drop down list. i have created this with get method. the data that the drop down lists have are in 2 different tables in mysql server.

i want retrieve data and update them with new but when i change the selection at the first drop down list all data at the second form are gone. what i can do to keep data in position? i attach you the code if you dont understand somethng. Code:

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved