Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » A [hopefully] quick question
Closed Thread
Old 02-02-2007, 01:54 AM   #1 (permalink)
 
Ultra Techie

Join Date: Sep 2005

Posts: 638

tommyboy123x is on a distinguished road

Send a message via AIM to tommyboy123x
Default A quicker question

go to next post for details

code:

PHP Code:
<?php
$link 
mysql_connect("server""username""password") or die(mysql_error());
mysql_select_db("database") or die(mysql_error());

$x 0;
$y 0;

mysql_query("CREATE TABLE temp(
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(id),
    username VARCHAR(30),
    referralcommision INT)"
)
    or die(
mysql_error());

while (
$x >= 101){
    while (
$y >= 101){
        
$afs2 'afs'.$x.$y;
        
mysql_query("ALTER TABLE 'temp' ADD '$afs2' VARCHAR(30) NULL DEFAULT NULL") or die(mysql_error());
        
$y++;
        }
    
$x++;
    }
echo 
'Table Updated!';
?>

__________________

Some real (as in actual) surveys that pay money!
tommyboy123x is offline  
Old 02-03-2007, 12:26 AM   #2 (permalink)
 
Ultra Techie

Join Date: Sep 2005

Posts: 638

tommyboy123x is on a distinguished road

Send a message via AIM to tommyboy123x
Default

Why will this not work?

I know it is a crazy while loop and should make about 10,000 fields - is that too much for mysql or PHP or my internet connection?

EDIT: and yes, just now replaced all the $link data - it DOES connect
__________________

Some real (as in actual) surveys that pay money!
tommyboy123x is offline  
Old 02-03-2007, 01:28 AM   #3 (permalink)
 
True Techie

Join Date: May 2006

Posts: 101

jonmon6691

Default

holy ****! i never noticed how similar php is to perl!
__________________
<small>
.:HP Pavillion dv6000:.
1.8 ghtz Intel Core 2 Duo
2GB RAM
120 GB HDD
nVidia Go graphics
Apache 2.2 (looking for a domain name)
</small>
jonmon6691 is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On