[PHP-DB] PHP Sessions

2005-04-14 Thread Ian McGhee
Hi All, 

 

I have been looking into PHP sessions and I have noticed you can
actually use a database for storing the sessions instead of flat files I
will be using MS SQL for the database can any one give be a clue as to
how I would go about this or point me in the direction of a good
tutorial?

 

Any Help would be greatly appreciated, 

 

Ian McGhee 


Email: [EMAIL PROTECTED] 

 



[PHP-DB] Re: Problem with permissions Win32 dba_open

2005-01-01 Thread Ian
Well - after much experimentation, hair-pulling, and chasing of red herrings 
I have discovered  the error of my ways.  :oD

Despite my 4 PHP reference books I eventually turned to the PHP Manual (in 
.chm form) and it seems that the dba_open() function was modified for PHP 
4.3.0 et seq, to include modifiers for the mode parameter, which handle 
database locking, ie 'l', 'd', '-' and 't'.

So, the solution to my problem was nothing at all to to with file 
permissions, security or sharing folders - it was DBA locking by default.

Along the way, some of you newbies may like know of a few other pit-falls:

1.  Using db3 as the handler, rather than inifile or flatfile, it's 
necessary to supply the _full_ path to your database file, rather than a 
relative path (which actually works with the other handlers).

2.  If the database parameter is supplied without a path (relative or 
otherwise), a lock file is placed into the folder from which the script is 
run, while the database file is planted squarely into the folder from which 
php.exe is executed, in my case C:\PHP.  Weird - took me a while to sus. 
that one!  (What about the setting of doc_root in php.ini?  Makes no 
difference.)

3. Use single, rather than double quotes for dba_open() parameters.  In my 
original test, I used double quotes (below) and, of course, \t was 
interpolated!

