Re: [PHP] Programming question - New to PHP

2006-07-02 Thread Russbucket
On Wednesday 28 June 2006 19:55, Chris wrote:
 Russbucket wrote:
  I took an example  of a script from the PHP documentation and try to
  connect to my database.   If I leave in the or die part of line 3, I get
  nothing, if I comment out that part I get the echo message on line 4.
 
  ?php
  // Connecting and selecting the database
  $conn = mysql_connect ('localhost', 'finemanruss', 'XXXl') or die
  ('Could not connect :  '  . mysql_error());
  echo 'Connected successfully';
  mysql_select_db (Lions, $conn);
 
  // Preform SQL query
  $query = 'SELECT * FROM Moses_Lake_Lions';
  $result = mysql_query ($query) or die ( 'Query failed;   '  .
  mysql_error()); ?
 
  I know line three works without the or die part since I have a 2nd script
  that is almost the same (no or die) and it retrieves info from my DB.

 Try it the same as the php manual page:

 $conn = mysql_connect('');
 if (!$conn) {
die(Could not connect:  . mysql_error());
 }

 --
 Postgresql  php tutorials
 http://www.designmagick.com/
Chris thanks for the response. I got this working and solved a couple other 
issues. Now just have one I'm working on where thedata is not being sorted 
correctly. I will be looking at that tommorrow. 

Thanks again for the response.
-- 
Russ

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Programming question - New to PHP

