Re: [PHP-DB] Text area

2004-08-24 Thread Terry Riley
Hafidz

Textarea is not a classic  type. Try:

function write_textarea()
  {
   return "";
  }
  

- Original Message -

> Hi again, everyone.
> 
> I also have a problem creating my text area.  I meant to do a text area 
> (measuring 5 rows by 70 columns) which accompanies the words: "First 50 
> words are free. Subsequent 50 words or part thereof, $50 will be 
> charged:"
> 
> function write_textarea()
>  {
>   return "";
>  }
>  
> Doesn't work. How can I make it work?
> 
> Thanks & regards,
> Hafidz

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



Re: [PHP-DB] mySQL Parse Error

2004-03-22 Thread Terry Riley
You are also trying to insert '8400' (characters) into a mediumint 
(price)?



--Original Message-  

> Hi,
> 
> I have a table:
> 
> CREATE TABLE `cashmire` (`id` smallint(3) unsigned NOT NULL 
> auto_increment,
> `itemcode` varchar(25) NOT NULL default '', `collection` char(2) NOT 
> NULL
> default 'cl',
> `promotion` char(1) default 'n', `bestSeller` char(1) default 'n',
> `newArrival` char(1) default 'n', `size` varchar(15) default NULL, 
> `colour`
> varchar(30) default NULL,
> `image` varchar(7) default NULL, `currency` char(3) default 'MRS', 
> `price`
> mediumint(8) unsigned NOT NULL default '0', `description` text, 
> `purchased`
> smallint(3) unsigned default NULL,
> PRIMARY KEY (`id`), UNIQUE KEY `itemcode` (`itemcode`), ) TYPE=MyISAM;
> 
> When i run this SQL:
> 
> insert into cashmire ('itemcode', 'collection', 'promotion', 
> 'bestSeller',
> 'newArrival', 'size', 'color', 'image', 'currency', 'price', 
> 'description',
> 'purchased') values ('31474', 'cl', 'n', 'n', 'y', 'S-M-L-XL', 
> 'AQ-BL-EC',
> '', 'MRS', '8400', 'Long sleeve chunky roll neck cardigan (12 ply) with 
> high
> ribbed welt and turn-back cuffs, authentic coconut buttons', '0')
> 
> I get:
> 
> You have an error in your SQL syntax. Check the manual that corresponds 
> to
> your MySQL server version for the right syntax to use near ''itemcode',
> 'collection', 'promotion', 'bestSeller', 'newArriva
> 
> I can't understand... tried googling but still no answer!
> 
> Can someone help me please,
> 
> regards,
> 
> nadim attari

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



Re: [PHP-DB] mySQL Parse Error

2004-03-22 Thread Terry Riley
Your field name is 'colour', you are inserting into 'color' ?


--Original Message-  

> Hi,
> 
> I have a table:
> 
> CREATE TABLE `cashmire` (`id` smallint(3) unsigned NOT NULL 
> auto_increment,
> `itemcode` varchar(25) NOT NULL default '', `collection` char(2) NOT 
> NULL
> default 'cl',
> `promotion` char(1) default 'n', `bestSeller` char(1) default 'n',
> `newArrival` char(1) default 'n', `size` varchar(15) default NULL, 
> `colour`
> varchar(30) default NULL,
> `image` varchar(7) default NULL, `currency` char(3) default 'MRS', 
> `price`
> mediumint(8) unsigned NOT NULL default '0', `description` text, 
> `purchased`
> smallint(3) unsigned default NULL,
> PRIMARY KEY (`id`), UNIQUE KEY `itemcode` (`itemcode`), ) TYPE=MyISAM;
> 
> When i run this SQL:
> 
> insert into cashmire ('itemcode', 'collection', 'promotion', 
> 'bestSeller',
> 'newArrival', 'size', 'color', 'image', 'currency', 'price', 
> 'description',
> 'purchased') values ('31474', 'cl', 'n', 'n', 'y', 'S-M-L-XL', 
> 'AQ-BL-EC',
> '', 'MRS', '8400', 'Long sleeve chunky roll neck cardigan (12 ply) with 
> high
> ribbed welt and turn-back cuffs, authentic coconut buttons', '0')
> 
> I get:
> 
> You have an error in your SQL syntax. Check the manual that corresponds 
> to
> your MySQL server version for the right syntax to use near ''itemcode',
> 'collection', 'promotion', 'bestSeller', 'newArriva
> 
> I can't understand... tried googling but still no answer!
> 
> Can someone help me please,
> 
> regards,
> 
> nadim attari
> 

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



Re: [PHP-DB] PEAR::DB question

2003-07-29 Thread Terry Riley
Jake

Dunno if this will help, whether you're using MySQL or whether it works in 
PEAR. Look up mysql_data_seek() in the php manual.

Cheers
Terry

--Original Message-  

> Hello-
> I'm using the fetch method to get a result set.  ie-
> 
> $sql = "select id,name from sr_names order by name";
> $result = $db->query($sql);
> while ( $row = $result->fetchRow(DB_FETCHMODE_ASSOC) )
> echo $row['id'] . ' ' . $row['name'] . "";
> 
> This works great!  Now, I want to _re-use_ this result set without
> having to re-query the database.  Then cycle through the result set.  
> ie -
> 
> $result->someFunction();
> while ( $row = $result->fetchRow(DB_FETCHMODE_ASSOC) )
> echo $row['id'] . ' ' . $row['name'] . "";
> 
> So, the output here would be two of whatever was output.  Does that 
> make
> sense?  Right now I'm having to do this:
> 
> $sql = "select id,name from sr_names order by name";
> $result = $db->query($sql);
> while ( $row = $result->fetchRow(DB_FETCHMODE_ASSOC) )
> echo $row['id'] . ' ' . $row['name'] . "";
> $result = $db->query($sql);
> while ( $row = $result->fetchRow(DB_FETCHMODE_ASSOC) )
> echo $row['id'] . ' ' . $row['name'] . "";
> 
> If I already have the result set, can't I just tell it "hey, put the
> cursor back at the top".  I know I can fetchRow from a specific row in 
> the
> result set, but then I'd have to get every row that way, which doesn't 
> make
> efficiency sense, either.
> Thanks in advance,
> 
> Jake
> 
> LandEZ



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



RE: [PHP-DB] WHY need to query 2x to get results

2003-07-22 Thread Terry Riley
I think reset() is only for arrays

Terry

--Original Message-  

> It worked like a charm. (initially I was trying to use reset() guess it 
> was
> the wrong call)
> 
> One other thing, The 1st call was supposed to get the Column Headers 
> and the
> second to get the results. I thought they are independent of each 
> other??
> Guess not?
> 
> thanks very much.
> 
> Cheers,
> Mun Heng, Ow
> H/M Engineering
> Western Digital M'sia 
> DID : 03-7870 5168



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



Re: [PHP-DB] WHY need to query 2x to get results

2003-07-22 Thread Terry Riley
Because you have already fetched one row before outputting the record 
count. Therefore the row pointer is at the second record before you 'print 
out'.

Try putting 

mysql_data_seek($result,0);

in place of your second 

$result = mysql_query($sql);

This should return the pointer to the first retreived record.

Hope that helps

Terry

--Original Message-  

> Hi,
> 
>   I have a code that goes like this. Scroll down to the 
"<--"
> sign. How come I need another $result = mysql_query($sql) at that 
> location?
> If I don't have it, the results coming out will only start printing 
> from the
> 2nd Row.. Omitting the 1st.
> 
> Results as wanted 
> 
> row 1 value1
> row 2 value2
> row 3 value3
> 
> Getting this instead
> 
> row 2 value2
> row 3 value3
> 
> 
> 
> Pls Help.
> 
>   $result = mysql_query($sql);
> 
>   $num_results = mysql_num_rows($result);
> 
>   $row = mysql_fetch_row($result); 
>   
>   echo 'There are ' . $num_results; 
>   echo ' FA entries found' . "\n";
>   
>   echo '' . "\n";
>   echo '';
>   echo '' . "\n";
> 
> # ===
> # Print out the Table Field Names
> # ===
>   echo '';
>   echo "\n";
>   echo '' . "\n";
>   
>   for ($k = 0; $k < sizeof($row) ; $k++)
>   {
>   echo "\t" . '';
>   echo mysql_field_name($result,$k);
>   echo " \n";
>   }
> 
> # ===
> # Print out the Table Results
> # ===
>   
>   $result = mysql_query($sql);   <---==WHY Is THIS
> needed
> 
>   for ($i = 0; $i < $num_results ; $i++)
>   {
>   echo "\n"  ;
>   $row = mysql_fetch_row($result);
>   for ($j = 0; $j < 12 ; $j++)
>   {
>   echo "\t" . '';
>   echo  $row[$j] ;
>   echo " \n";
>   }
> 
>   echo "\n";
>   }
> Cheers,
> Mun Heng, Ow
> H/M Engineering
> Western Digital M'sia 
> DID : 03-7870 5168
> 



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



Re: [PHP-DB] mysql_fetch_array issues.

2003-07-09 Thread Terry Riley
As far as I know, that error means that the query that was supposed to 
produce $result did not run because of errors in the SQL (or the 
database).

Suggest you check your query in myPHPAdmin or MySQLfront or whatever to be 
sure that it has no errors.

Terry

--Original Message-  

> I am getting the following error when attempting to pull data out of a 
> mysql
> DB
> 
> Warning: mysql_fetch_array(): supplied argument is not a valid MySQL 
> result
> resource in /home/pffl/public_html/pffl/webpage/html/dataentry.php on 
> line
> 125
> 
> I can take this same code to a different web server and it is pulling
> correctly!
> 
> I am currently running Apache 2.0.46 with PHP 4.3.2 I was running Apache
> 1.3.x with PHP 4.3.1 and getting the same thing, any ideas? here is the
> chunk of code where I use the function.
> 
> while ($myrow=mysql_fetch_array($result))
> {
> ?>
>  
>  }
> 
> Any Ideas.
> 



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



Re: RE: [PHP-DB] HEAP table

2003-07-09 Thread Terry Riley
Just remembered - this is the guy ([EMAIL PROTECTED]) that was so 
abominably rude a couple of weeks back. 

He's obviously found another way of shooting blanks!

--Original Message-  

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



RE: [PHP-DB] HEAP table

2003-07-09 Thread Terry Riley
Good idea, Ben. I'll remember that when I can afford to have hosting on a 
non-shared server :-) , but can't use it at the moment.

Cheers
Terry

--Original Message-  

> You could have a php file set variables or an array called
> $GLOBAL[some_global_variable], go into the php.ini and set auto_prepend
> to this file. So EVERY php script that is called will first load this
> file.
> 
> Ben
> 
> -Original Message-
> From: Terry Riley [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, July 09, 2003 4:08 AM
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] HEAP table
> 
> 
> Thanks, Daevid
> 
> I'll probably use something with session variables. 
> 
> However, what I wish is that there was some kind of application-wide 
> variables, as can be set in ColdFusion, that could track this. I cannot 
> find any means to create such variables in PHP. 
> 
> Anyone got any ideas on those lines?
> 
> Cheers
> Terry
> 
> --Original Message-  
> 
> > Or instead of creating a table and tying up one more mysql thread, 
> > just
> > save
> > the timestamp in a file. This could be as simple as that, you could
> use 
> > XML,
> > you could use INI parser, you could use any number of things. Also, if
> 
> > the
> > HEAP is created per "session", then just store that timestamp in a 
> > session
> > variable and avoid any disk i/o that way.
> > 
> > > -Original Message-
> > > From: [EMAIL PROTECTED]
> > > [mailto:[EMAIL PROTECTED] 
> > > Sent: Tuesday, July 08, 2003 9:24 AM
> > > To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > > Subject: RE: [PHP-DB] HEAP table
> > > 
> > > 
> > >  Create a create_date table with one record, one or two
> > > fields, and put the
> > > last refreshed time/date in it. If that's expired, refresh
> > > 
> > > 
> > > Gary Every
> > > Sr. UNIX Administrator
> > > Ingram Entertainment
> > > (615) 287-4876
> > > "Pay It Forward"
> > > mailto:[EMAIL PROTECTED]
> > > http://accessingram.com
> > > 
> > > 
> > > > -Original Message-
> > > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> > > > Sent: Tuesday, July 08, 2003 10:52 AM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: [PHP-DB] HEAP table
> > > > 
> > > > 
> > > > I have a query that I would have liked to cache, but as it uses
> > > > UNIX_TIMESTAMP and has a user variable in it, where cacheing 
> > > > won't work, I 
> > > > looked around for another way to do it (it is used to create 
> > > > a smallish < 
> > > > 50 records table on each web page, so any speed increase is 
> > > > worthwhile).
> > > > 
> > > > I decided to go for the creation of a HEAP table, so that
> > > > anyone accessing 
> > > > the site would automatically access it. The existence of 
> > > the table is
> > > > tested for before initial creation by running a select
> > > against it and
> > > > testing the $result variable.
> > > > 
> > > > This works, as far as it goes, but it will require occasional
> > > > updating. 
> > > > And that's where I've come unstuck. How can I test for the 
> > > > time/date of 
> > > > the HEAP table's creation? If I can find that, then I can set 
> > > > a seconds 
> > > > value past which it should be dropped and recreated.
> > > > 
> > > > Any ideas?
> > > > 
> > > > Using MySQL 5.0.13, php 4.3.2 (on Windows XP), Apache 1.3
> > > > whatever. This 
> > > > also has to work on the website proper, using 5.0.13/4.3.1 and
> IIS5.


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



Re: RE: [PHP-DB] HEAP table

2003-07-09 Thread Terry Riley
Brandy - that's two messages in this thread from you with no content!

Terry

--Original Message-  


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



RE: [PHP-DB] HEAP table

2003-07-09 Thread Terry Riley
Thanks, Daevid

I'll probably use something with session variables. 

However, what I wish is that there was some kind of application-wide 
variables, as can be set in ColdFusion, that could track this. I cannot 
find any means to create such variables in PHP. 

Anyone got any ideas on those lines?

Cheers
Terry

--Original Message-  

> Or instead of creating a table and tying up one more mysql thread, just 
> save
> the timestamp in a file. This could be as simple as that, you could use 
> XML,
> you could use INI parser, you could use any number of things. Also, if 
> the
> HEAP is created per "session", then just store that timestamp in a 
> session
> variable and avoid any disk i/o that way.
> 
> > -Original Message-
> > From: [EMAIL PROTECTED] 
> > [mailto:[EMAIL PROTECTED] 
> > Sent: Tuesday, July 08, 2003 9:24 AM
> > To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > Subject: RE: [PHP-DB] HEAP table
> > 
> > 
> >  Create a create_date table with one record, one or two 
> > fields, and put the
> > last refreshed time/date in it. If that's expired, refresh
> > 
> > 
> > Gary Every
> > Sr. UNIX Administrator
> > Ingram Entertainment
> > (615) 287-4876
> > "Pay It Forward"
> > mailto:[EMAIL PROTECTED]
> > http://accessingram.com
> > 
> > 
> > > -Original Message-
> > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> > > Sent: Tuesday, July 08, 2003 10:52 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: [PHP-DB] HEAP table
> > > 
> > > 
> > > I have a query that I would have liked to cache, but as it uses 
> > > UNIX_TIMESTAMP and has a user variable in it, where cacheing 
> > > won't work, I 
> > > looked around for another way to do it (it is used to create 
> > > a smallish < 
> > > 50 records table on each web page, so any speed increase is 
> > > worthwhile).
> > > 
> > > I decided to go for the creation of a HEAP table, so that 
> > > anyone accessing 
> > > the site would automatically access it. The existence of 
> > the table is 
> > > tested for before initial creation by running a select 
> > against it and 
> > > testing the $result variable.
> > > 
> > > This works, as far as it goes, but it will require occasional 
> > > updating. 
> > > And that's where I've come unstuck. How can I test for the 
> > > time/date of 
> > > the HEAP table's creation? If I can find that, then I can set 
> > > a seconds 
> > > value past which it should be dropped and recreated.
> > > 
> > > Any ideas?
> > > 
> > > Using MySQL 5.0.13, php 4.3.2 (on Windows XP), Apache 1.3 
> > > whatever. This 
> > > also has to work on the website proper, using 5.0.13/4.3.1 and IIS5.
> > > 
> > > Terry Riley


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



[PHP-DB] HEAP table

2003-07-08 Thread Terry Riley
I have a query that I would have liked to cache, but as it uses 
UNIX_TIMESTAMP and has a user variable in it, where cacheing won't work, I 
looked around for another way to do it (it is used to create a smallish < 
50 records table on each web page, so any speed increase is worthwhile).

I decided to go for the creation of a HEAP table, so that anyone accessing 
the site would automatically access it. The existence of the table is 
tested for before initial creation by running a select against it and 
testing the $result variable.

This works, as far as it goes, but it will require occasional updating. 
And that's where I've come unstuck. How can I test for the time/date of 
the HEAP table's creation? If I can find that, then I can set a seconds 
value past which it should be dropped and recreated.

Any ideas?

Using MySQL 5.0.13, php 4.3.2 (on Windows XP), Apache 1.3 whatever. This 
also has to work on the website proper, using 5.0.13/4.3.1 and IIS5.

Terry Riley


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



Re: [PHP-DB] Re: PHP help

2003-06-30 Thread Terry Riley
Surely this will fail because $login has not been defined, by use of 
something like

$login = $_REQUEST['login'];

I tried the naked code as given, and (as expected) got an error - 
undefined variable - $login 

I was under the impression that had to be done for all 'incoming', if it 
was to be used for anything.

Terry Riley

--Original Message-  

> 
>   $query="INSERT INTO login VALUES ('$login')";
> 
> have fun
> 
> 
> Bill Pilgrim wrote:
> > My System:  
> > Windows 98
> > Apache 1.3.27
> > PHP 4
> > mysql
> > 
> > Hello all, I am a PHP beginner and was wondering if I could get some 
> > help from some of the more experienced on this list.  I have been 
> trying to use an html form (with textboxes, radio buttons, and 
> textareas) to input data into a mysql database.  I am able to connect 
> fully with the database and am able to create tables in it, but when I 
> try to input information into the tables nothing happens. ever...  I 
> don't really know what to do from here, but I assume that a 
> configuration is not set properly between mysql, apache, windows, or 
> php.  I really don't know what it could be.  My code is here and I have 
> tried to simplify the form in order to get it working, so here is my 
> barebones code that hopefully has some errors:
> > HTML:
> > 
> > 
> > Simplify
> > 
> > 
> > 
> > Login: 
> > 
> > 
> > 
> > 
> > 
> > PHP file called "addform.php":
> > 
> >  > 
> > $user="chris";
> > $database="test";
> > mysql_connect(localhost,$user);
> > @mysql_select_db($database) or die("unable to select database");
> > $query="INSERT INTO login VALUES ("'$login')";
> > mysql_query($query);
> > mysql_close();
> > ?>
> > 
> > Login is the name of the table on the database named test.
> > 
> > I stopped using a password because it wouldn't let anything work even 
> > table creation when I tried to use a password.  Any help that anyone 
> could give would be greatly appreciated; there is probably some 
> grievious error in this script.  Thanks, Chris

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