Cheers,
Ian
(New Year's resolution - RTFM!)

Ian [EMAIL PROTECTED] originally wrote:
 Hi all,  Season's Greetings!

 I am testing my PHP scripts locally under XP Home SP2 / Apache 1.3.23 / 
 PHP
 4.3.10 but I can't get a simple DBM script to work.  No problem running it
 on my remote site, under Unix with gdbm though.

 Locally, phpinfo() gives:

 DBA support: enabled
 Supported handlers: cdb cdb_make db3 inifile flatfile

 This encourages me to think that I could open a database with db3, but I
 just can't get passed the dba_open command, which always fails with
 Permission denied.

 $db = dba_open(C:\Apache\htdocs\test.db, c , db3)  // for example

 What am I doing wrong please?

 Thanks for your help,
 Ian

 PS This appears to be a fixed bug (http://bugs.php.net/bug.php?id=28122) 
 but
 I still get permission denied.  Why? 

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



Re: [PHP-DB] Problem with permissions Win32 dba_open

2004-12-30 Thread Ian

Bastien Koert [EMAIL PROTECTED] wrote:

 have you set the permissions in the folders? Right click on the folder and 
 choose Properties...then set the appropraiate permissions

 bastien
[snip]

Thanks, Bastien.

Altering permissions doesn't appear to work, at least not the way it seems 
to be implemented with Service Pack 2.  Are you aware of the current method?

What seems to be necessary, after right-clicking a folder and selecting 
Properties, is to choose the Sharing tab.  XP then presents you with options 
for Local sharing and security (by dragging the folder into a new folder 
called Shared Documents) and for Network and security.

Now, my PC isn't used by anyone else and isn't connected to a LAN, so which 
method is appropriate for an Apache web server htdocs folder?  I haven't 
tried moving htdocs to this Shared Documents folder, that seems mad!, so 
just for a laugh, I selected my Apache folder and ticked the boxes for 
'sharing this folder on the network' and 'allow network users to change my 
files'.  A progress box appeared, to indicate that file permissions were 
being altered.  Great! I thought.

My test script STILL fails with 'Permission denied', even though it makes a 
zero-byte file in the right place.

Amended test script reads:

$dbh = dba_open( C:/Apache/htdocs/test.db, c , db3 );

dba_replace(fred, test, $dbh);
dba_sync($dbh);
dba_close($dbh);

Response is:

Notice: dba_open(): read: 0x12f550, 256: Permission denied in 
c:\apache\htdocs\admin\dba.php on line 3

Notice: dba_open(): C:/Apache/htdocs/test.db: Permission denied in 
c:\apache\htdocs\admin\dba.php on line 3

Warning: dba_open(C:/Apache/htdocs/test.db,c): Driver initialization failed 
for handler: db3: Permission denied in c:\apache\htdocs\admin\dba.php on 
line 3

Warning: dba_replace(): supplied argument is not a valid DBA identifier 
resource in c:\apache\htdocs\admin\dba.php on line 5

Warning: dba_sync(): supplied argument is not a valid DBA identifier 
resource in c:\apache\htdocs\admin\dba.php on line 6

Warning: dba_close(): supplied argument is not a valid DBA identifier 
resource in c:\apache\htdocs\admin\dba.php on line 7

Ian 

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



Re: [PHP-DB] Problem with permissions Win32 dba_open

2004-12-30 Thread Ian
Unchecking the read only box made no difference.   A zero byte test database 
file is created and dba_open() results in 'Permission denied'.  However, if 
the file is given a relative path (eg ../test.db), instead of an absolute 
address (eg C:/Apache/htdocs/test.db), the Permission denied warning is not 
generated.  Also, the dba_replace() function doesn't result in a warning 
either - but the test database remains at zero bytes and, of course, 
dba_fetch() can't find any records.

I have given up on DB3 now, because I've discovered that both the 'inifile' 
and 'flatfile' handlers give me the results I need from my Win32 testbed.  I 
wonder why DB3 fails - perhaps it's a bug after all, as I mentioned in my 
original post

Thanks for your patience,
Ian

Bastien Koert [EMAIL PROTECTED] wrote:
 make sure in the general tab that the read only checkbox is NOT checked

 bastien

From: Ian [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: Re: [PHP-DB] Problem with permissions Win32 dba_open
Date: Thu, 30 Dec 2004 12:54:49 -

Bastien Koert [EMAIL PROTECTED] wrote:

  have you set the permissions in the folders? Right click on the folder
and
  choose Properties...then set the appropraiate permissions
 
  bastien
[snip]

Thanks, Bastien.

Altering permissions doesn't appear to work, at least not the way it seems
to be implemented with Service Pack 2.  Are you aware of the current 
method?

What seems to be necessary, after right-clicking a folder and selecting
Properties, is to choose the Sharing tab.  XP then presents you with 
options
for Local sharing and security (by dragging the folder into a new folder
called Shared Documents) and for Network and security.

Now, my PC isn't used by anyone else and isn't connected to a LAN, so 
which
method is appropriate for an Apache web server htdocs folder?  I haven't
tried moving htdocs to this Shared Documents folder, that seems mad!, so
just for a laugh, I selected my Apache folder and ticked the boxes for
'sharing this folder on the network' and 'allow network users to change my
files'.  A progress box appeared, to indicate that file permissions were
being altered.  Great! I thought.

My test script STILL fails with 'Permission denied', even though it makes 
a
zero-byte file in the right place.

Amended test script reads:

$dbh = dba_open( C:/Apache/htdocs/test.db, c , db3 );

dba_replace(fred, test, $dbh);
dba_sync($dbh);
dba_close($dbh);

Response is:

Notice: dba_open(): read: 0x12f550, 256: Permission denied in
c:\apache\htdocs\admin\dba.php on line 3

Notice: dba_open(): C:/Apache/htdocs/test.db: Permission denied in
c:\apache\htdocs\admin\dba.php on line 3

Warning: dba_open(C:/Apache/htdocs/test.db,c): Driver initialization 
failed
for handler: db3: Permission denied in c:\apache\htdocs\admin\dba.php on
line 3

Warning: dba_replace(): supplied argument is not a valid DBA identifier
resource in c:\apache\htdocs\admin\dba.php on line 5

Warning: dba_sync(): supplied argument is not a valid DBA identifier
resource in c:\apache\htdocs\admin\dba.php on line 6

Warning: dba_close(): supplied argument is not a valid DBA identifier
resource in c:\apache\htdocs\admin\dba.php on line 7

Ian

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

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



Re: [PHP-DB] Problem with permissions Win32 dba_open

2004-12-29 Thread Ian
Bastien Koert [EMAIL PROTECTED] wrote
 is your ms firewall turned on? ms sp2 screws a lot of stuff up..

 bastien

Thanks bastien,

I'm running Norton IS 2005, with Windows Firewall switched off.

Whether or not I turn off the Norton firewall results in the same error:

?php $db = dba_open( C:/Apache/htdocs/test.db, c , db3 ); ?

Notice: dba_open(): read: 0x12f550, 256: Permission denied in 
c:\apache\htdocs\admin\dba.php on line 1

Notice: dba_open(): C:/Apache/htdocs/test.db: Permission denied in 
c:\apache\htdocs\admin\dba.php on line 1

Warning: dba_open(C:/Apache/htdocs/test.db,c): Driver initialization failed 
for handler: db3: Permission denied in c:\apache\htdocs\admin\dba.php on 
line 1

However, this command does create a zero-byte file  - 
C:\Apache\htdocs\test.db.

Ian 

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



[PHP-DB] Problem with permissions Win32 dba_open

2004-12-28 Thread Ian
Hi all,  Season's Greetings!

I am testing my PHP scripts locally under XP Home SP2 / Apache 1.3.23 / PHP
4.3.10 but I can't get a simple DBM script to work.  No problem running it
on my remote site, under Unix with gdbm though.

Locally, phpinfo() gives:

DBA support: enabled
Supported handlers: cdb cdb_make db3 inifile flatfile

This encourages me to think that I could open a database with db3, but I
just can't get passed the dba_open command, which always fails with
Permission denied.

$db = dba_open(C:\Apache\htdocs\test.db, c , db3)  // for example

What am I doing wrong please?

Thanks for your help,
Ian

PS This appears to be a fixed bug (http://bugs.php.net/bug.php?id=28122) but
I still get permission denied.  Why?

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



[PHP-DB] MySQL problem..

2004-11-08 Thread ian
Any body met this error?
Warning: mysql_connect(): Client does not support authentication
protocol requested by server; consider upgrading MySQL client in
/usr/local/apache2/html/poems/browse.php on line 15

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



RE: [PHP-DB] MySQL problem..

2004-11-08 Thread ian
thnx ya'll... :)

On Mon, 2004-11-08 at 17:52, Bastien Koert wrote:
 Check the mysql website. Have you upgraded from 4.0x to 4.1 recently. If so 
 you need to update the client libraries that come with mysql. There are 
 significant protocol changes from 4.0x to  4.1.
 
 Bastien
 
 From: ian [EMAIL PROTECTED]
 Reply-To: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] MySQL problem..
 Date: Mon, 08 Nov 2004 17:02:53 +
 
 Any body met this error?
 Warning: mysql_connect(): Client does not support authentication
 protocol requested by server; consider upgrading MySQL client in
 /usr/local/apache2/html/poems/browse.php on line 15
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 

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



RE: [PHP-DB] slow connection 2 DB2 database on as400.

2004-10-28 Thread Ian . McGhee
Hi I have been trying to connect to a DB2 database on an IBM AS400 system. I
manage to get connected using ODBC however it is slow at connecting and
every time the page is refreshed it seems to have to connect again. Any help
would be appreciated.

I use the below code to connect.
In a file called AS400dbconnect.inc

?


$host = LAWSON01;
$username = MYUSERNAME;
$password = MYPASSWORD;


$link= odbc_connect($host, $username, $password,SQL_CUR_USE_ODBC)


or die (odbc_errormsg() );

?

Then in a file called as400.inc
The following cote is in it 


?PHP


include('includes/as400dbconnect.inc');




if ($link)
{
  echo odbc connectedbr;
  $sql =  select * from exrcvbuf; 
  
  //this function will execute the sql satametn in  
  //correspondance to the table in the db
   $exc=odbc_exec($link,$sql)
or (odbc_errormsg());
  
}
else
  echo odbc not connectedbr;
 
if($exc)
{

$Fields = odbc_num_fields($exc); 

print table border='1' width='100%'tr; 

// Build Column Headers 

 for ($i=1; $i = $Fields; $i++)
{ 
printf(th bgcolor='silver'%s/th, odbc_field_name(
$exc,$i)); 
}

// Table Body 

$Outer=0; 
while( odbc_fetch_row( $exc ))
{ 
$Outer++; 
print tr; 
   
for($i=1; $i = $Fields; $i++)
{ 
printf(td%s/td, odbc_result( $exc, $i
)); 
} 
 
print /tr; 
} 

print /table; 
print b Your request returned $Outer rows!/b; 



}

else
  echo selection failedbr;
?




It is running in and apache server with php set up using the .dll method.
Ian McGhee
Junior Analyst Programmer
Richard Lawson Autologistics Group
Telephone: 01382 560259
Email: [EMAIL PROTECTED]

J B Cartwright, G D Frost and R J Hunt have been appointed as joint
administrators of Richard Lawson Autologistics Limited, on 14th September
2004, to manage its affairs, business and property. As such they contract
without personal liability. Both J B Cartwright and G D Frost are
licensed to act as Insolvency Practitioners by the Institute of Chartered
Accountants of Scotland and R J Hunt is licensed to act as an Insolvency
Practitioner by the Institute of Chartered Accountants in England and Wales.


=

If you are not the intended recipient of this message, you should not
review, print, re-transmit, store or take any actions based on the content
of this e-mail or any attachments. Please contact the sender by e-mail and
delete the material from any computer.

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



[PHP-DB] Storing route in DB

2004-04-18 Thread Robert Ian Smit
Hi,

I am not sure if my issue can be partially solved by a good database
design or that all stands or falls with the application.

If I have a bunch of locations in a table and I want to describe a
route between a number of these locations, what's the best way to do
it, considering  that it must be possible to change the route
afterwards. For instance (A-B-C-A, becomes A-C-B-A).

Ofcourse it's not a really big problem to solve in PHP. However I
believe it would be best if the database enforced some rules about
how a route may look. For instance no matter what any user or 
application does, it should not be possible to store a route
that looks like A-B-B-A or like A-B- -A or lose all route
information when there are still bookings.

Logically the problem is not too difficult, however I am looking for
a way to implement this in MySQL/PHP. Any pointers to help me in my
analysis would be much appreciated.

Bob

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



Re: [PHP-DB] Dreamweaver as PHP editor

2003-12-04 Thread Ian Fieldhouse
On 1 Dec 2003, at 21:11, [EMAIL PROTECTED] wrote:

I'm just getting into PHP, and have found that as a PHP code editor,
Dreamweaver works pretty well (with the extension I installed). My 
question
is this, whenever I save an include file with the .inc extension, all 
of
the
color coding goes away, as does the PHP tab on the tool bar. Is there 
any
way to make Dreamweaver see a .inc file as a PHP file? I looked on all 
the
menus and in the preferences, but I couldn't find an obvious way to do
this.
I just name my files filename.inc.php. That way dreamweaver sees them 
as php files and also prevents malicious users of  my sites from seeing 
the content of my include files should they guess the name of them.

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


[PHP-DB] MYSQL Query problem...

2003-09-21 Thread Ian Bert Tusil
is there something wrong with my SQL Query? I didnt get any results neither errors..

?php
$link = mysql_connect('localhost', 'username') or die('Cannot connect to the 
database.');
mysql_select_db(profiles,$link);
$SQLQuery = INSERT INTO profyles (username, fname, mname, lname, address, country, 
gender, sexuality, status, bday, race, yahoo, msn, icq, email, webpage, hair, 
bodytype, eye, height, weight, facialhair, hobbies, interests, aboutme, profession, 
food, music, tvshows, authors, movies, rolemodel, place, visit, online, picture) 
VALUES ('$user', '$firstname', '$middlename', '$lastname ', '$address, '$country', 
'$gender', '$sexuality', '$status', '$birthday', '$race', '$yahoo', '$msn', '$icq', 
'$email'. '$webpage', 'haircolour', '$bodytype', '$eyecolour', '$height', '$weight', 
'$facialhair', '$hobbies', '$interest', '$aboutme', '$profession', '$food', '$music', 
'$tvshows', '$authors', '$movies', '$rolemodel', '$place', 0, 'y' , 'y');
mysql_query($SQLQuery,$link);
?


ian


Re: [PHP-DB] set password on a page

2003-09-20 Thread Ian Bert Tusil

- Original Message -
From: SAGERAT [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, September 22, 2003 12:17 AM
Subject: [PHP-DB] set password on a page


 How do I set up password on a page so that only restricted people can open
 it?

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



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



[PHP-DB] Array Pointer

2003-06-04 Thread Ian Fingold
Ok I'm trying to write this function to up date some fields in my database
so i'm grabbing some info from a query and throwing it into an array (with
mysql_fetch_array).

one of the values i'm puting into that array is the table id. I'm then
comparing the table id with the value of $i in my loop. Now my problem is
when I loop through and the table id is not equal to $i I need to add 1 to
$i but I need to move the array pointer back one.

In the code below I used prev() but i'm getting warnings about the Passed
variable is not an array.
http://55yardline.cflmain.com/55main/2003/fantasy/tests/update.php

I'm thinking that prev() must not view an array fetch from a database the
same or something. But what else can I use besides prev() to rewind the
pointer by 1?

Thanks,


?php

include function.php;
connect1();

//query roster database and put results into an array.
$num1 = mysql_query(SELECT * FROM roster);
$num2 = mysql_fetch_array($num1);
//set i to zero
$i = 0;

//start loop to determine if $i matches the current roster id
do {
  $i = $i + 1;
  if ($num2[ros_id] == $i) {
//if a match is found, query the fan_roster database where the play_id =
$i
//and put the results into a array
$upd = mysql_query(SELECT * FROM fan_roster WHERE play_id='$i');
$updr = mysql_fetch_array($upd);
//loop through the passing field and add them up
do {
$passing = $passing + $updr[pass_yrd1];
} while($updr = mysql_fetch_array($upd));

//Print feedback
echo Player:$i total Passing: $passing $updr[play_id]br;

//update the roster table with the total $passing where ros_id=$i
$upd1 = mysql_query(UPDATE roster SET pass_yrd='$passing' WHERE
ros_id='$i');
//reset passing for next loop
$passing = 0;
  } else {
//if there isn't a match, add 1 to $i
$i = $i + 1;

//print feedback
echo $i no playerbr;

//put the array pointer back one for next loop
$num2 = prev($num2[ros_id];
  }
} while($num2 = mysql_fetch_array($num1));
?



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



Re: [PHP-DB] query string

2003-06-03 Thread Ian Fingold
Awsome!

Thanks, That is exactly what I was looking for. Work great now!


Leif K-Brooks [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 To answer your question, you should urlencode() the team name.  However,
 I would store the user in a cookie or session, and fetch the team name
 on each page load.  Otherwise, they can easily change which team they're
 using.

 Ian Fingold wrote:

 Sorry I don't think I explained very well... heres my situation...
 
 I have a mysql database set up... I have a user table with 2
 fields...team_name and fant_week.
 
 What I want to do is, depending on who is logged in, I want my link to
 change the value of 'team' to the logged in members team name, like wise
for
 the week.
 
 For example..
 if gorno is logged in and his team is called fun team the link will
 reflect his team and look like this...
 fant_stnd3.php?week=1team=fun team
 
 or if say... billbo is logged in and his team is called silly team
the
 link will look like this
 fant_stnd3.php?week=1team=silly team
 
 but again, my problem is that it's cutting off the team value when there
is
 a space in the string..
 
 
 
 G|rhan Vzen [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 
 
 On Sun, 2003-06-01 at 22:26, Ian Fingold wrote:
 
 
 I'm trying to build a query string for one of my links.. for example...
 fant_stnd3.php?week=1team=fun%20team
 
 I need to be able to grab the values of 'week' and 'team' from an
array,
 
 
 I
 
 
 can do that no problem, but when the code runs it cuts off the value if
 there is a space in the string. so instead of putting fun team in the
 query string it cuts it off and just puts.. fun 
 
 So my question, is there a function or any way to prevent this from
 happening?
 
 thanks.
 
 
Hi Ian,
  I have no idea what you are trying to do.. Well if you are getting
 those values from a URL, $week and $team variables in your php script
 should have the values in them.. In later versions of PHP, they will be
 _POST['week'] and _POST['team'] or _GET['week'] or _GET['team']
 depending on which method is used.. You don't need to parse the URL and
 run them through an array.. :)
   Gurhan
 
 
 
 
 
 
 
 

 --
 The above message is encrypted with double rot13 encoding.  Any
unauthorized attempt to decrypt it will be prosecuted to the full extent of
the law.





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



[PHP-DB] query string

2003-06-02 Thread Ian Fingold
I'm trying to build a query string for one of my links.. for example...
fant_stnd3.php?week=1team=fun%20team

I need to be able to grab the values of 'week' and 'team' from an array, I
can do that no problem, but when the code runs it cuts off the value if
there is a space in the string. so instead of putting fun team in the
query string it cuts it off and just puts.. fun 

So my question, is there a function or any way to prevent this from
happening?

thanks.




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



Re: [PHP-DB] query string

2003-06-02 Thread Ian Fingold
Sorry I don't think I explained very well... heres my situation...

I have a mysql database set up... I have a user table with 2
fields...team_name and fant_week.

What I want to do is, depending on who is logged in, I want my link to
change the value of 'team' to the logged in members team name, like wise for
the week.

For example..
if gorno is logged in and his team is called fun team the link will
reflect his team and look like this...
fant_stnd3.php?week=1team=fun team

or if say... billbo is logged in and his team is called silly team the
link will look like this
fant_stnd3.php?week=1team=silly team

but again, my problem is that it's cutting off the team value when there is
a space in the string..



Gürhan Özen [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Sun, 2003-06-01 at 22:26, Ian Fingold wrote:
  I'm trying to build a query string for one of my links.. for example...
  fant_stnd3.php?week=1team=fun%20team
 
  I need to be able to grab the values of 'week' and 'team' from an array,
I
  can do that no problem, but when the code runs it cuts off the value if
  there is a space in the string. so instead of putting fun team in the
  query string it cuts it off and just puts.. fun 
 
  So my question, is there a function or any way to prevent this from
  happening?
 
  thanks.

Hi Ian,
  I have no idea what you are trying to do.. Well if you are getting
 those values from a URL, $week and $team variables in your php script
 should have the values in them.. In later versions of PHP, they will be
 _POST['week'] and _POST['team'] or _GET['week'] or _GET['team']
 depending on which method is used.. You don't need to parse the URL and
 run them through an array.. :)
   Gurhan




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



[PHP-DB] Re: Pulling a long list of data stalls PHP

2002-01-09 Thread Ian Ferger


try mysql_fetch_array... mysql_fetch_row is a crappy old function.

- Original Message -
From: Peter Westergaard [EMAIL PROTECTED]
Newsgroups: php.db
To: [EMAIL PROTECTED]
Sent: Monday, January 07, 2002 8:32 AM
Subject: Pulling a long list of data stalls PHP


 Hi,

 I'm attempting to pull about 300 rows from a mysql database, (all rows in
 the table).
 I can pull the first 10, the first 20, the first 30, no problem.  (using
 LIMIT (start), (10|20|30)... in the SQL statement)

 But if I attempt to pull all of them (no LIMIT clause), or even the first
 (x) where (x) is much more than 30, using a simple while
 (mysql_fetch_row($sql,$db))... construction, IE just idles, tells me it is
 loading the page, and never displays anything.   When I press STOP, I
 have a hung PHP process in my Task Manager, which I cannot kill!

 Does anyone know what could cause this behaviour?  It seems so simple,
what
 I'm trying to do, that I'm going insane.
 Very frustrated.

 Please, someone help a poor newbie out!
 -P




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Re: DESC LIMIT

2002-01-07 Thread Ian Ferger

to use a desc, you need an order by

Barry Rumsey [EMAIL PROTECTED] wrote in message
001001c197d6$ceb70160$0100a8c0@weizmain">news:001001c197d6$ceb70160$0100a8c0@weizmain...
$query = SELECT * FROM xp_sings,xp_artist,xp_songs WHERE
xp_artist.artist_id = xp_sings.artist_id AND xp_sings.song_id =
xp_songs.song_id AND song_name LIKE 'b%'  DESC LIMIT 5;
$req = mysql_query($query);
$res = mysql_num_rows($req);

if ($res == 0)
{ echo centerbSorry there is no result./b/center;}
else
{ while($row = mysql_fetch_array($req))
{
extract($row);

It returns as Sorry there is no result but if I leave of the DESC and
limit , it works. Can someone tell me where I'm going wrong.







-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Re: Selecting last row

2001-12-22 Thread Ian Ferger

order by tableId desc limit 1

Necro [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 What query can I use to select the last row in a table??

 Andrew



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Re: Populating a MySQL database

2001-12-16 Thread Ian Ferger

look at the mysql_insert() function and then
look at the comments for the function mt_rand()

Pjc [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I need a script that will populate a MySQL database with mostly random
data
 (without crashing my box) with fields such as firstname, lastname etc.
 (i.e., I would want some fields to be just ints and some to have chars).

 Can someone point me in the right direction?

 thanks,
 -p






-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Re: Dynamically populating a dropdown box

2001-12-14 Thread Ian Ferger

also, to get existing vals to show in the select as default,

select name=colorz
while($row=mysql_fetch_array($result)){
$selected=($row[ID]==$ID)?selected:;
echo option value=' . $row[ID] . ' $selected . $row[name] .
/option\n;
}
/select
the value can be in single quotes also, altho i dont think quotes matter
unless you use opera or some other wierdass browser (you can also put
doubles using \)
I believe (correct me if im wrong) that since echo is a construct and not a
predefined function, it runs faster.





Matt Stewart [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 yep, that's basically what i use for this sort of thing - it's a nice
short
 simple function, and works a treat. Obviously if you'd rather be passing
the
 actual colour name to the next step, you use printf(option
 value=%s%s/option, $myrow[colorname], $myrow[colorname]);
 I also prefer to use printf(option value=\%s\ so it has the value in
 quotes - just a fussy html thing i do though.

 -Original Message-
 From: Matthew Crouch [mailto:[EMAIL PROTECTED]]
 Sent: 13 December 2001 22:58
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Re: Dynamically populating a dropdown box


 I'm no expert, and my code is probably buggy, but I think this is the gist
 of it:

 select name=color
 ?
 $result = mysql_query(SELECT * from colors);
 while ($myrow = mysql_fetch_array($result)) {
 printf(option value=%s%s/option, $myrow[colorid],
 $myrow[colorname]);
 }
 ?
 /select


 Chris Payne wrote:

  Hi there everyone,
 
  I have a shopping cart which is starting to work nicely, but I have to
 select size/color from the entries, how do I do this dynamically in PHP
with
 MySQL?  I need them to be dropdown form boxes but haven't got a clue how
to
 populate them from the fields of my database.
 
  Please help me with example code if possible, it would be greatly
 appreciated :-)
 
  Thank you everyone
 
  Regards
 
  Chris


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

 ---
 Incoming mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.306 / Virus Database: 166 - Release Date: 04/12/01


 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.306 / Virus Database: 166 - Release Date: 04/12/01




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Re: Is MySQL enough for a huge amount of data?

2001-12-14 Thread Ian Ferger

mysql is better for quick and lightless overhead than postgress, less
functionality too. overall, if you sit and tune it, you can get postgress to
run better, but who has the time.

Andy [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi there,

 I am wondering if I could have MySQL as a DB for an Application which
needs
 to have access a table of 1 Mio entries.
 And how long would it take to get an entry out of it. Asuming it contains
 only a name field and an id.
 e.g.

 select name
 from cities
 where provincial id = 2

 If it works, how could I optimize the table?

 Thanx for you help guys

 Cheers Andy





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Re: How to get Session ID

2001-12-14 Thread Ian Ferger

there is a very cryptic function for getting the session id:
session_id()
if you pass it a value, it will also set the id

Chris Payne [EMAIL PROTECTED] wrote in message
000c01c184ef$53abc220$0200a8c0@chris">news:000c01c184ef$53abc220$0200a8c0@chris...
Hi there everyone,

I know how to get the session ID in the url using ?=$SID?, but how do I
copy the current SessionID into a Var?  I need to store the sessionID so
that I can reference items added to a database during a particular session,
so people can continue shopping after they have added their item to the DB.

I have the DB and everything working great (God I love PHP and MySQL :-)

Anyway help would be appreciated.

Thanks also for all the recent help everyone, you are all hero's in my book
:-)

Chris




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Re: Dumb Question??

2001-12-14 Thread Ian Ferger

$table = some_junk;
$resultset=mysql_query(select blah ,blah from $table);

Russ Michell [EMAIL PROTECTED] wrote in message
news:SIMEON.10112131209.A@k1c. anglia.ac.uk...
 Hi there everyone:

 I have a genericphp/MySQL search+retrival mechanism. Generic in that it
takes table names,
 fieldnames and fieldtypes as form lables and element names. However,
because of this I cannot
 hard-code my SQL queries as they need to be as generic (univerally useful)
as possible.

 I therefore have a lot of SELECT * FROM table_name... queries. However
I would like to be able
 to specify a particular column ('modified') to appear under specific
circumstances, somewhere along
 the lines of: SELECT *,!modified FROM table_name .. I scanned TFM and
couldn't find anything
 specific to my problem. I have an incling this may not be as easy as I
think, so does anyone know
 of a bodge,kludge or workaround??

 Thanks for your time.
 Russ

 #---#

   Believe nothing - consider everything

   Russ Michell
   Anglia Polytechnic University Webteam
   Room 1C 'The Eastings' East Road, Cambridge

   e: [EMAIL PROTECTED]
   w: www.apu.ac.uk/webteam

   www.theruss.com

 #---#




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] db connect problems.

2001-11-28 Thread Ian

Hello, wonder if anyone can debug this script.

I copied it from an example in a book.

There is a .php file and a .inc file

This is the .inc file:

?php
//common_db.inc
$dbhost = 'localhost';
$dbusername = 'root';
$dbuserpassword = '';
$default_dbname = 'mysql';
$MYSQL_ERRNO = '';
$MYSQL_ERROR = '';
function db_connect($dbname=) {
global $dbhost, $dbusername, $dbuserpassword, $default_dbname, $dbname;
global $MYSQL_ERRNO, $MYSQL_ERROR;
$link_id = mysql_connect($dbhost, $dbusername, $dbuserpassword);
if(!$link_id) {
$MYSQL_ERRNO = 0;
$MYSQL_ERROR = Connection failed to the host $dbhost.;
return 0;
}
else if(empty($dbname)  !mysql_select_db($default_dbname)) {
$MYSQL_ERRNO = mysql_errno();
$MYSQL_ERROR = mysql_error();
return 0;
}
else return $link_id;
}
function sql_error() {
global $MYSQL_ERRNO, $MYSQL_ERROR;
if(empty($MYSQL_ERROR)) {
$MYSQL_ERRNO = mysql_errno();
$MYSQL_ERROR = mysql_error();
}
return $MYSQL_ERRNO: $MYSQL_ERROR;
}
?


the .php file is like this:

?php
//show_more_db.php
include ./common_db.inc;
$link_id = db_connect('sample_db');
$result = mysql_query(SELECT * FROM user, $link_id);
while($query_data = mysql_fetch_row($result)) {
?
 ?php
echo ',$query_data[1],' is also php ' known as ,$query_data[3],P;
}
?

Sorry about poxy formatting, hope it is legible.

I seem to have a problem passing the database to the db_connect() function
within the .php script.
The $default_dbname variable within the .inc file is always selected instead
of the argument I pass.

Anyone help me please?

Ta.



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] MySQL: Alphabetizing title results in library format

2001-11-01 Thread Ian Evans

Petr Tuma wrote:

 What error message it produce?

Ok, table titles is composed of:

+--+-++
| titlesid | releaseyear | title  |
+--+-++

mysql select *,(case when title like 'The %' then substring (title, 5, 255) when 
title like 'A %' then substring (title, 3, 255) when title like 'An %' then substring 
(title, 4, 255) else title end) as sort_col from titles order by sort_col;
ERROR 1064: You have an error in your SQL syntax near 'when title like 'The %' then 
substring (title, 5, 255) when title like 'A %' the' at line 1


-- 
Ian Evans
Digital Hit Entertainment - News and Information
http://www.digitalhit.com


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] MySQL: Alphabetizing title results in library format

2001-11-01 Thread Ian Evans

Cami wrote:

 Try this:
 mysql select *,(case when title like '%The%' then substring (title, 5, 255)
 when title like '%A%' then substring (title, 3, 255) when title like '%An%'
 then substring (title, 4, 255) else title end) as sort_col from titles order
 by sort_col;

Argh, that still produces the same syntax error. Our hosting company is 
using MySQL 3.22.32 if that's any help.

-- 
Ian Evans
Digital Hit Entertainment - News and Information
http://www.digitalhit.com


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] MySQL: Alphabetizing title results in library format

2001-10-31 Thread Ian Evans

Back when I was working with MSSQL I need to alphabetize movie titles in 
the proper library format where 'A' 'An and 'The are ignored.

For MSSQL I was told to use:
select *
from Titles
order by case when Title like 'The %' then substring (Title, 5, 255)
when Title like 'A %' then substring (Title, 3, 255)
when Title like 'An %' then substring (Title, 4, 255)
else Title
end

That worked like a charm, yet MySQL doesn't seem to accept that. Any 
solutions or advice?

-- 
Ian Evans
Digital Hit Entertainment - News and Information
http://www.digitalhit.com


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] MySQL: Alphabetizing title results in library format

2001-10-31 Thread Ian Evans

Petr Tuma wrote:

 select *,(case when Title like 'The %' then substring (Title, 5, 255)

  ETC.

Alas, MySQL doesn't like that syntax either. :(



-- 
Ian Evans
Digital Hit Entertainment - News and Information
http://www.digitalhit.com


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Uploading files problem

2001-08-22 Thread Ian Grant

Hi,

I have this code after a user submits a form with name, description and
image file upload fields:
images/people/preview is simply a unix link to /tmp/phptempimg-ian.grant

The problem is, when this script is run, the image show is that from the
previous operation. If you refresh the page, the correct image is displayed.

How can I fix this without refreshing the page?

--

if (is_uploaded_file($picture)) {
rename($picture, /tmp/phptempimg-ian.grant);
 }
 if ($picture!=none)

$picture=/tmp/phptempimg-ian.grant;$picture_src=images/people/preview; }
else { $picture_src=images/people/none.gif; }


 echo You are about to add the following member profile to the team
profiles database:brbr\n;

 echo  bName:/b $namebr\n;
 echo  bDescription:/b $descbr\n;
 echo  bPicture:/b img src=\$picture_src\ alt=\$name\
width=\110\ height=\121\br\n;

--




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] getting ID

2001-08-20 Thread Ian Grant

mysql_insert_id([resource link_identifier]) returns the value of the
auto_increment field for the previous INSERT query. It will return 0 if
there is not an auto_increment field. If the link_identifier is not
specified, the last opened connection is used.

So, use $id = mysql_insert_id(); directly after your $result =
mysql_query($query); operation (where $query is an INSERT query) to pull the
id value you have just auto inserted back out.


Ian.

Manual page: http://www.php.net/manual/en/function.mysql-insert-id.php
Crosswalkcentral [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I tried this and it gave me an error.

 Will this

 $id = mysql_insert_id();

 allow me to pull out the id?


 --
 Cross Walk Central
 www.crosswalkcentral.net
 Support Center
 Your Web Hosting Community!

 Cynic [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  At 19:19 8/19/2001, CrossWalkCentral wrote the following:
  --
  I have a script where I submit user data to the database in my script I
 need
  to get the id  # how can I do this w/o creating a query that does the
  following considering that user could have 10 other entires.
 
  mysql_query(insert into ...);
  $id = mysql_insert_id();
 
 
  // Request info
  $result = mysql_query(
  SELECT * FROM supportsys WHERE email = $email);
  if (!$result) {
  echo(PError performing query:  .
  mysql_error() . /P);
  exit();
  }
  
  
  I basicly need to get the id$ of the record just entered
  --
  Cross Walk Central
  www.crosswalkcentral.net
  Support Center
  Your Web Hosting Community!
  
  
  
  
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail:
[EMAIL PROTECTED]
  --end of quote--
 
 
  [EMAIL PROTECTED]
  -
  And the eyes of them both were opened and they saw that their files
  were world readable and writable, so they chmoded 600 their files.
  - Book of Installation chapt 3 sec 7
 





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] getting ID

2001-08-20 Thread Ian Grant

Just a little addition...
I use this function to get the id value, given a field name, field data and
table name:

function getId($fname,$data,$tblName) {
GLOBAL $conn;
$query = SELECT id FROM $tblName WHERE $fname = '$data';
$result = mysql_query($query);
$row = mysql_fetch_row($result);
$id = $row[0];
return $id;
}

Ian.



Ian Grant [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 mysql_insert_id([resource link_identifier]) returns the value of the
 auto_increment field for the previous INSERT query. It will return 0 if
 there is not an auto_increment field. If the link_identifier is not
 specified, the last opened connection is used.

 So, use $id = mysql_insert_id(); directly after your $result =
 mysql_query($query); operation (where $query is an INSERT query) to pull
the
 id value you have just auto inserted back out.


 Ian.

 Manual page: http://www.php.net/manual/en/function.mysql-insert-id.php
 Crosswalkcentral [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  I tried this and it gave me an error.
 
  Will this
 
  $id = mysql_insert_id();
 
  allow me to pull out the id?
 
 
  --
  Cross Walk Central
  www.crosswalkcentral.net
  Support Center
  Your Web Hosting Community!
 
  Cynic [EMAIL PROTECTED] wrote in message
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   At 19:19 8/19/2001, CrossWalkCentral wrote the following:
   --
   I have a script where I submit user data to the database in my script
I
  need
   to get the id  # how can I do this w/o creating a query that does the
   following considering that user could have 10 other entires.
  
   mysql_query(insert into ...);
   $id = mysql_insert_id();
  
  
   // Request info
   $result = mysql_query(
   SELECT * FROM supportsys WHERE email = $email);
   if (!$result) {
   echo(PError performing query:  .
   mysql_error() . /P);
   exit();
   }
   
   
   I basicly need to get the id$ of the record just entered
   --
   Cross Walk Central
   www.crosswalkcentral.net
   Support Center
   Your Web Hosting Community!
   
   
   
   
   --
   PHP Database Mailing List (http://www.php.net/)
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   To contact the list administrators, e-mail:
 [EMAIL PROTECTED]
   --end of quote--
  
  
   [EMAIL PROTECTED]
   -
   And the eyes of them both were opened and they saw that their files
   were world readable and writable, so they chmoded 600 their files.
   - Book of Installation chapt 3 sec 7
  
 
 





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] HTML editors

2001-08-16 Thread Ian Grant

Hi,

I'm looking for something similar to eWebEdit Pro
(http://www.ewebeditpro.com), but a lot less costlier!
The idea is using a HTML form to write articles to a PHP/MySQL-driven
dynamic site. Obviously, people can cut and paste HTML into a textarea
tag, but having a WYSIWYG editor in place of the textarea tag would be
better, considering the users are not going to be HTML-proficient.

However, I cannot seem to find anything like this that doesn't cost loads.
Does anyone know of anything similar?


Thanks,

Ian Grant.

--




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Submit forms

2001-08-13 Thread Ian Grant

Yes, thank you, this works!

Ian.

Paul Burney [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 on 8/10/01 7:50 AM, Ian Grant at [EMAIL PROTECTED] wrote:

  I've got a simply search form, on my site using PHP and MySQL.
  It writes a SELECT query  using WHERE (Field LIKE '%thingy%') where
thingy
  is the word entered in the form. It works fine if the submit button is
  pressed, but if you press return after typing the word, instead, it
fails
  and writes nothing for the query, so it ends up like WHERE ()

 Browsers differ on how they interpret the hitting of the return key and
 which fields get submitted.  I'd guess you have an input type='submit'
 name='submit' value='yes' type field and you are checking isset($submit).
 Some browsers (Netscape on the Mac, for example) won't submit the
name-value
 pair associated with the button.

 One solution is to do this instead:

 input type=hidden name=submit value=yes
 input type=submit value=Search!

 No matter how the form is submitted, the submit variable will be set to
yes.

 Sincerely,

 Paul Burney

 ++
 Paul Burney
 Webmaster  Open Source Developer
 UCLA - GSEIS - ETU
 (310) 825-8365
 [EMAIL PROTECTED]
 http://www.gseis.ucla.edu/
 ++





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Submit forms

2001-08-10 Thread Ian Grant

Hi,

I've got a simply search form, on my site using PHP and MySQL.
It writes a SELECT query  using WHERE (Field LIKE '%thingy%') where thingy
is the word entered in the form. It works fine if the submit button is
pressed, but if you press return after typing the word, instead, it fails
and writes nothing for the query, so it ends up like WHERE ()


Any pointers?

Thanks,

Ian.

--




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Making a new row in HTML tables

2001-07-25 Thread Ian Grant

Hi,

Can anyone help me with this - I have a database of people, that I want to
print into an HTML table - how can I make the table wrap into an equal
number of rows.
i.e. if there are 4 entries, a 2x2 table, 6 a 2x3, 8 a 2x4, 9 a 3x3, etc.

At the moment, I have something like:

$rows=mysql_num_rows($result);
$i=1;

while ($array = mysql_fetch_array($result))  {

  print (td
align=\center\.$array[Image].br.$array[Name]./td\n);

 if (is_int($rows / $i)) {
  print (/tr\ntr);
  }

 $i++;
  }

Thanks,

Ian.

--




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Re: Making a new row in HTML tables

2001-07-25 Thread Ian Grant

Yeah, but if I had 31,
I'd want 6x5 and then 1 over, or something


Hugh Bothwell [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Umm... 31 entries, 1 x 31...

 You might be better to choose a standard width and pad the last row with
 empty cells.

 Ian Grant [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hi,
 
  Can anyone help me with this - I have a database of people, that I want
to
  print into an HTML table - how can I make the table wrap into an equal
  number of rows.
  i.e. if there are 4 entries, a 2x2 table, 6 a 2x3, 8 a 2x4, 9 a 3x3,
etc.






-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] MySQL connection problem - need help from expert

2001-03-22 Thread Ian

Please help me !!!

Description :-
Server 1 is installed MySQL which located in US.
Server 2 is located in Singapore, and doesn't install Mysql.
Both of them are installed PHP and Acaphe.

Case:-
I would like to set the server 2 connect to Server 1's MySQL database. What
should I do?

Thank you in advance.
Ian.



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] MySQL connection problem - need help from expert

2001-03-22 Thread Ian

Thanks, Thor and Cal  ; )


"Ian" [EMAIL PROTECTED] wrote in message
99eaaj$njn$[EMAIL PROTECTED]">news:99eaaj$njn$[EMAIL PROTECTED]...
 Please help me !!!

 Description :-
 Server 1 is installed MySQL which located in US.
 Server 2 is located in Singapore, and doesn't install Mysql.
 Both of them are installed PHP and Acaphe.

 Case:-
 I would like to set the server 2 connect to Server 1's MySQL database.
What
 should I do?

 Thank you in advance.
 Ian.



 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] how to connect mysql from local to remote server?

2001-01-29 Thread Ian

Dear Sir / Madam,

I am trying to connect our US mysql database server from Malaysia server,
but it isn't work. Below is my example coding:-

mysql_pconnect("202.42.236.105","tester","tester");
mysql_select_db("tester");
$sql = "select * from tester";
etc.

What else should I know or I miss, to make it function? Any good idea to do
that?

Thanks in advance,
Ian.



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Date Control Problem

2001-01-11 Thread Ian

Dear Sir / Madam,

Case 1:
My database,
Table name - Test.
Field name - due_date.

Let say,
due_date = 2001-01-01.

Now, I would like to display all data from Test table where my due_date is
before the current date. I tried the below SQL statement but it didn't work,
SELECT * from Test where due_date = curdate();
My display result should be zero.
Any good solutions or suggestions for Case 1?


Case 2:
My database,
Table name - Test.
Fields name - posting_date, and expired_day.

Let say,
posting_date = 2000-12-20
expired_days = 14 days

So my due date is 2001-01-02(from my own calculation). Same as case 1, I
would like to display all data from Test table where expired_day plus
posting_date is before the current date.
My display result should be zero.
Any good solutions or suggestions for Case 2?

Thanks in advance.


Best Regards,
Ian.



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]