2006-06-30 Thread Richard Lynch
On Wed, June 28, 2006 6:58 pm, Russbucket wrote:
 I took an example  of a script from the PHP documentation and try to
 connect
 to my database.   If I leave in the or die part of line 3, I get
 nothing, if
 I comment out that part I get the echo message on line 4.

 ?php
 // Connecting and selecting the database
 $conn = mysql_connect ('localhost', 'finemanruss', 'XXXl') or die
 ('Could
 not connect :  '  . mysql_error());
 echo 'Connected successfully';
 mysql_select_db (Lions, $conn);

 // Preform SQL query
 $query = 'SELECT * FROM Moses_Lake_Lions';
 $result = mysql_query ($query) or die ( 'Query failed;   '  .
 mysql_error());
 ?

 I know line three works without the or die part since I have a 2nd
 script that
 is almost the same (no or die) and it retrieves info from my DB.

 Can anyone point me to some tips or solutions to the or die problem?
 This
 script is located in the mysql ref section of the php manual. I'm
 using php5
 on SUSE Linux 10.0 with a mysql database.

Odds are REALLY GOOD that the or die is fine...

Try this:  Change line 4 to be:
echo 'Successfully connected: ', $conn;

If $conn shows something like Resource #4 then you know you have a
good connection.  If it shows false or nothing, then you know the
connection is not working, and or die() is doing the right thing.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Programming question - New to PHP

2006-06-29 Thread Dave Goodchild

On 29/06/06, Chris [EMAIL PROTECTED] wrote:


Russbucket wrote:
 I took an example  of a script from the PHP documentation and try to
connect
 to my database.   If I leave in the or die part of line 3, I get
nothing, if
 I comment out that part I get the echo message on line 4.

 ?php
 // Connecting and selecting the database
 $conn = mysql_connect ('localhost', 'finemanruss', 'XXXl') or die
('Could
 not connect :  '  . mysql_error());
 echo 'Connected successfully';
 mysql_select_db (Lions, $conn);

 // Preform SQL query
 $query = 'SELECT * FROM Moses_Lake_Lions';
 $result = mysql_query ($query) or die ( 'Query failed;   '  .
mysql_error());
 ?

 I know line three works without the or die part since I have a 2nd
script that
 is almost the same (no or die) and it retrieves info from my DB.

Try it the same as the php manual page:

$conn = mysql_connect('');
if (!$conn) {
   die(Could not connect:  . mysql_error());
}

You may be logging the errors. Tty echoing the value of the resource
($conn) - it should be an integer.





--
http://www.web-buddha.co.uk
http://www.projectkarma.co.uk


RE: [PHP] Programming question - New to PHP

2006-06-29 Thread Jeremy Schreckhise
Try
$link = mysql_connect('localhost',$youruser,$yourpassword) or die();
mysql_select_db('yourdb'); 

$query = 'SELECT * FROM Moses_Lake_Lions';
if(!$result = mysql_query ($query,$link))
{
// do error checking here
}

Jeremy Schreckhise, M.B.A.  

-Original Message-
From: Russbucket [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 28, 2006 6:58 PM
To: PHP General
Subject: [PHP] Programming question - New to PHP

I took an example  of a script from the PHP documentation and try to connect

to my database.   If I leave in the or die part of line 3, I get nothing, if

I comment out that part I get the echo message on line 4. 

?php
// Connecting and selecting the database $conn = mysql_connect ('localhost',
'finemanruss', 'XXXl') or die ('Could not connect :  '  .
mysql_error()); echo 'Connected successfully'; mysql_select_db (Lions,
$conn);

// Preform SQL query
$query = 'SELECT * FROM Moses_Lake_Lions';
$result = mysql_query ($query) or die ( 'Query failed;   '  .
mysql_error());
?

I know line three works without the or die part since I have a 2nd script
that is almost the same (no or die) and it retrieves info from my DB.

Can anyone point me to some tips or solutions to the or die problem? This
script is located in the mysql ref section of the php manual. I'm using php5
on SUSE Linux 10.0 with a mysql database.

Thanks in advance.
--
Russ

--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Programming question - New to PHP

2006-06-29 Thread Russbucket
On Thursday 29 June 2006 06:29, Jeremy Schreckhise wrote:
snip
 Try
   $link = mysql_connect('localhost',$youruser,$yourpassword) or die();
   mysql_select_db('yourdb');

   $query = 'SELECT * FROM Moses_Lake_Lions';
   if(!$result = mysql_query ($query,$link))
   {
   // do error checking here
   }

 Jeremy Schreckhise, M.B.A.

 -Original Message-
 From: Russbucket [mailto:[EMAIL PROTECTED]
Thanks I'll try that.
-- 
Russ

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Programming question - New to PHP

2006-06-28 Thread Ligaya Turmelle

Russbucket wrote:
I took an example  of a script from the PHP documentation and try to connect 
to my database.   If I leave in the or die part of line 3, I get nothing, if 
I comment out that part I get the echo message on line 4. 


?php
// Connecting and selecting the database
$conn = mysql_connect ('localhost', 'finemanruss', 'XXXl') or die ('Could 
not connect :  '  . mysql_error());

echo 'Connected successfully';
mysql_select_db (Lions, $conn);

// Preform SQL query
$query = 'SELECT * FROM Moses_Lake_Lions';
$result = mysql_query ($query) or die ( 'Query failed;   '  . mysql_error());
?

I know line three works without the or die part since I have a 2nd script that 
is almost the same (no or die) and it retrieves info from my DB.


Can anyone point me to some tips or solutions to the or die problem? This 
script is located in the mysql ref section of the php manual. I'm using php5 
on SUSE Linux 10.0 with a mysql database.


Thanks in advance.
You want the or die part in... otherwise you are being told you are 
connected when you aren't.  Though I do not know why you would have no 
output.  Maybe you are logging messages instead of displaying them.


Respectfully,
Ligaya Turmelle
--

life is a game... so have fun.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Programming question - New to PHP

2006-06-28 Thread Chris

Russbucket wrote:
I took an example  of a script from the PHP documentation and try to connect 
to my database.   If I leave in the or die part of line 3, I get nothing, if 
I comment out that part I get the echo message on line 4. 


?php
// Connecting and selecting the database
$conn = mysql_connect ('localhost', 'finemanruss', 'XXXl') or die ('Could 
not connect :  '  . mysql_error());

echo 'Connected successfully';
mysql_select_db (Lions, $conn);

// Preform SQL query
$query = 'SELECT * FROM Moses_Lake_Lions';
$result = mysql_query ($query) or die ( 'Query failed;   '  . mysql_error());
?

I know line three works without the or die part since I have a 2nd script that 
is almost the same (no or die) and it retrieves info from my DB.


Try it the same as the php manual page:

$conn = mysql_connect('');
if (!$conn) {
  die(Could not connect:  . mysql_error());
}

--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php