How to get data from MySQL With PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
CorfuVBProgrammer
Forum Newbie
Posts: 3
Joined: Wed May 03, 2006 11:49 am

How to get data from MySQL With PHP

Post by CorfuVBProgrammer »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hello to all . . .

I need some help to extract some data from MySQL database.

I have create a table with the following stracture

[syntax="sql"]CREATE TABLE `product` (
`prod_aa` int(10) unsigned NOT NULL auto_increment,
`prod_model` varchar(4) default '',
`prod_name` varchar(50) default '',
`prod_sort` varchar(70) default '',
`prod_full` varchar(255) default '',
`prod_price` varchar(12) default '0',
`prod_cat` varchar(5) default '',
`prod_price_vis` char(1) default '',
PRIMARY KEY (`prod_aa`)
) TYPE=MyISAM;
I use the following query to Insert data into the table

Code: Select all

"INSERT INTO `product` (`prod_aa`, `prod_model`, `prod_name`, `prod_sort`, `prod_full`, `prod_price`, `prod_price_vis`, `prod_cat`) VALUES (NULL, '" . $_POST['prod_model_id'] . "', '" . $_POST['prod_name'] . "', '" . $_POST['sort_desc'] . "', '" . $_POST['full_desc'] . "', '" . $_POST['prod_price'] . "', '" . $price_vis . "', '" . $_GET['catID'] . "')"
I use the following query to extract the data from the databse

Code: Select all

SELECT prod_aa, mod_name, mod_aa, prod_name, prod_sort, prod_full, prod_price, prod_price_vis FROM `product`, `models` WHERE prod_aa = 2 AND mod_aa = prod_aa
And use the following code to deslpay tha data in my page

Code: Select all

echo "<input name=\"prod_name\" type=\"text\" class=\"txtElm\" id=\"prod_name\" maxlength=\"50\" value=" . $RS6_ROWS['prod_name'] . " />";
So what is the problem. . . .

in the prod_name feald i storing a phrase.

for example "My name is Nikos"

In the database i have see that is stored the "My name is Nikos"

but when i try to desplay the phrase that i have store in database i'm getting only the first word of the phrase.

for example "My"

What can i do for that ? ? ?

Thanks a lot . . . .


feyd | Please use[/syntax]

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You don't have quotes around the value attribute's value, therefore only the first "word" will display in the field.
CorfuVBProgrammer
Forum Newbie
Posts: 3
Joined: Wed May 03, 2006 11:49 am

Post by CorfuVBProgrammer »

Thanks a lot my friend . . .

That was the error . . .

You are the best . . . :D
Post Reply