Jump to content

Doomflame

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.doomflame.com

Profile Information

  • Gender
    Not Telling

Doomflame's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I got it to work, I remembered that mysql_error() shows error info, and I just did stripslashes and took the slashes out of that mysql code.
  2. The code below enters the values $title, $id, and $value into the database, not their values. All of them are set. $sql = \'INSERT INTO `stocks` (`Title`, `ID`, `Value`) VALUES (\'$title\', \'$id\', \'$value\');\'; $query = mysql_query($sql); if ($query) { echo "Success!"; } else { echo "ERROR!"; } Can anyone help me?
  3. metalblend, thanks it works!!!!!!!!!!!!!!
  4. nope, this time it didn\'t show any names.
  5. I told it to select username from phpbb_users, and it should select multiple values. how would i make these values print on the page? I need all of them to print. Here is the code i have so far in case it helps: $mysql = mysql_connect("localhost", "doomflam_admin", "PASSWORD") or die("Could Not Connect To Database!"); mysql_select_db("doomflam_forum"); $query = "SELECT username FROM phpbb_users"; $setquery = mysql_query($query); $res = mysql_fetch_array($setquery); foreach($res as $key => $value) { print "$value <br>"; } And this outputs: Doomflame is the first username in the list, but i need it to list all of them.
  6. No, I mean if it should fetch 5 names, values, and shares.... How would I store them in arrays like this: $name = array("name1", "name2", "name3", "name4", "name5") $values = array("value1", "value2", "value3", "value4", "value5") $shares = array("shares1", "shares2", "shares3", "shares4", "shares5") replacing ___1-5 with the fetched value.
  7. Thanks! How would I make it handle this code if the output will be more than one value for each? SELECT name, owner, value, shares FROM stocks WHERE owner = \'$username\'
  8. I am connected to the database fine, but please give me the code to store the result of the query below in the variable $next. SELECT winner FROM drawings WHERE total = \'1\' Thanks, The NewBie
  9. What is wrong with this code: NOTE: I use phpbb. I am having it link to the phpbb files. If someone could remake my idea without the use of php I would greatly appritate it. <html> <head> <title>DFA :: Stocks :: Check Value</title> </head> <body> <?php define(\'IN_PHPBB\', true); $phpbb_root_path = \'./forum/\'; include($phpbb_root_path . \'extension.inc\'); include($phpbb_root_path . \'common.\'.$phpEx); if ($mode = "username") { $sql = "SELECT username AS username WHERE username = \'$username\' FROM ".USERS_TABLE.""; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, \'Could not check username.\', \'\', __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result); $usernamecheck = "$row[username]"; if ($username != $usernamecheck) { print "Invalid Username!"; } $sql = "SELECT name, value FROM stocks WHERE owner = $username if ( ! ($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, \'Could not query stocks.\', \'\', __LINE__, __FILE__, $sql); } while( $row = $db->sql_fetchrow($result) ) { print "$row[name]; $row[value]"; } } ?> </body> </html> Just replace host with localhost, username with USERNAME, and password with PASSWORD if you write a connecting thing.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.