select * not showing all!

entry showing after select * from table

Page 1 of 1

7 Replies - 1471 Views - Last Post: 30 April 2007 - 01:37 AM Rate Topic: -----

#1 rpjd  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 88
  • Joined: 08-March 07

select * not showing all!

Posted 28 April 2007 - 06:23 AM

What would prevent a
select * from table


statement from displaying all entries in a table?
My situation is. I am using a php script via an xmlhtprequest to insert data from a php webpage form into my postgresql database. Before submitting the data, I had only 1 entry in my table. I submitted the form data. In postgresql I executed the above select statement which displayed only 1 entry, despite saying there were 2 entries. Does anyone have any idea what is causing this?

rpjd

Is This A Good Question/Topic? 0
  • +

Replies To: select * not showing all!

#2 girasquid  Icon User is offline

  • Barbarbar
  • member icon

Reputation: 108
  • View blog
  • Posts: 1,825
  • Joined: 03-October 06

Re: select * not showing all!

Posted 28 April 2007 - 11:23 AM

Are you using a web interface like phpMyAdmin? I find that when I'm using phpMyAdmin, it tends to automatically append a LIMIT clause to my statements.
Was This Post Helpful? 0
  • +
  • -

#3 rpjd  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 88
  • Joined: 08-March 07

Re: select * not showing all!

Posted 28 April 2007 - 12:21 PM

View Postgirasquid, on 28 Apr, 2007 - 11:23 AM, said:

Are you using a web interface like phpMyAdmin? I find that when I'm using phpMyAdmin, it tends to automatically append a LIMIT clause to my statements.

I am using postgresql v8.2 I start it with these from the start menu shotcuts
C:\WINDOWS\system32\net.exe start pgsql-8.2,
then
C:\postgresql-8.2.3-1\bin\psql.exe -h localhost -p 5432 postgres "MyName".
I use the CLI, not everly familiar with pdAdminIII.

I am updating postgres using php scripts via an xmlhttprequest, so I am trying to fugure if the problem it with that. What is bugging me is that the first time I added a row to the table using this method, the select statement confirmed 2 row(s), but only showed one. As far as I am aware the number of rows does NOT include the column headings. This is the result of
select * from customer;

	   name		|	address	 | contact_no  
-------------------+----------------+-------------
 Richard Dunne Ltd | Dublin Ind Est | 086-1234567
				   |				| 
(2 rows)



Any thoughts?
Was This Post Helpful? 0
  • +
  • -

#4 ahmad_511  Icon User is offline

  • MSX
  • member icon

Reputation: 131
  • View blog
  • Posts: 722
  • Joined: 28-April 07

Re: select * not showing all!

Posted 28 April 2007 - 03:44 PM

Hi
If you can post the part of your php script where you excuting Mysql query, so maybe i can help
Because i've finished working on some thing like that and every thing working fine.
Was This Post Helpful? 0
  • +
  • -

#5 rpjd  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 88
  • Joined: 08-March 07

Re: select * not showing all!

Posted 28 April 2007 - 04:45 PM

View Postahmad_511, on 28 Apr, 2007 - 03:44 PM, said:

Hi
If you can post the part of your php script where you excuting Mysql query, so maybe i can help
Because i've finished working on some thing like that and every thing working fine.

This is the script that I am working with. I am just trying to convert/pass the javascript variables to php variables. As I am passing them with the URL I am using GET.
<?php 
$connect=pg_connect("dbname=DatabaseName host=localhost user=User password=password");
if (!pg_connection_busy($connect))
	{
	$partnumber = $_GET[partnumber];
	$description = $_GET[description];
	$vatrate = $_GET[vatrate];
	$price = $_GET[price];
	$level = $_GET[level];
	$result=pg_exec($connect, "insert into parts values('$partnumber', '$description', '$vatrate', '$price','$level');");
	echo "part added";
	}
?>


The script is executing its not doing anything. If I can manage to pass the variables it should be fine.
Any thoughts?

rpjd
Was This Post Helpful? 0
  • +
  • -

#6 snoj  Icon User is offline

  • Married Life
  • member icon

Reputation: 84
  • View blog
  • Posts: 3,564
  • Joined: 31-March 03

Re: select * not showing all!

Posted 28 April 2007 - 06:38 PM

Fix your arrays.
Was This Post Helpful? 0
  • +
  • -

#7 ahmad_511  Icon User is offline

  • MSX
  • member icon

Reputation: 131
  • View blog
  • Posts: 722
  • Joined: 28-April 07

Re: select * not showing all!

Posted 29 April 2007 - 08:32 PM

Hi again;
I thing the problem is the way your're trying to retrive data with $_GET,and there is an explanation:
you used this code: $partnumber = $_GET[partnumber];
When you have to use this code instead:$partnumber = $_GET['partnumber'];
did you see the litle single qoutations?! that's it.
now you have to add these qoutes to all of $_GET[] Array keys.
Don't ever forget about the litle things.
I hope it works;
Was This Post Helpful? 0
  • +
  • -

#8 rpjd  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 88
  • Joined: 08-March 07

Re: select * not showing all!

Posted 30 April 2007 - 01:37 AM

View Postahmad_511, on 29 Apr, 2007 - 08:32 PM, said:

Hi again;
I thing the problem is the way your're trying to retrive data with $_GET,and there is an explanation:
you used this code: $partnumber = $_GET[partnumber];
When you have to use this code instead:$partnumber = $_GET['partnumber'];
did you see the litle single qoutations?! that's it.
now you have to add these qoutes to all of $_GET[] Array keys.
Don't ever forget about the litle things.
I hope it works;

ahmad_511 I figured out the problem, in addition to you diagnosis, I was missing ampersands in my poststring.
I was using
"url?var=valuevar=value"


when I should hae been using
"url?var=value&var=value"



cheers
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1