[PHP-DB] Really Dumb Question...

2001-04-11 Thread Brian Grayless
How do I create a table within my PHP? Heres what I currently have, but I keep getting parse error on the "create" line... $result = mysql_query($sql); create table $propTable ( ID int not null auto_increment primary key, TourName tinytext, TourTitle tinytext, ViewTitle tinytext, TourNum tinyint

Re: [PHP-DB] Really Dumb Question...

2001-04-11 Thread Darryl Friesen
> How do I create a table within my PHP? Heres what I currently have, but I > keep getting parse error on the "create" line... Because create is not a valid PHP command. You have to assign the create statement to a string, _then_ pass the string to mysql_query: $sql = "create table $propTable

Re: [PHP-DB] Really Dumb Question...

2001-04-11 Thread CC Zona
In article <00c701c0c2af$be478f40$[EMAIL PROTECTED]>, [EMAIL PROTECTED] ("Darryl Friesen") wrote: > > How do I create a table within my PHP? Heres what I currently have, but I > > keep getting parse error on the "create" line... > > Because create is not a valid PHP command. You have to assign

[PHP-DB] Really dumb question... deleting everything but newest 100 rows?

2002-11-23 Thread Leif K-Brooks
I know this is a dumb question, but how would I delete everything but the first 100 results returned from a query? I know I'd use limit, but my mind's going blank as to the exact syntax. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will b

Re: [PHP-DB] Really dumb question... deleting everything but newest100 rows?

2002-11-23 Thread Marco Tabini
If you have a column that gives you the "newness" of each row--I'm assuming a date here: delete from my_table order by date_inserted desc limit 100, -1 This should work... I recommend a db backup first :-) Marco php|architect - The magazine for PHP Professionals The monthly world

Re: [PHP-DB] Really dumb question... deleting everything but newest100 rows?

2002-11-23 Thread Leif K-Brooks
I was thinking something along those lines, but phpmyadmin gives an error. The table currently has way too many rows (32362), could this have to do with it? Warning: Unable to jump to row 0 on MySQL result index 4 in /home/virtual/site1/fst/var/www/html/PhpMyAdmin/sql.php on line 223 Warning:

Re: [PHP-DB] Really dumb question... deleting everything but newest100 rows?

2002-11-23 Thread Marco Tabini
Have you tried executing from the command line? I don't know phpmyadmin very well, but it looks like it's trying to execute the query as if it were a select statement--because your query doesn't return anything, PHP outputs an error. It's also possible there's something else wrong (including my qu